data-manipulation-utilities 0.0.6__py3-none-any.whl → 0.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {data_manipulation_utilities-0.0.6.data → data_manipulation_utilities-0.0.9.data}/scripts/publish +13 -2
- {data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/METADATA +29 -2
- {data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/RECORD +10 -7
- {data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/WHEEL +1 -1
- {data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/entry_points.txt +1 -0
- dmu/physics/utilities.py +57 -0
- dmu_data/physics/evt_name.yaml +8707 -0
- dmu_scripts/git/publish +13 -2
- dmu_scripts/physics/update_decinfo.py +111 -0
- {data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/top_level.txt +0 -0
{data_manipulation_utilities-0.0.6.data → data_manipulation_utilities-0.0.9.data}/scripts/publish
RENAMED
@@ -69,9 +69,20 @@ create_tag()
|
|
69
69
|
git tag -a $VERSION
|
70
70
|
}
|
71
71
|
# --------------------------
|
72
|
+
push_all()
|
73
|
+
{
|
74
|
+
for REMOTE in $(git remote);do
|
75
|
+
echo "Pushing tags and commits to remote: $REMOTE"
|
76
|
+
git add pyproject.toml
|
77
|
+
git commit -m "Publication commit"
|
78
|
+
|
79
|
+
git push -u $REMOTE HEAD
|
80
|
+
git push $REMOTE --tags
|
81
|
+
done
|
82
|
+
}
|
83
|
+
# --------------------------
|
72
84
|
get_opts "$@"
|
73
85
|
|
74
86
|
get_version
|
75
87
|
create_tag
|
76
|
-
|
77
|
-
git push --tags
|
88
|
+
push_all
|
{data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: data_manipulation_utilities
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
4
4
|
Description-Content-Type: text/markdown
|
5
5
|
Requires-Dist: zfit
|
6
6
|
Requires-Dist: logzero
|
@@ -18,12 +18,39 @@ Requires-Dist: hist[plot]
|
|
18
18
|
Requires-Dist: polars
|
19
19
|
Requires-Dist: pandas
|
20
20
|
Provides-Extra: dev
|
21
|
-
Requires-Dist: pytest
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
22
22
|
|
23
23
|
# D(ata) M(anipulation) U(tilities)
|
24
24
|
|
25
25
|
These are tools that can be used for different data analysis tasks.
|
26
26
|
|
27
|
+
For LHCb specific tools (not useful for people outside LHCb) see [this](doc/lhcb.md)
|
28
|
+
|
29
|
+
# GIT
|
30
|
+
|
31
|
+
## Pushing
|
32
|
+
|
33
|
+
From the root directory of a version controlled project (i.e. a directory with the `.git` subdirectory)
|
34
|
+
using a `pyproject.toml` file, run:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
publish
|
38
|
+
```
|
39
|
+
|
40
|
+
such that:
|
41
|
+
|
42
|
+
1. The `pyproject.toml` file is checked and the version of the project is extracted.
|
43
|
+
1. If a tag named as the version exists move to the steps below.
|
44
|
+
1. If it does not, make a new tag with the name as the version
|
45
|
+
|
46
|
+
Then, for each remote it pushes the tags and the commits.
|
47
|
+
|
48
|
+
*Why?*
|
49
|
+
|
50
|
+
1. Tags should be named as the project's version
|
51
|
+
1. As soon as a new version is created, that version needs to be tagged.
|
52
|
+
1. In GitHub, one can configure actions to publish projects when the commits are tagged.
|
53
|
+
|
27
54
|
# Generic
|
28
55
|
|
29
56
|
This section describes generic tools that could not be put in a specific category, but tend to be useful.
|
{data_manipulation_utilities-0.0.6.dist-info → data_manipulation_utilities-0.0.9.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
data_manipulation_utilities-0.0.
|
1
|
+
data_manipulation_utilities-0.0.9.data/scripts/publish,sha256=MHDsn93GTeJxpsM3hNbOJ7JEtsugX21WOFQ2PGWairU,1943
|
2
2
|
dmu/arrays/utilities.py,sha256=PKoYyybPptA2aU-V3KLnJXBudWxTXu4x1uGdIMQ49HY,1722
|
3
3
|
dmu/generic/utilities.py,sha256=0Xnq9t35wuebAqKxbyAiMk1ISB7IcXK4cFH25MT1fgw,1741
|
4
4
|
dmu/logging/log_store.py,sha256=v0tiNz-6ktT_afD5DuvCZ8Nmr82JKQOPli8hgd28P1Q,3960
|
@@ -6,6 +6,7 @@ dmu/ml/cv_classifier.py,sha256=n81m7i2M6Zq96AEd9EZGwXSrbG5m9jkS5RdeXvbsAXU,3712
|
|
6
6
|
dmu/ml/cv_predict.py,sha256=Bqxu-f6qquKJokFljhCzL_kiGcjLJLQFhVBD130fsyw,4893
|
7
7
|
dmu/ml/train_mva.py,sha256=d_n-A07DFweikz5nXap4OE_Mqx8VprFT7zbxmnQAbac,9638
|
8
8
|
dmu/ml/utilities.py,sha256=Nue7O9zi1QXgjGRPH6wnSAW9jusMQ2ZOSDJzBqJKIi0,3687
|
9
|
+
dmu/physics/utilities.py,sha256=SGUNZT9qHvo6hpS12857cJRd4BPEwGDLpWaO5BhUJDk,1579
|
9
10
|
dmu/plotting/plotter.py,sha256=laa6Kl7P-ZOIhaOFBVjOH4XQ4kPCV7wBNvLIMBnyCwM,7181
|
10
11
|
dmu/plotting/plotter_1d.py,sha256=G-i94uzm2TjNaog1A4agAKar_G0qNdkAqIPCmzhe85Y,3660
|
11
12
|
dmu/plotting/plotter_2d.py,sha256=SWPKns-CfpUZHgBXvwm3gceH3k2eL_mKGXQ8sWpZJB0,2919
|
@@ -20,6 +21,7 @@ dmu/testing/utilities.py,sha256=WbMM4e9Cn3-B-12Vr64mB5qTKkV32joStlRkD-48lG0,3460
|
|
20
21
|
dmu/text/transformer.py,sha256=4lrGknbAWRm0-rxbvgzOO-eR1-9bkYk61boJUEV3cQ0,6100
|
21
22
|
dmu_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
23
|
dmu_data/ml/tests/train_mva.yaml,sha256=TCniCVpXMEFxZcHa8IIqollKA7ci4OkBnRznLEkXM9o,925
|
24
|
+
dmu_data/physics/evt_name.yaml,sha256=lf1SIIJIpG2PNVZ_AngMUG_IAYXbPsqUTgejtuGL1Dk,427546
|
23
25
|
dmu_data/plotting/tests/2d.yaml,sha256=lTMNheK3DB8klp4O5QjMDwBI1A1Oh2_Wp2F2Ro9VQKM,282
|
24
26
|
dmu_data/plotting/tests/fig_size.yaml,sha256=7ROq49nwZ1A2EbPiySmu6n3G-Jq6YAOkc3d2X3YNZv0,294
|
25
27
|
dmu_data/plotting/tests/high_stat.yaml,sha256=bLglBLCZK6ft0xMhQ5OltxE76cWsBMPMjO6GG0OkDr8,522
|
@@ -33,14 +35,15 @@ dmu_data/text/transform.txt,sha256=EX760da6Vkf-_EPxnQlC5hGSkfFhJCCGCD19NU-1Qto,4
|
|
33
35
|
dmu_data/text/transform_set.toml,sha256=Jeh7BTz82idqvbOQJtl9-ur56mZkzDn5WtvmIb48LoE,150
|
34
36
|
dmu_data/text/transform_set.txt,sha256=1KivMoP9LxPn9955QrRmOzjEqduEjhTetQ9MXykO5LY,46
|
35
37
|
dmu_data/text/transform_trf.txt,sha256=zxBRTgcSmX7RdqfmWF88W1YqbyNHa4Ccruf1MmnYv2A,74
|
36
|
-
dmu_scripts/git/publish,sha256=
|
38
|
+
dmu_scripts/git/publish,sha256=MHDsn93GTeJxpsM3hNbOJ7JEtsugX21WOFQ2PGWairU,1943
|
37
39
|
dmu_scripts/physics/check_truth.py,sha256=b1P_Pa9ef6VcFtyY6Y9KS9Om9L-QrCBjDKp4dqca0PQ,3964
|
40
|
+
dmu_scripts/physics/update_decinfo.py,sha256=Y5cO3GdUWtVHeXVd37Q04xlFtQBMTLlqCF-medL8SM8,3322
|
38
41
|
dmu_scripts/rfile/compare_root_files.py,sha256=T8lDnQxsRNMr37x1Y7YvWD8ySHrJOWZki7ZQynxXX9Q,9540
|
39
42
|
dmu_scripts/rfile/print_trees.py,sha256=Ze4Ccl_iUldl4eVEDVnYBoe4amqBT1fSBR1zN5WSztk,941
|
40
43
|
dmu_scripts/ssh/coned.py,sha256=lhilYNHWRCGxC-jtyJ3LQ4oUgWW33B2l1tYCcyHHsR0,4858
|
41
44
|
dmu_scripts/text/transform_text.py,sha256=9akj1LB0HAyopOvkLjNOJiptZw5XoOQLe17SlcrGMD0,1456
|
42
|
-
data_manipulation_utilities-0.0.
|
43
|
-
data_manipulation_utilities-0.0.
|
44
|
-
data_manipulation_utilities-0.0.
|
45
|
-
data_manipulation_utilities-0.0.
|
46
|
-
data_manipulation_utilities-0.0.
|
45
|
+
data_manipulation_utilities-0.0.9.dist-info/METADATA,sha256=raGR5TDWVLfnMm2_Tpv5PgpLmZzKDSaVi3Vlb3l3sCo,20074
|
46
|
+
data_manipulation_utilities-0.0.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
47
|
+
data_manipulation_utilities-0.0.9.dist-info/entry_points.txt,sha256=-nNgwig7t-dba8EXsI5TxmvLaDet9_qQAbpusuq64Xc,327
|
48
|
+
data_manipulation_utilities-0.0.9.dist-info/top_level.txt,sha256=n_x5J6uWtSqy9mRImKtdA2V2NJNyU8Kn3u8DTOKJix0,25
|
49
|
+
data_manipulation_utilities-0.0.9.dist-info/RECORD,,
|
dmu/physics/utilities.py
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
'''
|
2
|
+
Module containing utility functions
|
3
|
+
'''
|
4
|
+
from importlib.resources import files
|
5
|
+
from functools import cache
|
6
|
+
|
7
|
+
import yaml
|
8
|
+
|
9
|
+
# ---------------------------------
|
10
|
+
@cache
|
11
|
+
def _get_evt_name() -> dict[str,str]:
|
12
|
+
file_path = files('dmu_data').joinpath('physics/evt_name.yaml')
|
13
|
+
file_path = str(file_path)
|
14
|
+
with open(file_path, encoding='utf-8') as ifile:
|
15
|
+
d_data = yaml.safe_load(ifile)
|
16
|
+
|
17
|
+
return d_data
|
18
|
+
# ---------------------------------
|
19
|
+
def _format_nickname(nickname : str, style : str) -> str:
|
20
|
+
if style == 'literal':
|
21
|
+
return nickname
|
22
|
+
|
23
|
+
if style != 'safe_1':
|
24
|
+
raise ValueError(f'Invalid style: {style}')
|
25
|
+
|
26
|
+
nickname = nickname.replace('.', 'p')
|
27
|
+
nickname = nickname.replace('-', 'mn')
|
28
|
+
nickname = nickname.replace('+', 'pl')
|
29
|
+
nickname = nickname.replace('=', '_eq_')
|
30
|
+
nickname = nickname.replace(',', '_')
|
31
|
+
|
32
|
+
return nickname
|
33
|
+
# ---------------------------------
|
34
|
+
def read_decay_name(event_type : str, style : str = 'safe_1') -> str:
|
35
|
+
'''
|
36
|
+
Takes event type, and style strings, returns nickname of decay as defined in DecFiles package
|
37
|
+
|
38
|
+
Styles:
|
39
|
+
|
40
|
+
literal : No change is made to nickname
|
41
|
+
safe_1 (default): With following replacements:
|
42
|
+
. -> p
|
43
|
+
= -> _eq_
|
44
|
+
- -> mn
|
45
|
+
+ -> pl
|
46
|
+
, -> _
|
47
|
+
'''
|
48
|
+
d_evt_name = _get_evt_name()
|
49
|
+
|
50
|
+
if event_type not in d_evt_name:
|
51
|
+
raise ValueError(f'Event type {event_type} not found')
|
52
|
+
|
53
|
+
value = d_evt_name[event_type]
|
54
|
+
value = _format_nickname(value, style)
|
55
|
+
|
56
|
+
return value
|
57
|
+
# ---------------------------------
|