datastock 0.0.39__py3-none-any.whl → 0.0.40__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.
datastock/_class1.py CHANGED
@@ -617,6 +617,9 @@ class DataStock1(DataStock0):
617
617
  quant=None,
618
618
  name=None,
619
619
  units=None,
620
+ # exclude from search
621
+ key_exclude=None,
622
+ ref_exclude=None,
620
623
  # nearest-neighbour interpolation input
621
624
  values=None,
622
625
  indices=None,
@@ -666,6 +669,9 @@ class DataStock1(DataStock0):
666
669
  quant=quant,
667
670
  name=name,
668
671
  units=units,
672
+ # exclude from search
673
+ key_exclude=key_exclude,
674
+ ref_exclude=ref_exclude,
669
675
  # parameters
670
676
  values=values,
671
677
  indices=indices,
@@ -686,6 +692,9 @@ class DataStock1(DataStock0):
686
692
  # strategy for choosing common ref vector
687
693
  strategy=None,
688
694
  strategy_bounds=None,
695
+ # exclude from search
696
+ key_exclude=None,
697
+ ref_exclude=None,
689
698
  # values, indices
690
699
  values=None,
691
700
  indices=None,
@@ -719,6 +728,9 @@ class DataStock1(DataStock0):
719
728
  # strategy for choosing common ref vector
720
729
  strategy=strategy,
721
730
  strategy_bounds=strategy_bounds,
731
+ # exclude from search
732
+ key_exclude=key_exclude,
733
+ ref_exclude=ref_exclude,
722
734
  # parameters
723
735
  values=values,
724
736
  indices=indices,
@@ -1040,4 +1052,4 @@ class DataStock1(DataStock0):
1040
1052
 
