Metadata-Version: 2.1
Name: itksn
Version: 0.0.3
Summary: ITk Serial Number parser
Home-page: https://github.com/kratsg/itksn
Author: Giordon Stark
Author-email: gstark@cern.ch
License: BSD 3-Clause
Project-URL: Documentation, https://kratsg.github.io/itksn/
Project-URL: Source, https://github.com/kratsg/itksn
Project-URL: Tracker, https://github.com/kratsg/itksn/issues
Keywords: hep utilities physics itk
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click (>=6.0)
Requires-Dist: construct (>=2.10)
Provides-Extra: complete
Requires-Dist: black ; extra == 'complete'
Requires-Dist: bumpversion (~=0.5) ; extra == 'complete'
Requires-Dist: check-manifest ; extra == 'complete'
Requires-Dist: pre-commit ; extra == 'complete'
Requires-Dist: pyflakes ; extra == 'complete'
Requires-Dist: pytest-console-scripts (~=0.2) ; extra == 'complete'
Requires-Dist: pytest-cov (~=2.8) ; extra == 'complete'
Requires-Dist: pytest-mock (~=3.0) ; extra == 'complete'
Requires-Dist: pytest (~=6.0) ; extra == 'complete'
Requires-Dist: twine ; extra == 'complete'
Provides-Extra: develop
Requires-Dist: black ; extra == 'develop'
Requires-Dist: bumpversion (~=0.5) ; extra == 'develop'
Requires-Dist: check-manifest ; extra == 'develop'
Requires-Dist: pre-commit ; extra == 'develop'
Requires-Dist: pyflakes ; extra == 'develop'
Requires-Dist: pytest-console-scripts (~=0.2) ; extra == 'develop'
Requires-Dist: pytest-cov (~=2.8) ; extra == 'develop'
Requires-Dist: pytest-mock (~=3.0) ; extra == 'develop'
Requires-Dist: pytest (~=6.0) ; extra == 'develop'
Requires-Dist: twine ; extra == 'develop'
Provides-Extra: lint
Requires-Dist: black ; extra == 'lint'
Requires-Dist: pyflakes ; extra == 'lint'
Provides-Extra: test
Requires-Dist: check-manifest ; extra == 'test'
Requires-Dist: pytest-console-scripts (~=0.2) ; extra == 'test'
Requires-Dist: pytest-cov (~=2.8) ; extra == 'test'
Requires-Dist: pytest-mock (~=3.0) ; extra == 'test'
Requires-Dist: pytest (~=6.0) ; extra == 'test'

# itksn

[![GitHub Project](https://img.shields.io/badge/GitHub--blue?style=social&logo=GitHub)](https://github.com/kratsg/itksn)
[![GitHub Actions Status: CI](https://github.com/kratsg/itksn/workflows/CI/badge.svg?branch=master)](https://github.com/kratsg/itksn/actions?query=workflow%3ACI+branch%3Amaster)
[![Code Coverage](https://codecov.io/gh/kratsg/itksn/graph/badge.svg?branch=master)](https://codecov.io/gh/kratsg/itksn?branch=master)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

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 = (enum) atlas_detector b'20'
    system_code = (enum) phaseII_upgrade b'U'
    project_code = (enum) pixel_general b'PG'
    subproject_code = (enum) Module_carrier b'MC'
    identifier = Container:
        module_type = (enum) Linear_triplet_module_carrier b'2'
        module_version = (enum) Quad_v2p1 b'2'
        manufacturer = b'9' (total 1)
        number = b'1234' (total 4)

$ itksn parse 20UPGR40012345
Container:
    atlas_project = (enum) atlas_detector b'20'
    system_code = (enum) phaseII_upgrade b'U'
    project_code = (enum) pixel_general b'PG'
    subproject_code = (enum) Digital_quad_module b'R4'
    identifier = Container:
        FE_chip_version = (enum) RD53A b'0'
        reserved = b'0' (total 1)
        number = b'12345' (total 5)

$ itksn parse 20UPGPD0012345
Container:
    atlas_project = (enum) atlas_detector b'20'
    system_code = (enum) phaseII_upgrade b'U'
    project_code = (enum) pixel_general b'PG'
    subproject_code = (enum) Dual_PCB b'PD'
    identifier = Container:
        FE_chip_version = (enum) RD53A b'0'
        reserved = b'0' (total 1)
        number = b'12345' (total 5)

$ itksn parse 20UPGFW2123456
Container:
    atlas_project = (enum) atlas_detector b'20'
    system_code = (enum) phaseII_upgrade b'U'
    project_code = (enum) pixel_general b'PG'
    subproject_code = (enum) FE_chip_wafer b'FW'
    identifier = Container:
        batch_number = (enum) CROC b'2'
        number = b'123456' (total 6)
```

## Installation

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

```
$ python -m pip install itksn
```

or from the master 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 install all necessary packages for development

```
python -m pip install --ignore-installed --upgrade -e .[complete]
```

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

```
pre-commit install
```

## Acknowledgements

- [@matthefeickert](https://github.com/matthewfeickert)'s [heputilities](https://github.com/matthewfeickert/heputils) repository for a quick start


## References

- [Serial Number Specification for ITk pixel modules](https://cds.cern.ch/record/2728364)
- [Proposal for numbering scheme in the ITk, ATU-SYS-AM-0001](https://edms.cern.ch/document/1773411/1)


