ararpy 0.1.28__py3-none-any.whl → 0.1.29__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/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.29
4
4
  Summary: A project for Ar-Ar geochronology
5
5
  Home-page: https://github.com/wuyangchn/ararpy.git
6
6
  Author: Yang Wu
@@ -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.29.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
+ ararpy-0.1.29.dist-info/METADATA,sha256=4OPGl6KfTwxwSI6oU5gcILqUjMTrazzzhC-acKZ54MY,24516
64
+ ararpy-0.1.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
+ ararpy-0.1.29.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
+ ararpy-0.1.29.dist-info/RECORD,,