data-manipulation-utilities 0.2.8.dev725__py3-none-any.whl → 0.2.8.dev733__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: data-manipulation-utilities
3
- Version: 0.2.8.dev725
3
+ Version: 0.2.8.dev733
4
4
  Summary: Project storing utilities needed to reduce boilerplate code when analyzing data
5
5
  Requires-Python: >=3.10,<3.13
6
6
  Classifier: Programming Language :: Python :: 3
@@ -68,6 +68,35 @@ Then, for each remote it pushes the tags and the commits.
68
68
 
69
69
  This section describes generic tools that could not be put in a specific category, but tend to be useful.
70
70
 
71
+ ## Naming
72
+
73
+ ### Name cleaning
74
+
75
+ This is an alternative to projects like `slugify`. The function will
76
+ take strings with characters that are not easy to use when naming files and
77
+ will clean it up with:
78
+
79
+ ```python
80
+
81
+ from dmu.generic import naming
82
+
83
+ value = naming.clean_special_characters(name=name)
84
+ ```
85
+
86
+ e.g.:
87
+
88
+ ```
89
+ a b' -> 'a_b'
90
+ a$b' -> 'a_b'
91
+ a > b' -> 'a_gt_b'
92
+ a < b' -> 'a_lt_b'
93
+ a = b' -> 'a_eq_b'
94
+ {a}' -> '_a_'
95
+ a.b' -> 'apb'
96
+ a && b' -> 'a_and_b'
97
+ a || b' -> 'a_or_b'
98
+ ```
99
+
71
100
  ## Caching data
72
101
 
73
102
  In order to reuse data that is hard to calculate one would need:
