itksn v0.4.4
Helper utility for parsing ITk Serial Numbers
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
- @matthefeickert's heputilities repository for a quick start
References
Metadata
Release files for itksn 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| itksn-0.4.4.tar.gz | 37.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| itksn-0.4.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.7 kB
Release files / itksn-0.4.4.tar.gz
| Download URL | itksn-0.4.4.tar.gz |
|---|---|
| Size | 37.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6dc707107c8bb1da83a713d4cea3d3622fbbf8d0cdcc0233947253cba44b6bf
|
|
BLAKE2b-256 checksum How to use checksums |
870d459d3220d367829deda8354d053ff3ddd20aa2d74c36f0d7cde888eaf8e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logRelease files / itksn-0.4.4-py3-none-any.whl
| Download URL | itksn-0.4.4-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2819a9ad401029cf65afef403ab0ccccb21b329f469ddfbfd868059a09bfe34e
|
|
BLAKE2b-256 checksum How to use checksums |
b47138510255c07b55812d901404e5f9795bde30cbce9617a5e6604d523e50c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency log