Skip to main content

itksn v0.4.4

Helper utility for parsing ITk Serial Numbers


itksn logo
CI/CD CI - Test CI - Coverage
Docs Docs Zenodo
Package PyPI - Downloads PyPI - Version PyPI platforms Conda-Forge
Meta GitHub - Discussion GitHub - Issue License - BSD 3.0

Using

From the command line, you can parse serial numbers. If there is an error in parsing, it will loudly complain (sometimes).

$ itksn parse 20UPGMC2291234
Container:
    atlas_project = uEnumByteString.new(b'20', 'atlas_detector') (total 14)
    system_code = uEnumByteString.new(b'U', 'phaseII_upgrade') (total 15)
    project_code = uEnumByteString.new(b'P', 'pixel') (total 5)
    subproject_code = uEnumByteString.new(b'G', 'pixel_general') (total 13)
    component_code = uEnumByteString.new(b'MC', 'Module_carrier') (total 14)
    identifier = Container:
        module_type = uEnumByteString.new(b'2', 'Linear_triplet_module_carrier') (total 29)
        module_version = uEnumByteString.new(b'2', 'Quad_v2p1') (total 9)
        manufacturer = b'9' (total 1)
        number = b'1234' (total 4)


$ itksn parse 20UPGR90012345
Container:
    atlas_project = uEnumByteString.new(b'20', 'atlas_detector') (total 14)
    system_code = uEnumByteString.new(b'U', 'phaseII_upgrade') (total 15)
    project_code = uEnumByteString.new(b'P', 'pixel') (total 5)
    subproject_code = uEnumByteString.new(b'G', 'pixel_general') (total 13)
    component_code = uEnumByteString.new(b'R9', 'Digital_quad_module') (total 19)
    identifier = Container:
        FE_chip_version = uEnumByteString.new(b'0', 'RD53A') (total 5)
        PCB_manufacturer = uEnumByteString.new(b'0', 'Dummy') (total 5)
        number = b'12345' (total 5)


$ itksn parse 20UPGPD0012345
Container:
    atlas_project = uEnumByteString.new(b'20', 'atlas_detector') (total 14)
    system_code = uEnumByteString.new(b'U', 'phaseII_upgrade') (total 15)
    project_code = uEnumByteString.new(b'P', 'pixel') (total 5)
    subproject_code = uEnumByteString.new(b'G', 'pixel_general') (total 13)
    component_code = uEnumByteString.new(b'PD', 'Dual_PCB') (total 8)
    identifier = Container:
        FE_chip_version = uEnumByteString.new(b'0', 'RD53A') (total 5)
        PCB_manufacturer = uEnumByteString.new(b'0', 'Dummy') (total 5)
        number = b'12345' (total 5)


$ itksn parse 20UPGFW2123456
Container:
    atlas_project = uEnumByteString.new(b'20', 'atlas_detector') (total 14)
    system_code = uEnumByteString.new(b'U', 'phaseII_upgrade') (total 15)
    project_code = uEnumByteString.new(b'P', 'pixel') (total 5)
    subproject_code = uEnumByteString.new(b'G', 'pixel_general') (total 13)
    component_code = uEnumByteString.new(b'FW', 'FE_chip_wafer') (total 13)
    identifier = Container:
        number = b'2123456' (total 7)
        batch_number = 0
        batch = u'RD53A' (total 5)
        wafer = 102
        row = 12
        column = 0

If you want to, for example, build the serial number for a front-end chip hex, you can do:

import itksn

number = str(0x20098).zfill(7).encode()
obj = {
    "atlas_project": "atlas_detector",
    "system_code": "phaseII_upgrade",
    "project_code": "pixel",
    "subproject_code": "pixel_general",
    "component_code": "FE_chip",
    "identifier": {"number": number},
}

itksn.build(obj)  # b'20UPGFC0131224'

or even from python, one can parse

import itksn

results = itksn.parse(b"20UPGR90012345")
assert results.atlas_project == "atlas_detector"
assert results.project_code == "pixel"
assert results.identifier.PCB_manufacturer == "Dummy"

or build

import itksn

sn = itksn.build(
    {
        "atlas_project": "atlas_detector",
        "system_code": "phaseII_upgrade",
        "project_code": "pixel",
        "subproject_code": "pixel_general",
        "component_code": "Digital_quad_module",
        "identifier": {
            "FE_chip_version": "RD53A",
            "PCB_manufacturer": "Dummy",
            "number": b"12345",
        },
    }
)
assert sn == b"20UPGR90012345"

Installation

In a fresh virtual environment, you can install from PyPI:

$ python -m pip install itksn

or from the main branch of the GitHub repository:

$ python -m pip install "git+https://github.com/kratsg/itksn.git"

The above is actually cloning and installing directly from the Git repository.

However, if you want to, you can of course also install it directly from the Git repository "locally" by first cloning the repo and then from the top level of it running

$ python -m pip install .

Contributing

As this library is experimental contributions of all forms are welcome.

If you have ideas on how to improve the API or fix a bug please open an Issue.

You are of course also most welcome and encouraged to open PRs.

Developing

To develop, use a virtual environment.

Once the environment is activated, clone the repo from GitHub

git clone git@github.com:kratsg/itksn.git

and you can use hatch for running tests/development, e.g.

hatch run +py=3.7 dev:test

(Optional) Then setup the Git pre-commit hooks by running

pre-commit install

Acknowledgements

References

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itksn-0.4.4.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itksn-0.4.4-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file itksn-0.4.4.tar.gz.

File metadata

  • Download URL: itksn-0.4.4.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for itksn-0.4.4.tar.gz
Algorithm Hash digest
SHA256 d6dc707107c8bb1da83a713d4cea3d3622fbbf8d0cdcc0233947253cba44b6bf
MD5 3a7bb5f372c4c3283b5aa7aaf03cff64
BLAKE2b-256 870d459d3220d367829deda8354d053ff3ddd20aa2d74c36f0d7cde888eaf8e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for itksn-0.4.4.tar.gz:

Publisher: cd.yml on kratsg/itksn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file itksn-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: itksn-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for itksn-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2819a9ad401029cf65afef403ab0ccccb21b329f469ddfbfd868059a09bfe34e
MD5 88d2b0a53c01124de7f8b4fc90dae0de
BLAKE2b-256 b47138510255c07b55812d901404e5f9795bde30cbce9617a5e6604d523e50c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for itksn-0.4.4-py3-none-any.whl:

Publisher: cd.yml on kratsg/itksn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page