1041
1053
  __all__ = [
1042
1054
  sorted([k0 for k0 in locals() if k0.startswith('DataStock')])[-1]
1043
- ]
1055
+ ]
@@ -904,7 +904,7 @@ def _check_ddata(
904
904
  v0.get('ref') is None
905
905
  or isinstance(v0.get('ref'), str)
906
906
  or (
907
- isinstance(v0.get('ref'), tuple)
907
+ isinstance(v0.get('ref'), (list, tuple))
908
908
  and all([
909
909
  isinstance(rr, str)
910
910
  for rr in v0['ref']
@@ -977,6 +977,8 @@ def _check_ddata(
977
977
  # find ref
978
978
  if isinstance(v0['ref'], str):
979
979
  ddata[k0]['ref'] = (v0['ref'],)
980
+ elif isinstance(v0['ref'], list):
981
+ ddata[k0]['ref'] = tuple(v0['ref'])
980
982
 
981
983
  _check_data_ref(
982
984
  k0=k0,
@@ -43,6 +43,9 @@ def get_ref_vector(
43
43
  quant=None,
44
44
  name=None,
45
45
  units=None,
46
+ # exclude from search
47
+ key_exclude=None,
48
+ ref_exclude=None,
46
49
  # parameters
47
50
  values=None,
48
51
  indices=None,
@@ -52,6 +55,7 @@ def get_ref_vector(
52
55
 
53
56
  # ----------------
54
57
  # check inputs
58
+ # ----------------
55
59
 
56
60
  # ind_strict
57
61
  ind_strict = _generic_check._check_var(
@@ -82,6 +86,27 @@ def get_ref_vector(
82
86
  allowed=lkok,
83
87
  )
84
88
 
89
+ # key_exclude
90
+ if key_exclude is not None:
91
+ if isinstance(key_exclude, str):
92
+ key_exclude = [key_exclude]
93
+ key_exclude = _generic_check._check_var_iter(
94
+ key_exclude, 'key_exclude',
95
+ types=(list, tuple),
96
+ types_iter=str,
97
+ )
98
+
99
+ # ref_exclude
100
+ if ref_exclude is not None:
101
+ if isinstance(ref_exclude, str):
102
+ ref_exclude = [ref_exclude]
103
+ ref_exclude = _generic_check._check_var_iter(
104
+ ref_exclude, 'ref_exclude',
105
+ types=(list, tuple),
106
+ types_iter=str,
107
+ )
108
+
109
+ # key0 vs ref
85
110
  if key0 is None and ref is None:
86
111
  msg = "Please provide key0 or ref at least!"
87
112
  raise Exception(msg)
@@ -95,6 +120,7 @@ def get_ref_vector(
95
120
 
96
121
  # ------------------------
97
122
  # hasref, hasvect
123
+ # ------------------------
98
124
 
99
125
  hasref = None
100
126
  if ref is not None and key0 is not None:
@@ -109,8 +135,13 @@ def get_ref_vector(
109
135
  elif key0 is not None:
110
136
  refok = ddata[key0]['ref']
111
137
 
138
+ # ----------------------
112
139
  # identify possible vect
140
+ # ----------------------
141
+
113
142
  if hasref is not False:
143
+
144
+
114
145
  lp = [('dim', dim), ('quant', quant), ('name', name), ('units', units)]
115
146
  lk_vect = [
116
147
  k0 for k0, v0 in ddata.items()
@@ -121,6 +152,8 @@ def get_ref_vector(
121
152
  or (vv is not None and v0[ss] == vv)
122
153
  for ss, vv in lp
123
154
  ])
155
+ and (key_exclude is None or k0 not in key_exclude)
156
+ and (ref_exclude is None or v0['ref'][0] not in ref_exclude)
124
157
  ]
125
158
 
126
159
  # if key is provided
@@ -134,7 +167,7 @@ def get_ref_vector(
134
167
  # cases
135
168
  if len(lk_vect) == 0:
136
169
  if warn is True:
137
- msg = "No matching vector found!"
170
+ msg = f"No vector found for key0 = '{key0}', ref '{ref}'!"
138
171
  warnings.warn(msg)
139
172
  hasvect = False
140
173
 
@@ -148,27 +181,30 @@ def get_ref_vector(
148
181
  hasref = True
149
182
 
150
183
  else:
151
- if warn is True:
152
- msg = (
153
- f"Multiple possible vectors found:\n{lk_vect}\n"
154
- f"\t- key0: {key0}\n"
155
- f"\t- ref: {ref}\n"
156
- f"\t- hasref: {hasref}\n"
157
- f"\t- refok: {refok}\n"
158
- )
159
- warnings.warn(msg)
184
+ msg = (
185
+ f"Multiple possible vectors found:\n{lk_vect}\n"
186
+ f"\t- key0: {key0}\n"
187
+ f"\t- ref: {ref}\n"
188
+ f"\t- hasref: {hasref}\n"
189
+ f"\t- refok: {refok}\n"
190
+ )
191
+ warnings.warn(msg)
160
192
  hasvect = False
161
193
  else:
162
194
  hasvect = False
163
195
 
196
+ # -------------------------
164
197
  # set hasref if not yet set
198
+
165
199
  if hasvect is False:
166
200
  key_vector = None
167
201
  if hasref is None:
168
202
  hasref = False
169
203
  ref = None
170
204
 
205
+ # ----------------------
171
206
  # consistency check
207
+
172
208
  assert hasref == (ref is not None)
173
209
  assert hasvect == (key_vector is not None)
174
210
 
@@ -180,6 +216,7 @@ def get_ref_vector(
180
216
 
181
217
  # -----------------
182
218
  # values vs indices
219
+ # -----------------
183
220
 
184
221
  dind = _get_ref_vector_values(
185
222
  dref=dref,
@@ -193,7 +230,9 @@ def get_ref_vector(
193
230
  indices=indices,
194
231
  )
195
232
 
233
+ # -----
196
234
  # val
235
+
197
236
  if dind is None:
198
237
  if key_vector is not None:
199
238
  val = ddata[key_vector]['data']
@@ -457,6 +496,9 @@ def get_ref_vector_common(
457
496
  quant=None,
458
497
  name=None,
459
498
  units=None,
499
+ # exclude from search
500
+ key_exclude=None,
501
+ ref_exclude=None,
460
502
  # strategy for choosing common ref vector
461
503
  strategy=None,
462
504
  strategy_bounds=None,
@@ -522,6 +564,10 @@ def get_ref_vector_common(
522
564
  quant=quant,
523
565
  name=name,
524
566
  units=units,
567
+ # exclude from search
568
+ key_exclude=key_exclude,
569
+ ref_exclude=ref_exclude,
570
+ # parameters
525
571
  values=None,
526
572
  indices=None,
527
573
  )
@@ -699,6 +745,9 @@ def get_ref_vector_common(
699
745
  dkeys=dkeys,
700
746
  key_vector=key_vector,
701
747
  val=val,
748
+ # exclude from search
749
+ key_exclude=key_exclude,
750
+ ref_exclude=ref_exclude,
702
751
  # values, indices
703
752
  values=values,
704
753
  indices=indices,
@@ -727,6 +776,9 @@ def _get_ref_vector_common_values(
727
776
  dkeys=None,
728
777
  key_vector=None,
729
778
  val=None,
779
+ # exclude from search
780
+ key_exclude=None,
781
+ ref_exclude=None,
730
782
  # values, indices
731
783
  values=None,
732
784
  indices=None,
@@ -755,6 +807,10 @@ def _get_ref_vector_common_values(
755
807
  quant=quant,
756
808
  name=name,
757
809
  units=units,
810
+ # exclude from search
811
+ key_exclude=key_exclude,
812
+ ref_exclude=ref_exclude,
813
+ # parameters
758
814
  values=values,
759
815
  indices=indices,
760
816
  )
datastock/_class2.py CHANGED
@@ -87,12 +87,18 @@ class DataStock2(DataStock1):
87
87
 
88
88
  if isinstance(dtype, str):
89
89
  dtype = [dtype]
90
+ lok = [
91
+ 'xdata', 'ydata',
92
+ 'data', 'data.T',
93
+ 'xy', 'alpha',
94
+ 'txt', 'x', 'y', 'position',
95
+ ]
90
96
  dtype = _generic_check._check_var_iter(
91
97
  dtype,
92
98
  'dtype',
93
99
  types=(list, tuple),
94
100
  types_iter=str,
95
- allowed=['xdata', 'ydata', 'data', 'data.T', 'xy', 'alpha', 'txt']
101
+ allowed=lok,
96
102
  )
97
103
  if len(dtype) != nref:
98
104
  msg = (
@@ -479,6 +479,15 @@ def get_fupdate(handle=None, dtype=None, norm=None, bstr=None):
479
479
  handle.set_alpha(norm(val))
480
480
  elif dtype == 'txt':
481
481
  func = lambda val, handle=handle, bstr=bstr: handle.set_text(bstr.format(val))
482
+ elif dtype == 'x':
483
+ def func(val, handle=handle):
484
+ handle.set_x(val)
485
+ elif dtype == 'y':
486
+ def func(val, handle=handle):
487
+ handle.set_y(val)
488
+ elif dtype == 'position':
489
+ def func(val, handle=handle):
490
+ handle.set_position(val)
482
491
  else:
483
492
  msg = f'Unknown mobile dtype: {dtype}'
484
493
  raise Exception(msg)
@@ -579,4 +588,4 @@ def _update_mobile(k0=None, dmobile=None, dref=None, ddata=None):
579
588
  # ddata[dmobile[k0]['data'][ii]]['data'][
580
589
  # dmobile[k0]['func_slice'][ii](iref[ii])
581
590
  # ]
582
- # )
591
+ # )
datastock/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # Do not edit, pipeline versioning governed by git tags!
2
- __version__ = '0.0.39'
2
+ __version__ = '0.0.40'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datastock
3
- Version: 0.0.39
3
+ Version: 0.0.40
4
4
  Summary: A python library for generic class and data handling
5
5
  Home-page: https://github.com/ToFuProject/datastock
6
6
  Author: Didier VEZINET
@@ -23,12 +23,12 @@ Requires-Dist: scipy
23
23
  Requires-Dist: matplotlib
24
24
  Requires-Dist: astropy
25
25
  Provides-Extra: dev
26
- Requires-Dist: check-manifest ; extra == 'dev'
27
- Requires-Dist: coverage ; extra == 'dev'
28
- Requires-Dist: pytest ; extra == 'dev'
29
- Requires-Dist: sphinx ; extra == 'dev'
30
- Requires-Dist: sphinx-gallery ; extra == 'dev'
31
- Requires-Dist: sphinx-bootstrap-theme ; extra == 'dev'
26
+ Requires-Dist: check-manifest; extra == "dev"
27
+ Requires-Dist: coverage; extra == "dev"
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: sphinx; extra == "dev"
30
+ Requires-Dist: sphinx-gallery; extra == "dev"
31
+ Requires-Dist: sphinx-bootstrap-theme; extra == "dev"
32
32
 
33
33
  [![Conda]( https://anaconda.org/conda-forge/datastock/badges/version.svg)](https://anaconda.org/conda-forge/datastock)
34
34
  [![](https://anaconda.org/conda-forge/datastock/badges/downloads.svg)](https://anaconda.org/conda-forge/datastock)
@@ -3,16 +3,16 @@ datastock/_DataCollection_utils.py,sha256=hHf6HvGKMmM-psx3fj9QcY1TEmKrAtTdkRokH7
3
3
  datastock/__init__.py,sha256=i_Ijl-AM07n4zN52frWfbeGN1iB6v4e5oLzTuVIh_oM,217
4
4
  datastock/_class.py,sha256=Az9PS3aSskiPMb1ekt78Y2ynBujYVc_cDjJxW9xH9g4,47
5
5
  datastock/_class0.py,sha256=QULjNJke13jJrGLIeM7SWHZVziorDK_KCIlqq8LgS9U,5883
6
- datastock/_class1.py,sha256=0IDelA1ZXRJ7xAPWHnQUi9Hu-q8HOaDMN2SCKOm13ro,28347
6
+ datastock/_class1.py,sha256=8R4zM6p7b62FJuoI7Gyik4_tRCUFi6aF4oaMimiOoFE,28726
7
7
  datastock/_class1_binning.py,sha256=LWHv2LIfgZfSFWYwqdcN0DKpNe6q7Go3sxfcJqmzTrI,28085
8
- datastock/_class1_check.py,sha256=0oWF07MOo2c_G7219H7Dz-gRjBiTDDqbZ5loq9mC8ko,50574
8
+ datastock/_class1_check.py,sha256=0PikkAZjlU0L59i8iue3ihK1t_uN-9oGh9Xe060QvWo,50672
9
9
  datastock/_class1_compute.py,sha256=yHdG0afYc_YtjpR6RvMh7SeRtWEyuHZ5y9VOPRIYVDo,31671
10
10
  datastock/_class1_domain.py,sha256=bkuCl29QO7C3RchC8qZyreU90QxmdDYNVYDmzuCLCUY,6252
11
11
  datastock/_class1_interpolate.py,sha256=3LRKK6aOepJLSnRoRpsS8RAnobqTdE-QZrkdQrnIaqc,37825
12
12
  datastock/_class1_show.py,sha256=hqd-FeJ1NqiOzbrHzGMrwIo8_lLsjC199Zmw68NqkDQ,11745
13
- datastock/_class1_uniformize.py,sha256=NtriKnQAMhzdEAc766rgYWouz4GFEG1MVAVhu9VcaOk,26918
14
- datastock/_class2.py,sha256=ag8bfEtAF1G_ET4ufpWh8uM609cVUUfhAO6L8L7hc14,45322
15
- datastock/_class2_interactivity.py,sha256=YdM4cEjDrgh-bSsOzkkwtu-pqKoeqhSyfiZl2Udkl3E,16632
13
+ datastock/_class1_uniformize.py,sha256=dEJime_0SqmW8hX8ooZpHsPI_d8CIE9U9Yz9GhqsEUY,28433
14
+ datastock/_class2.py,sha256=FG-ZGPVdZEdkRc_3Z9LRzYdRm9Xat7HI06E3-hI5rCk,45422
15
+ datastock/_class2_interactivity.py,sha256=b7ORi0wR-gcFIua10PhbKTEB12vJN1F4skuIJX0gnbw,16918
16
16
  datastock/_class3.py,sha256=CH1oD_lTfVlcDp29L_iwzSfP78vX6_edDmZG9aSb1Ks,10848
17
17
  datastock/_direct_calls.py,sha256=EHFwI2mGMDqGz8_Bv2BseMBX4J8dSdE_RcNX3pt0ZYY,1801
18
18
  datastock/_export_dataframe.py,sha256=fy-uJR3EhDlHvd9ls1EQna_C8fyha1jCJLu1DTKTkdo,1576
@@ -31,12 +31,12 @@ datastock/_plot_correlations.py,sha256=ITOypu_AEoKl0ihxocV-JVTXIHqut6p9TfG-xZmQy
31
31
  datastock/_plot_old_backup.py,sha256=XixTi2CiihKjtQP0TRycH0b25caWN1m35DgpsDeiWZE,21729
32
32
  datastock/_plot_text.py,sha256=wQPqjfpLyIioS2JeOt3E9C9HgYUJ49YEoOgRuKYvAR8,3143
33
33
  datastock/_saveload.py,sha256=NdOykvmeCaPhpk0EF5WQezYzpuZM2Ul101Nqc4I3dnY,11729
34
- datastock/version.py,sha256=Bb6NW7Kw8uEjYqVT0BzNF9HwbmuDI1NDZNdzzrPAbbU,80
34
+ datastock/version.py,sha256=A38lpxv8KL6cnTASv1MoiCv6r7-tiQedYIq6p93AnrA,80
35
35
  datastock/tests/__init__.py,sha256=teOo2xP0IO7PQMuMDmum61XVHe2TuxW3BiHiL73X8jQ,35
36
36
  datastock/tests/test_01_DataStock.py,sha256=QJSmrVXD6wX-plfrFdLyZou20IYZGAKzartSi84BfC0,16982
37
37
  datastock/tests/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- datastock-0.0.39.dist-info/LICENSE,sha256=V1uXqi3vxR0QhB4QdFyjkynl6jpN4wZmlB5EMYJk0NM,1068
39
- datastock-0.0.39.dist-info/METADATA,sha256=az228ShtdPfti88S7_DpvjMCUMKVqmmCKsiY6HEB7uw,8666
40
- datastock-0.0.39.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
41
- datastock-0.0.39.dist-info/top_level.txt,sha256=BzJsLLK_zZw13WQCoMhC74qWVKalnVCjBxdPXvJn7HQ,25
42
- datastock-0.0.39.dist-info/RECORD,,
38
+ datastock-0.0.40.dist-info/LICENSE,sha256=V1uXqi3vxR0QhB4QdFyjkynl6jpN4wZmlB5EMYJk0NM,1068
39
+ datastock-0.0.40.dist-info/METADATA,sha256=3RtX-DeKoRjaxewU2stlRCb8oF5zuMqiI1BArp0HyII,8660
40
+ datastock-0.0.40.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
41
+ datastock-0.0.40.dist-info/top_level.txt,sha256=BzJsLLK_zZw13WQCoMhC74qWVKalnVCjBxdPXvJn7HQ,25
42
+ datastock-0.0.40.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.1)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5