itksn

ITk Serial Number parser

https://github.com/kratsg/itksn

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

ITk Serial Number parser

Basic Info
Statistics
  • Stars: 4
  • Watchers: 3
  • Forks: 2
  • Open Issues: 4
  • Releases: 12
Created over 5 years ago · Last pushed 7 months ago
Metadata Files
Readme License Code of conduct Citation Zenodo

README.md

itksn v0.4.2

Helper utility for parsing ITk Serial Numbers


itksn logo | | | | --- | --- | | CI/CD | [![CI - Test][actions-badge]][actions-link] [![CI - Coverage][coverage-badge]][coverage-link] | | Docs | [![Docs][actions-badge-docs]][actions-link-docs] [![Zenodo][zenodo-badge]][zenodo-link] | | Package | [![PyPI - Downloads][pypi-downloads]][pypi-link] [![PyPI - Version][pypi-version]][pypi-link] [![PyPI platforms][pypi-platforms]][pypi-link] [![Conda-Forge][conda-badge]][conda-link] | | Meta | [![GitHub - Discussion][github-discussions-badge]][github-discussions-link] [![GitHub - Issue][github-issues-badge]][github-issues-link] [![License - BSD 3.0][license-badge]][license-link] |

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: atlasproject = (enum) atlasdetector b'20' systemcode = (enum) phaseIIupgrade b'U' projectcode = (enum) pixelgeneral b'PG' subprojectcode = (enum) Modulecarrier b'MC' identifier = Container: moduletype = (enum) Lineartripletmodulecarrier b'2' moduleversion = (enum) Quadv2p1 b'2' manufacturer = b'9' (total 1) number = b'1234' (total 4)

$ itksn parse 20UPGR90012345 Container: atlasproject = (enum) atlasdetector b'20' systemcode = (enum) phaseIIupgrade b'U' projectcode = (enum) pixelgeneral b'PG' subprojectcode = (enum) Digitalquadmodule b'R9' identifier = Container: FEchip_version = (enum) RD53A b'0' reserved = b'0' (total 1) number = b'12345' (total 5)

$ itksn parse 20UPGPD0012345 Container: atlasproject = (enum) atlasdetector b'20' systemcode = (enum) phaseIIupgrade b'U' projectcode = (enum) pixelgeneral b'PG' subprojectcode = (enum) DualPCB b'PD' identifier = Container: FEchipversion = (enum) RD53A b'0' reserved = b'0' (total 1) number = b'12345' (total 5)

$ itksn parse 20UPGFW2123456 Container: atlasproject = (enum) atlasdetector b'20' systemcode = (enum) phaseIIupgrade b'U' projectcode = (enum) pixelgeneral b'PG' subprojectcode = (enum) FEchipwafer b'FW' identifier = Container: batchnumber = (enum) CROC b'2' number = b'123456' (total 6) ```

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

```python import itksn

number = str(0x20098).zfill(7).encode() obj = { "atlasproject": "atlasdetector", "systemcode": "phaseIIupgrade", "projectcode": "pixelgeneral", "subprojectcode": "FEchip", "identifier": {"number": number}, }

itksn.core.SerialNumberStruct.build(obj) # b'20UPGFC0131224' ```

or even from python, one can parse

```python import itksn

results = itksn.parse(b"20UPGR90012345") assert results.atlasproject == "atlasdetector" assert results.projectcode == "pixel" assert results.identifier.PCBmanufacturer == "Dummy" ```

or build

```python from itksn.core import SerialNumberStruct

sn = SerialNumberStruct.build( { "atlasproject": "atlasdetector", "systemcode": "phaseIIupgrade", "projectcode": "pixel", "subprojectcode": "pixelgeneral", "componentcode": "Digitalquadmodule", "identifier": { "FEchipversion": "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

Owner

  • Name: Giordon Stark
  • Login: kratsg
  • Kind: user
  • Company: SCIPP, University of California, Santa Cruz

Proton Smashing, Code Crashing, and ROM Flashing, keybase.io/kratsg

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Please cite the following works when using this software."
type: software
authors:
- family-names: "Stark"
  given-names: "Giordon"
  orcid: "https://orcid.org/0000-0001-6616-3433"
  affiliation: "SCIPP, University of California, Santa Cruz"
title: "itksn: v0.4.2"
version: 0.4.2
doi: 10.5281/zenodo.7644145
repository-code: "https://github.com/kratsg/itksn/releases/tag/v0.4.2"
url: "https://kratsg.github.io/itksn/0.4.2/"
keywords:
  - python
  - physics
  - construct
  - parsing
license: "BSD-3.0"
abstract: |
  itksn is a Serial Number parser (and builder) for the ATLAS ITk project.

GitHub Events

Total
  • Create event: 18
  • Release event: 4
  • Issues event: 7
  • Watch event: 1
  • Delete event: 16
  • Issue comment event: 7
  • Push event: 66
  • Pull request event: 31
  • Fork event: 1
Last Year
  • Create event: 18
  • Release event: 4
  • Issues event: 7
  • Watch event: 1
  • Delete event: 16
  • Issue comment event: 7
  • Push event: 66
  • Pull request event: 31
  • Fork event: 1

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 30
  • Total Committers: 4
  • Avg Commits per committer: 7.5
  • Development Distribution Score (DDS): 0.3
Top Committers
Name Email Commits
Giordon Stark k****g@g****m 21
pre-commit-ci[bot] 6****]@u****m 4
Giordon Stark k****g@u****m 4
dependabot[bot] 4****]@u****m 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 9
  • Total pull requests: 128
  • Average time to close issues: 5 months
  • Average time to close pull requests: 14 days
  • Total issue authors: 3
  • Total pull request authors: 4
  • Average comments per issue: 0.22
  • Average comments per pull request: 0.14
  • Merged pull requests: 114
  • Bot issues: 1
  • Bot pull requests: 111
Past Year
  • Issues: 5
  • Pull requests: 30
  • Average time to close issues: 13 days
  • Average time to close pull requests: 10 days
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 0.4
  • Average comments per pull request: 0.33
  • Merged pull requests: 23
  • Bot issues: 1
  • Bot pull requests: 24
Top Authors
Issue Authors
  • kratsg (7)
  • lime86 (1)
Pull Request Authors
  • pre-commit-ci[bot] (85)
  • dependabot[bot] (37)
  • kratsg (18)
  • lime86 (4)
Top Labels
Issue Labels
Pull Request Labels
dependencies (37) enhancement (4) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 791 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 14
  • Total maintainers: 1
pypi.org: itksn

ITk Serial Number parser

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 791 Last month
Rankings
Dependent packages count: 10.1%
Dependent repos count: 21.5%
Average: 23.7%
Stargazers count: 25.1%
Forks count: 29.8%
Downloads: 31.9%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pre-commit/action v3.0.0 composite
  • pypa/gh-action-pypi-publish v1.8.8 composite
.github/workflows/docs.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi
  • construct >=2.10
  • typer *
  • typing_extensions >=3.7; python_version<'3.11'