@@ -1483,6 +1512,7 @@ stats:
1483
1512
  ```
1484
1513
 
1485
1514
  it's up to the user to build this dictionary and load it.
1515
+ this can also be a `DictConfig` from the `OmegaConf` project.
1486
1516
 
1487
1517
  ### Pluggins
1488
1518
 
@@ -1,6 +1,7 @@
1
1
  dmu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  dmu/arrays/utilities.py,sha256=PKoYyybPptA2aU-V3KLnJXBudWxTXu4x1uGdIMQ49HY,1722
3
3
  dmu/generic/hashing.py,sha256=QR5Gbv6-ANvi5hL232UNMrw9DONpU27BWTynXGxQLGU,1806
4
+ dmu/generic/naming.py,sha256=qa0v7kw9Oa2wERT7gduvDJ9Ccf2LEInF9lroxhKPL7g,949
4
5
  dmu/generic/utilities.py,sha256=0tT93vF_x0q8STRrTD0GvBEpALz-mqE-vJyen4zWCO8,6861
5
6
  dmu/generic/version_management.py,sha256=j0ImlAq6SVNjTh3xRsF6G7DSoyr1w8kTRY84dNriGRE,3750
6
7
  dmu/logging/log_store.py,sha256=eRSy8Y4fuiDFJK02Z6fq67XQzOrhQ7GMr2LvvJQbJ40,5172
@@ -15,7 +16,7 @@ dmu/pdataframe/utilities.py,sha256=xl6iLVKUccqVXYjuHsDUZ6UrCKQPw1k8D-f6407Yq30,2
15
16
  dmu/plotting/fwhm.py,sha256=4e8n6624pxWLcOOtayCQ_hDSSMKU21-3UsdmbkX1ojk,1949
16
17
  dmu/plotting/matrix.py,sha256=s_5W8O3yXF3u8OX3f4J4hCoxIVZt1TF8S-qJsFBh2Go,5005
17
18
  dmu/plotting/plotter.py,sha256=5N5mLdQAqOUs43ukX5mT9nRaYD5dkn_sED5NoZJV5A0,8483
18
- dmu/plotting/plotter_1d.py,sha256=Kyoyh-QyZLXXqX19wqEDUWCD1nJEvEonGp9nlgEaoZE,10936
19
+ dmu/plotting/plotter_1d.py,sha256=6kdO48EL4Ccsqszbw810qUmv-hah-zEbQTqfyTlbxAM,10547
19
20
  dmu/plotting/plotter_2d.py,sha256=dXC-7Rsquibe5cn7622ryoKpuv7KCAmouIIXwQ_VEFM,3172
20
21
  dmu/plotting/utilities.py,sha256=SI9dvtZq2gr-PXVz71KE4o0i09rZOKgqJKD1jzf6KXk,1167
21
22
  dmu/rdataframe/atr_mgr.py,sha256=FdhaQWVpsm4OOe1IRbm7rfrq8VenTNdORyI-lZ2Bs1M,2386
@@ -76,7 +77,7 @@ dmu_data/text/transform.txt,sha256=EX760da6Vkf-_EPxnQlC5hGSkfFhJCCGCD19NU-1Qto,4
76
77
  dmu_data/text/transform_set.toml,sha256=Jeh7BTz82idqvbOQJtl9-ur56mZkzDn5WtvmIb48LoE,150
77
78
  dmu_data/text/transform_set.txt,sha256=1KivMoP9LxPn9955QrRmOzjEqduEjhTetQ9MXykO5LY,46
78
79
  dmu_data/text/transform_trf.txt,sha256=zxBRTgcSmX7RdqfmWF88W1YqbyNHa4Ccruf1MmnYv2A,74
79
- data_manipulation_utilities-0.2.8.dev725.dist-info/METADATA,sha256=_4bxAW7aoKgPY3H1rKhp626lTEYrD2UWrwZX9avU750,51153
80
- data_manipulation_utilities-0.2.8.dev725.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
81
- data_manipulation_utilities-0.2.8.dev725.dist-info/entry_points.txt,sha256=M0C8_u9B_xSmyfemdPwdIBh9QuPIkjhEpG060Y5_Pjw,321
82
- data_manipulation_utilities-0.2.8.dev725.dist-info/RECORD,,
80
+ data_manipulation_utilities-0.2.8.dev733.dist-info/METADATA,sha256=v5qmztFZBzoriqplP_EvZ5nhowvDKXS7dchJQ6QNgHQ,51716
81
+ data_manipulation_utilities-0.2.8.dev733.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
82
+ data_manipulation_utilities-0.2.8.dev733.dist-info/entry_points.txt,sha256=M0C8_u9B_xSmyfemdPwdIBh9QuPIkjhEpG060Y5_Pjw,321
83
+ data_manipulation_utilities-0.2.8.dev733.dist-info/RECORD,,
dmu/generic/naming.py ADDED
@@ -0,0 +1,35 @@
1
+ '''
2
+ This module contains functions meant to deal with names
3
+ i.e. strings that represent names
4
+ '''
5
+
6
+ import re
7
+
8
+ from dmu.logging.log_store import LogStore
9
+
10
+ log=LogStore.add_logger('dmu:generic:naming')
11
+ # --------------------------------
12
+ def clean_special_characters(name : str) -> str:
13
+ '''
14
+ Parameters
15
+ ----------------
16
+ name: String with potentially parenthesis, dollar signs, etc
17
+
18
+ Returns
19
+ ----------------
20
+ Cleaned string, where special signs were removed or replaced
21
+ '''
22
+ name = name.replace('||', 'or')
23
+ name = name.replace(' ' , '_')
24
+ name = name.replace('<' , 'lt')
25
+ name = name.replace('>' , 'gt')
26
+ name = name.replace('=' , 'eq')
27
+ name = name.replace('{' , '_')
28
+ name = name.replace('}' , '_')
29
+ name = name.replace('.' , 'p')
30
+ name = name.replace('$' , '_')
31
+ name = name.replace('&&','and')
32
+ name = re.sub(r'_+' , '_', name)
33
+
34
+ return name
35
+ # --------------------------------
@@ -290,14 +290,6 @@ class Plotter1D(Plotter):
290
290
  if 'vline' in var_cfg:
291
291
  line_cfg = var_cfg['vline']
292
292
  plt.axvline(**line_cfg)
293
-
294
- if 'style' in self._d_cfg and 'skip_lines' in self._d_cfg['style'] and self._d_cfg['style']['skip_lines']:
295
- return
296
-
297
- if var in ['B_const_mass_M', 'B_M', 'B_Mass', 'B_Mass_smr']:
298
- plt.axvline(x=5280, color='r', label=r'$B^+$' , linestyle=':')
299
- elif var == 'Jpsi_M':
300
- plt.axvline(x=3096, color='r', label=r'$J/\psi$', linestyle=':')
301
293
  # --------------------------------------------
302
294
  def run(self):
303
295
  '''