{"id":19686156,"url":"https://github.com/loiccoyle/blm_header","last_synced_at":"2025-02-27T07:42:05.517Z","repository":{"id":46050709,"uuid":"257375453","full_name":"loiccoyle/blm_header","owner":"loiccoyle","description":"Bruteforce the LHC's BLM headers.","archived":false,"fork":false,"pushed_at":"2021-11-17T17:30:14.000Z","size":123,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T07:12:01.881Z","etag":null,"topics":["blm","cern","header","lhc","metadata"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loiccoyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-20T18:52:58.000Z","updated_at":"2021-11-17T17:29:15.000Z","dependencies_parsed_at":"2022-09-15T15:11:21.997Z","dependency_job_id":null,"html_url":"https://github.com/loiccoyle/blm_header","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fblm_header","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fblm_header/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fblm_header/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loiccoyle%2Fblm_header/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loiccoyle","download_url":"https://codeload.github.com/loiccoyle/blm_header/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240993950,"owners_count":19890419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blm","cern","header","lhc","metadata"],"created_at":"2024-11-11T18:26:28.556Z","updated_at":"2025-02-27T07:42:05.482Z","avatar_url":"https://github.com/loiccoyle.png","language":"Python","readme":"# blm_header\n\nBrute force the LHC's BLM headers.\n\n# Installation\n```shell\ngit clone https://github.com/loiccoyle/blm_header\ncd blm_header\npip install .\n```\n\n# Dependencies\n* `numpy`\n* `pandas`\n* `pytimber`\n\nOptional:\n* `tqdm` (for progress bars)\n\n\n# Usage\nThis `blm_header` package provides the `HeaderMaker` class along with a command line tool, `blm_header`.\n\n### `blm_header` command line tool\n\nThe `blm_header` command will generate a header for the given timestamp.\n```\n$ blm_header --help\n\nusage: BLM_header [-h] [-t2 T2] [-f LOOK_FORWARD] [-b LOOK_BACK] [-n N_JOBS]\n                  [-t N_THREADS] [-v] [-o OUTPUT]\n                  t\n\nBruteforce the LHC's BLM headers.\n\npositional arguments:\n  t                     Time at which to create de header. int or float:\n                        assumes utc time, converts to pd.Timestamp and to\n                        Europe/Zurich timezone. str: a pd.to_datetime\n                        compatible str, assumes utc, converts to pd.Timestamp.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t2 T2                Same type logic as \"t\", if provided will ignore any\n                        \"LOOK_FORWARD\" or \"LOOK_BACK\" arguments and use the\n                        provided \"t\" and \"T2\" arguments. (default: None)\n  -f LOOK_FORWARD, --look_forward LOOK_FORWARD\n                        Look forward amount, time format string, \"1M\", \"4H\",\n                        ... (default: 30M)\n  -b LOOK_BACK, --look_back LOOK_BACK\n                        Look back amount, time format string, \"1M\", \"4H\", ...\n                        (default: 30M)\n  -n N_JOBS, --n_jobs N_JOBS\n                        Number of parallel jobs. (default: -1)\n  -t N_THREADS, --n_threads N_THREADS\n                        Number of threads with which to fetch timber data.\n                        (default: 1)\n  -v, --verbose         Verbosity, -v for INFO level, -vv for DEBUG level.\n                        (default: 0)\n  -o OUTPUT, --output OUTPUT\n                        File in which to write the header. The placeholder\n                        \"{t}\" will be replaced with the requested time.\n\t\t\t\t\t\t(default: stdout)\n```\n##### Some examples:\n\nTo generate the BLM header for '2018-01-01 00:00:00' and write it in '2018_01_01_00_00_00+0100.csv':\n```shell\n$ blm_header '2018-01-01 00:00:00' -o {t}.csv\n```\n\nTo generate the BLM header for epoch time 1457964768.0 (2016-03-14 15:12:48+0100) and write it in '2016_03_14_15_12_48+0100.csv' with verbose output:\n```shell\n$ blm_header 1457964768.0 -o {t}.csv -v\n```\n\n### The `HeaderMaker` class:\nFor use in python, this package also provides the `HeaderMaker` class.\n\nThe basic usage is:\n```python\nfrom blm_header import HeaderMaker\n\nhm = HeaderMaker('2018-01-01 00:00:00', look_back='0S', look_forward='60M', n_threads=1)\nheader = hm.make()\n```\n\n# How it works\nFor a given a time range, `blm_header` will fetch the BLM vector numeric data along with the data of the individual BLMs in the timber database. Unfortunately, the single BLM timber entries suffer from sporatic downsampling and as such cannot be compared trivially with the vector numeric data. Leveraging the power of `pandas` for dealing with time indexed data, we can overcome this. A distance matrix is constructed between the columns of the vector numeric data and the individual BLM signals, with the distance metric being: `mean(abs(v - s))`, with `v` being a column of the vector numeric data and `s` the data of a single BLM. Each columns (BLM) of the vector numeric data is then assigned the BLM which minimizes this distance.\n\nNote: Despite the vast majority of the BLMs being correctly assigned, when the requested time falls in a region with no beam, as the matching data is basicaly noise, the header produced can contain duplicate BLM names.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floiccoyle%2Fblm_header","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floiccoyle%2Fblm_header","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floiccoyle%2Fblm_header/lists"}