ararpy 0.1.28__py3-none-any.whl → 0.1.30__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.
ararpy/calc/raw_funcs.py CHANGED
@@ -29,6 +29,9 @@ def get_raw_data_regression_results(points_data, unselected: list = None):
29
29
  -------
30
30
 
31
31
  """
32
+ def power(a0, a1):
33
+ # return regression.power(a0, a1)
34
+ raise ValueError("Deprecated regression")
32
35
  # if unselected is None:
33
36
  # unselected = []
34
37
  # linesData = []
@@ -36,7 +39,7 @@ def get_raw_data_regression_results(points_data, unselected: list = None):
36
39
  # un_x = transpose(unselected)[0] if is_twoD(unselected) else []
37
40
  reg_handler = [
38
41
  regression.linest, regression.quadratic, regression.exponential,
39
- regression.power, regression.average]
42
+ power, regression.average]
40
43
  # size = 50
41
44
  # lines_x = [(max(x + un_x) - 0) / size * i for i in range(size + 1)]
42
45
  for i in range(len(reg_handler)):
ararpy/files/raw_file.py CHANGED
@@ -22,6 +22,7 @@ from parse import parse as string_parser
22
22
  import dateutil.parser as datetime_parser
23
23
  from ..calc.arr import get_item
24
24
  from ..calc.basic import utc_dt
25
+ from ..smp.sample import RawData
25
26
 
26
27
  """ Open raw data file """
27
28
 
@@ -211,8 +212,28 @@ def open_raw_xls(file_path, input_filter: List[Union[str, int]]):
211
212
 
212
213
 
213
214
  def open_raw_seq(file_path, input_filter=None):
215
+
216
+ class RenameUnpickler(pickle.Unpickler):
217
+ def find_class(self, module: str, name: str):
218
+ MODULE = RawData().__module__
219
+ renamed_module = module
220
+ if '.sample' in module and module != MODULE:
221
+ renamed_module = MODULE
222
+ try:
223
+ return super(RenameUnpickler, self).find_class(renamed_module, name)
224
+ except AttributeError:
225
+ return super(RenameUnpickler, self).find_class(renamed_module, 'ArArBasic')
226
+
227
+ def renamed_load(file_obj):
228
+ return RenameUnpickler(file_obj).load()
229
+
214
230
  with open(file_path, 'rb') as f:
215
- sequences = pickle.load(f)
231
+ sequences = renamed_load(f)
232
+
233
+ # with open(file_path, 'rb') as f:
234
+ # sequences = pickle.load(f)
235
+ # print(sequences[0].__module__)
236
+
216
237
  name_list = []
217
238
  for seq in sequences:
218
239
  while seq.name in name_list:
ararpy/smp/export.py CHANGED
@@ -1228,20 +1228,36 @@ class WritingWorkbook:
1228
1228
 
1229
1229
  def write_sht_table(self, sht_name, prop_name, sht_type, row, col, _, smp_attr_name, header_name, style, xls, sigma=1):
1230
1230
  sht = xls.add_worksheet(sht_name)
1231
+ num_step = len(self.sample.SequenceName)
1231
1232
  data = arr.transpose(getattr(self.sample, smp_attr_name, None).data)
1232
1233
  sht.hide_gridlines(2) # 0 = show grids, 1 = hide print grid, else = hide print and screen grids
1233
1234
  sht.hide() # default hidden table sheet
1234
1235
  sht.set_column(0, len(data), width=12) # column width
1235
1236
  header = getattr(sample, header_name)
1236
1237
  header = list(map(lambda each: each if "σ" not in each else each.replace('1', str(sigma)) if str(sigma) not in each else each.replace('2', str(sigma)), header))
1237
- sht.write_row(row=row - 1, col=col, data=header, cell_format=style)
1238
- for index, col_data in enumerate(data):
1239
- if "σ" in header[col]:
1240
- col_data = list(map(lambda each: each * sigma, col_data))
1241
- res = sht.write_column(row=row, col=col, data=col_data, cell_format=style)
1242
- if res:
1243
- raise ValueError(res)
1244
- col += 1
1238
+
1239
+ content = [
1240
+ [(0, 0), f"{sht_name}", {'bold': 1, 'top': 1, 'align': 'left'}],
1241
+ *[[(1, col, 2, col), each, {'bold': 1, 'top': 1, 'bottom': 6}] for col, each in enumerate(header)],
1242
+ *[[(3, col, 1), each if "σ" not in header[col] else list(map(lambda _: _ * sigma, each)), {}] for col, each in enumerate(data)],
1243
+ [(3 + num_step, 0, 0), [''] * len(data), {'bold': 1, 'top': 1}],
1244
+ ]
1245
+
1246
+ for pos, value, _prop in content:
1247
+ prop = self.default_fmt_prop.copy()
1248
+ prop.update(_prop)
1249
+ fmt = Format(prop, xls.xf_format_indices, xls.dxf_format_indices)
1250
+ xls.formats.append(fmt)
1251
+ if isinstance(value, (list, np.ndarray)) and len(pos) == 3:
1252
+ value = [None if isinstance(v, (float, int)) and np.isnan(v) else v for v in value]
1253
+ [sht.write_row, sht.write_column][pos[2]](*pos[:2], value, fmt)
1254
+ elif len(pos) == 2:
1255
+ isnumeric = isinstance(value, (float, int)) and not np.isnan(value) and not np.isinf(value)
1256
+ [sht.write_string, sht.write_number][isnumeric](*pos, value if isnumeric else str(value), fmt)
1257
+ elif len(pos) == 4:
1258
+ isnumeric = isinstance(value, (float, int)) and not np.isnan(value) and not np.isinf(value)
1259
+ sht.merge_range(*pos, value if isnumeric else str(value), fmt)
1260
+
1245
1261
 
1246
1262
  def write_sht_chart(self, sht_name, prop_name, sht_type, row, col, _, smp_attr_name, header_name, style, xls, start_row, total_rows):
1247
1263
  sht = xls.add_chartsheet(sht_name)
ararpy/smp/initial.py CHANGED
@@ -298,10 +298,28 @@ def check_version(smp: Sample):
298
298
  std = initial(Sample())
299
299
  basic.get_merged_smp(smp, std)
300
300
 
301
+ try:
302
+ version = int(smp.version)
303
+ except ValueError:
304
+ return smp
305
+
301
306
  # 20250328: # Experiment info
302
307
  smp.Info.experiment.name = smp.name()
303
308
  smp.Info.experiment.step_num = smp.sequence().size
304
309
 
310
+ # old version: add masses and gain factors
311
+ if version < 20240730:
312
+ gains = np.ones([10, smp.Info.experiment.step_num])
313
+ gains[[1, 3, 5, 7, 9], :] = 0
314
+ smp.TotalParam[126:136] = gains.tolist()
315
+ gains[0] = 35.96754628
316
+ gains[2] = 36.9667759
317
+ gains[4] = 37.9627322
318
+ gains[6] = 38.964313
319
+ gains[8] = 39.962383123
320
+ smp.TotalParam[71:81] = gains.tolist()
321
+ smp.version = "20240730"
322
+
305
323
  # 20250404: # Normalization for steps with different J values
306
324
  doNormalize = True
307
325
  v, sv = [], []
ararpy/smp/sample.py CHANGED
@@ -776,7 +776,7 @@ DEFAULT_PLOT_STYLES = lambda sample_type, age_unit: {
776
776
  },
777
777
  }
778
778
 
779
- VERSION = '20250404'
779
+ VERSION = '20250622'
780
780
 
781
781
  NAMED_DICT = {
782
782
  "unknown": {"header": SAMPLE_INTERCEPT_HEADERS.copy()},
@@ -884,12 +884,20 @@ class Sample:
884
884
  # self.__version = '20250301' # update sample info
885
885
  # self.__version = '20250321' # error sigma adjustment
886
886
  # self.__version = '20250328' # Experiment info
887
- self.__version = '20250404' # J normalization factor
887
+ # self.__version = '20250404' # J normalization factor
888
+ self.__version = '20250622' # version setter
888
889
 
889
890
  @property
890
891
  def version(self):
891
892
  return self.__version
892
893
 
894
+ @version.setter
895
+ def version(self, v):
896
+ if isinstance(v, (str, int)) and str(v).startswith("20"):
897
+ self.__version = str(v)
898
+ else:
899
+ raise ValueError("Version setter Error")
900
+
893
901
  def help(self) -> str: ...
894
902
 
895
903
  def name(self) -> str: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ararpy
3
- Version: 0.1.28
3
+ Version: 0.1.30
4
4
  Summary: A project for Ar-Ar geochronology
5
5
  Home-page: https://github.com/wuyangchn/ararpy.git
6
6
  Author: Yang Wu
@@ -10,7 +10,7 @@ ararpy/calc/histogram.py,sha256=0GVbDdsjd91KQ1sa2B7NtZ4KGo0XpRIJapgIrzAwQUo,5777
10
10
  ararpy/calc/isochron.py,sha256=ej9G2e68k6yszonWHsLcEubh3TA7eh1upTJP_X0ttAA,5726
11
11
  ararpy/calc/jvalue.py,sha256=OL5zPYU8Pac-wOxUWPCgu3onh2n01xDnhpi2mlUsjJM,1146
12
12
  ararpy/calc/plot.py,sha256=sUqjKBdAEjFarUoSCLqf8cbUM0rEAdZhmtyXB2K7LkA,2139
13
- ararpy/calc/raw_funcs.py,sha256=UC01lvA6GyZ5FJv43jgoUULAFoLnZJMxeSa0BeVFCAM,2637
13
+ ararpy/calc/raw_funcs.py,sha256=UPwXlYBwE1ugYRD9rsOs8JqJtm14FGcpWmUpUYJ4Roc,2744
14
14
  ararpy/calc/regression.py,sha256=mHUKobKx-Q9c7E49vPoQA2tA-MwO9BWvCp3VfnuUhUA,39776
15
15
  ararpy/calc/spectra.py,sha256=_Q23eP9necHlaCoHf3_UfW1N3JmVZj5rcWFro8GS-CA,1995
16
16
  ararpy/examples/022_VU124-M11a.ahd,sha256=3m0Gd-ZObou3KsnRNFMf77QwzT1Uz3nu3vA33Sqeyng,5414
@@ -37,7 +37,7 @@ ararpy/files/arr_file.py,sha256=KqksGlEA6nmMQofTgi7v45flscQZVtefxaNCKrV3Am4,837
37
37
  ararpy/files/basic.py,sha256=nc7Hgo_qLSkdmtKzZmd5SQ8Jy0dhW46ly4gh-oisUDs,2095
38
38
  ararpy/files/calc_file.py,sha256=wbt-cQhPnFJ32QyofXvjCPPehmWSj4CHnidkrP7dFgk,28694
39
39
  ararpy/files/new_file.py,sha256=efblARIBROVLWS2w3-98BxLX5VZ8grRpiTkJFtf_rAk,214
40
- ararpy/files/raw_file.py,sha256=PSJ0WwZHSIRrNDre69UwzpGevZQkI7utqhm9aKAm_Rs,20797
40
+ ararpy/files/raw_file.py,sha256=AUvx5Uh3aTQvGy7mXQ7771CeqFZ8u-KgdJvVOD-pU8k,21557
41
41
  ararpy/files/xls.py,sha256=DVcZ_yRnc19p-m4leGGjt-YPDpSa2udYKmGyrM0qub0,640
42
42
  ararpy/smp/EXPORT_TO_PDF_DATA_PROPERTIES.py,sha256=baDM437tu6hsPv0uYfod0TREXlPd6kvMBFT1S9ZZlkk,3024
43
43
  ararpy/smp/__init__.py,sha256=k6_fa27UJsQK7K7oC5GYlwMo6l0Xd8af3QtOrZz2XJk,478
@@ -46,21 +46,21 @@ ararpy/smp/calculation.py,sha256=LCFJWjLVLEKEQ5b7RFUIxsMahEzgLdodW4kCYXV5Z34,291
46
46
  ararpy/smp/consts.py,sha256=XIdjdz8cYxspG2jMnoItdlUsxr3hKbNFJjMZJh1bpzw,393
47
47
  ararpy/smp/corr.py,sha256=TzH7rymToJP0RCI0pQm-SrqnwAZ58HJbxahE8chv2wQ,26511
48
48
  ararpy/smp/diffusion_funcs.py,sha256=4-PMMIZWzjk2HOYYWNgSp4GmApygp1MmOxJ2g3xrqWc,175049
49
- ararpy/smp/export.py,sha256=hgbsbE70QoAyQSDZ2JJgOkltL6D9YMms_5MAuxAHq3U,116221
49
+ ararpy/smp/export.py,sha256=eBUGx9eUHQ7EoibT-PC1HK7Zw_V1LUfuKJv56_XccUQ,117284
50
50
  ararpy/smp/info.py,sha256=iKUELm-BuUduDlJKC1d8tKKNHbwwbNmhUg2pi6bcBvA,489
51
- ararpy/smp/initial.py,sha256=Wfjn9gyJyMSCRjPNIUhxDBw3b3_f-9Ui_iHAYkjFxWg,17332
51
+ ararpy/smp/initial.py,sha256=GFLEYxes-_PT_qgZj0Dagy_blg9JmzjO7uh3vQHbS78,17891
52
52
  ararpy/smp/json.py,sha256=BTZCjVN0aj9epc700nwkYEYMKN2lHBYo-pLmtnz5oHY,2300
53
53
  ararpy/smp/plots.py,sha256=rF0vrFu9dMt2Eu1EHiDfDRC9232M6dH0Unc_3qNDxLY,33579
54
54
  ararpy/smp/raw.py,sha256=51n-rrbW2FqeZHQyevuG7iObPLGvIBzTe414QDVM1FE,6523
55
- ararpy/smp/sample.py,sha256=N0ChOxMgNYLU_EwJvGXJARWnubsaKXmvS7jmM-uW7mg,57948
55
+ ararpy/smp/sample.py,sha256=slKiGUobEG7ZfJW6byBgc9jlWN1-zLg27iEdm-No5dw,58228
56
56
  ararpy/smp/style.py,sha256=wCygwtpCflhzwmI7u08X-feYGPytOyfR98YcgJx813c,7678
57
57
  ararpy/smp/table.py,sha256=9bNAOqAIOc0nSC3LNeqjJKUYSJSM28Ji3o9VimwMU8A,6645
58
58
  ararpy/thermo/__init__.py,sha256=6VBuqTRFl403PVqOuMkVrut0nKaQsAosBmfW91X1dMg,263
59
59
  ararpy/thermo/arrhenius.py,sha256=Ass1ichHfqIAtpv8eLlgrUc1UOb3Urh1qzr1E3gLB4U,233
60
60
  ararpy/thermo/atomic_level_random_walk.py,sha256=Q97zfe2h2RaxADkoBAqd0uEiP16BFOajrTmXHMkL2EQ,25502
61
61
  ararpy/thermo/basic.py,sha256=nBGHI9uK7VdJwThwBIOcKAzdnYqPyQseFoY6s4zKizk,11504
62
- ararpy-0.1.28.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
- ararpy-0.1.28.dist-info/METADATA,sha256=DWqHjjrlOGBYz0bastBt3JX2UIxLvCp5HmvAu-MELRE,24516
64
- ararpy-0.1.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
- ararpy-0.1.28.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
- ararpy-0.1.28.dist-info/RECORD,,
62
+ ararpy-0.1.30.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
+ ararpy-0.1.30.dist-info/METADATA,sha256=OkwCC5DEb-8Q_ZtpeNhcLuYsBvA6nzyVQ6ZMpRYjkko,24516
64
+ ararpy-0.1.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
+ ararpy-0.1.30.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
+ ararpy-0.1.30.dist-info/RECORD,,