ararpy 0.1.21__py3-none-any.whl → 0.1.24__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/__init__.py CHANGED
@@ -16,7 +16,7 @@ from . import calc, smp, files, thermo, test
16
16
  """ Information """
17
17
 
18
18
  name = 'ararpy'
19
- version = '0.1.21'
19
+ version = '0.1.24'
20
20
  __version__ = version
21
21
  full_version = version
22
22
  last_update = '2024-03-28'
ararpy/calc/corr.py CHANGED
@@ -61,10 +61,10 @@ def mdf(rm: float, srm: float, m1: float, m2: float, ra: float = 298.56,
61
61
  sratio_m = err.div((m2, sm2), (m1, sm1))
62
62
  useRyu = False
63
63
  if not useRyu:
64
- # line
65
- k1 = (ra / rm + delta_m - 1) / delta_m
66
- k2 = err.div(((ra / rm + delta_m - 1), err.div((ra, sra), (rm, srm))), (delta_m, sdelta_m))
67
- # exp
64
+ # line, D = 1 + (ra / rm - 1) / dm # Renne2009
65
+ k1 = 1 + (ra / rm - 1) / delta_m
66
+ k2 = err.div(((ra / rm - 1), err.div((ra, sra), (rm, srm))), (delta_m, sdelta_m))
67
+ # exp, D = 1 + ln(ra / rm) / (m1 * ln(m2/m1)) # Renne2009
68
68
  try:
69
69
  k3 = (np.log(ra / rm) / np.log(ratio_m)) * (1 / m1) + 1
70
70
  v1 = err.log((ra / rm, err.div((ra, sra), (rm, srm))))
@@ -73,7 +73,7 @@ def mdf(rm: float, srm: float, m1: float, m2: float, ra: float = 298.56,
73
73
  k4 = err.div((np.log(ra / rm) / np.log(ratio_m), v3), (m1, sm1))
74
74
  except Exception:
75
75
  k3, k4 = 0, 0
76
- # pow
76
+ # pow, D = pow(ra / rm, 1 / dm) # Renne2009
77
77
  try:
78
78
  k5 = pow((ra / rm), (1 / delta_m)) # Renne2009, B.D. Turrin2010
79
79
  k6 = err.pow((ra / rm, err.div((ra, sra), (rm, srm))),
@@ -105,18 +105,17 @@ def discr(a0: list, e0: list, mdf: list, smdf: list, m: list, m40: list,
105
105
  if isRelative:
106
106
  smdf = [smdf[i] * mdf[i] / 100 for i in range(len(smdf))]
107
107
  for i in range(min([len(arg) for arg in [a0, e0, mdf, smdf]])):
108
- delta_mass = abs(m40[i] - m[i])
109
- ratio_mass = abs(m40[i] / m[i]) if m[i] != 0 else 1
110
- if method.lower().startswith("l"):
111
- k0 = 1 / (delta_mass * mdf[i] - delta_mass + 1) if (delta_mass * mdf[i] - delta_mass + 1) != 0 else 0
112
- k1 = err.div((1, 0), (delta_mass * mdf[i] - delta_mass + 1, smdf[i] * delta_mass))
113
- elif method.lower().startswith("e"):
114
- k0 = 1 / (ratio_mass ** (mdf[i] * m40[i] - m[i]))
115
- k1 = err.div((1, 0), (ratio_mass ** (mdf[i] * m40[i] - m[i]), err.pow((ratio_mass, 0), (
116
- mdf[i] * m40[i] - m[i], err.mul((mdf[i], smdf[i]), (m40[i], 0))))))
117
- elif method.lower().startswith("p"):
118
- k0 = 1 / (mdf[i] ** delta_mass)
119
- k1 = err.div((1, 0), (mdf[i] ** delta_mass, err.pow((mdf[i], smdf[i]), (delta_mass, 0))))
108
+ delta_m = abs(m40[i] - m[i])
109
+ ratio_m = abs(m40[i] / m[i]) if m[i] != 0 else 1
110
+ if method.lower().startswith("l"): # linear
111
+ k0 = 1 / (delta_m * mdf[i] - delta_m + 1) if (delta_m * mdf[i] - delta_m + 1) != 0 else 0
112
+ k1 = err.rec((delta_m * mdf[i] - delta_m + 1, smdf[i] * delta_m))
113
+ elif method.lower().startswith("e"): # exponential
114
+ k0 = 1 / np.exp((mdf - 1) * m * np.log(m40 / m))
115
+ k1 = err.rec((1 / k0, err.pow((np.e, 0), ((mdf - 1) * m * np.log(m40 / m), err.mul((mdf - 1, smdf), (m * np.log(m40 / m), 0))))))
116
+ elif method.lower().startswith("p"): # power
117
+ k0 = 1 / (mdf[i] ** delta_m)
118
+ k1 = err.rec((mdf[i] ** delta_m, err.pow((mdf[i], smdf[i]), (delta_m, 0))))
120
119
  else:
121
120
  k0 = 1
122
121
  k1 = 0
ararpy/files/raw_file.py CHANGED
@@ -224,24 +224,23 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
224
224
 
225
225
  timezone = sample_info_index[3] if sample_info_index[3] != "" else "utc"
226
226
  while True: # measurment steps sloop
227
+
228
+ # all text information
229
+ options = get_sample_info(file_contents, optional_info_index, default="", base=[1, 1 - idx, 1])
230
+
227
231
  # Zero datetime
228
232
  try:
229
233
  if check_box_index[2]: # input_filter[134]: date in one string
230
- zero_date = datetime_parse(
231
- get_item(file_contents, sample_info_index[16:19], base=[1, 1 - idx, 1]), sample_info_index[1])
234
+ zero_date = datetime_parse(options.get('ZeroYear'), sample_info_index[1])
232
235
  else:
233
- zero_date = datetime(year=get_item(file_contents, sample_info_index[16:19], base=1),
234
- month=get_item(file_contents, sample_info_index[22:25], base=[1, 1 - idx, 1]),
235
- day=get_item(file_contents, sample_info_index[28:31], base=[1, 1 - idx, 1]))
236
+ zero_date = datetime(year=options.get('ZeroYear'), month=options.get('ZeroMon'),
237
+ day=options.get('ZeroDay'))
236
238
 
237
239
  if check_box_index[3]: # input_filter[135]: time in one string
238
- zero_time = datetime_parse(
239
- get_item(file_contents, sample_info_index[19:22], base=[1, 1 - idx, 1]), sample_info_index[2])
240
+ zero_time = datetime_parse(options.get('ZeroHour'), sample_info_index[2])
240
241
  else:
241
- zero_time = datetime(year=2020, month=12, day=31,
242
- hour=get_item(file_contents, sample_info_index[19:22], base=[1, 1 - idx, 1]),
243
- minute=get_item(file_contents, sample_info_index[25:28], base=[1, 1 - idx, 1]),
244
- second=get_item(file_contents, sample_info_index[31:34], base=[1, 1 - idx, 1]))
242
+ zero_time = datetime(year=2020, month=12, day=31, hour=options.get('ZeroHour'),
243
+ minute=options.get('ZeroMin'), second=options.get('ZeroSec'))
245
244
 
246
245
  zero_datetime = datetime(
247
246
  zero_date.year, zero_date.month, zero_date.day, zero_time.hour, zero_time.minute, zero_time.second)
@@ -251,16 +250,10 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
251
250
  # print(f"Cannot parse zero datetime")
252
251
  zero_datetime = datetime(1970, 1, 1, 0, 0, 0).isoformat(timespec='seconds')
253
252
 
254
- # Experiment name
255
- try:
256
- experiment_name = get_item(file_contents, sample_info_index[4:7], default="", base=[1, 1 - idx, 1])
257
- except (TypeError, ValueError, IndexError):
258
- # print(f"Cannot parse experiment name")
259
- experiment_name = "ExpName"
260
-
261
253
  # Step name
262
254
  try:
263
- step_name = get_item(file_contents, sample_info_index[7:10], default="", base=[1, 1 - idx, 1]) if input_filter[7] > 0 else ""
255
+ step_name = options.get('StepName')
256
+ experiment_name = options.get('ExpName')
264
257
  if check_box_index[1] and sample_info_index[0].strip() != "":
265
258
  _res = string_parser(sample_info_index[0], file_name)
266
259
  if _res is not None:
@@ -274,12 +267,13 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
274
267
  raise ValueError(f"Step name not found")
275
268
  except (TypeError, ValueError, IndexError):
276
269
  # When parsing the step name fails, the end of the file has been reached
277
- raise
278
-
279
- # other information
280
- options = get_sample_info(file_contents, optional_info_index, default="", base=[1, 1 - idx, 1])
270
+ # raise
271
+ break
272
+ else:
273
+ options.update({'StepName': step_name})
274
+ options.update({'ExpName': experiment_name})
281
275
 
282
- current_step = [[step_name, zero_datetime, experiment_name, options]]
276
+ current_step = [[step_name, zero_datetime, options]]
283
277
 
284
278
  break_num = 0
285
279
  cycle_num = 0
@@ -370,7 +364,7 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
370
364
  sample_info.update({
371
365
  "ExpName": get_item(file_contents, index_list[0:3], default=default, base=base),
372
366
  "StepName": get_item(file_contents, index_list[3:6], default=default, base=base),
373
- "SmpType": get_item(file_contents, index_list[6:9], default=default, base=base),
367
+ "StepType": get_item(file_contents, index_list[6:9], default=default, base=base),
374
368
  "StepLabel": get_item(file_contents, index_list[9:12], default=default, base=base),
375
369
  "ZeroYear": get_item(file_contents, index_list[12:15], default=default, base=base), # year
376
370
  "ZeroHour": get_item(file_contents, index_list[15:18], default=default, base=base), # hour
@@ -402,7 +396,7 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
402
396
  "StdAgeSig": get_item(file_contents, index_list[93:96], default=default, base=base),
403
397
  # "Experiment Name": get_item(file_contents, sample_info_index[0:3], default=default, base=base),
404
398
  # "Step Name": get_item(file_contents, sample_info_index[3:6], default=default, base=base),
405
- # "Sample Type": get_item(file_contents, sample_info_index[6:9], default=default, base=base),
399
+ # "Step Type": get_item(file_contents, sample_info_index[6:9], default=default, base=base),
406
400
  # "Step Label": get_item(file_contents, sample_info_index[9:12], default=default, base=base),
407
401
  # "Zero Date Year": get_item(file_contents, sample_info_index[12:15], default=default, base=base),
408
402
  # "Zero Time Hour": get_item(file_contents, sample_info_index[15:18], default=default, base=base),
ararpy/smp/sample.py CHANGED
@@ -1110,27 +1110,33 @@ class Plot:
1110
1110
 
1111
1111
  class Sequence:
1112
1112
  def __init__(self, index=None, data=None, flag=None, name=None, datetime=None,
1113
- type_str=None, results=None, coefficients=None, fitting_method=None,
1113
+ type_str=None, label=None, results=None, coefficients=None, fitting_method=None,
1114
1114
  is_estimated=False, options=None, **kwargs):
1115
1115
  if options is None:
1116
1116
  options = {}
1117
- self.index = index
1118
1117
  if name is None or not isinstance(name, str):
1119
- name = ""
1120
- self.name = name.strip()
1121
- self.datetime = datetime
1122
- self.data = data
1118
+ name = options.get('StepName', "")
1123
1119
  # flag is to check if the data point is selected
1124
1120
  if flag is None and data is not None:
1125
1121
  flag = [[j if i == 0 else True for i, j in enumerate(_m)] for _m in data]
1126
- self.flag = flag
1127
- self.type_str = type_str
1122
+ if type_str is None:
1123
+ type_str = options.get('StepType', "Unknown")
1124
+ if label is None:
1125
+ label = options.get('StepLabel', "")
1128
1126
  if results is None:
1129
1127
  results = []
1130
1128
  if fitting_method is None:
1131
1129
  fitting_method = []
1132
1130
  if coefficients is None:
1133
1131
  coefficients = []
1132
+
1133
+ self.index = index
1134
+ self.datetime = datetime
1135
+ self.data = data
1136
+ self.name = name.strip()
1137
+ self.flag = flag
1138
+ self.type_str = type_str.strip()
1139
+ self.label = str(label).strip()
1134
1140
  self.results = results
1135
1141
  self.coefficients = coefficients
1136
1142
  self.fitting_method = fitting_method
@@ -1211,9 +1217,8 @@ class RawData:
1211
1217
  name=item[0][0] if isinstance(item[0][0], str) and item[0][0] != '' else f"{self.name}-{index + 1:02d}",
1212
1218
  data=item[1:],
1213
1219
  datetime=item[0][1],
1214
- type_str=item[0][2],
1215
1220
  fitting_method=[*kwargs.get("fitting_method", [0] * 5)],
1216
- options=item[0][3]
1221
+ options=item[0][2]
1217
1222
  ) for index, item in enumerate(data)]
1218
1223
  else:
1219
1224
  self.sequence: List[Sequence] = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ararpy
3
- Version: 0.1.21
3
+ Version: 0.1.24
4
4
  Summary: A project for Ar-Ar geochronology
5
5
  Home-page: https://github.com/wuyangchn/ararpy.git
6
6
  Author: Yang Wu
@@ -1,10 +1,10 @@
1
- ararpy/__init__.py,sha256=WlCsGj-l5qvzTG5kZM0QFGPSwLZlYoeBv9yftCZZj40,6857
1
+ ararpy/__init__.py,sha256=QEp5L28BpSsG8M5Od5bV8kEffBsktW19SvENTbtQ_v4,6857
2
2
  ararpy/test.py,sha256=4F46-JJ1Ge12HGae0qO44Qc6kiEMHBgn2MsY_5LlHDo,3973
3
3
  ararpy/calc/__init__.py,sha256=kUjRuLE8TLuKOv3i976RnGJoEMj23QBZDu37LWs81U4,322
4
4
  ararpy/calc/age.py,sha256=WOZs70zXiBWDIEhXJLIaNiYTOFJNk0NDbH5e5zCbCks,5435
5
5
  ararpy/calc/arr.py,sha256=jD1Fd0Cj3xc7NqgnG4cp3VWQWxUlV0qCtPBZZokDG8o,15246
6
6
  ararpy/calc/basic.py,sha256=uJCCUFaPd9zvfkggrdbFYSGLl2pt7UJ7ENgXanzHy68,4036
7
- ararpy/calc/corr.py,sha256=6hlBlFIM8HyN6CDuWPGqiLpVM88pZJLEuRm8vAyg9ng,18747
7
+ ararpy/calc/corr.py,sha256=QDitvLf6y5IBpHtVEJfOUVjWSlIP9qJ4Jhluk9eDEDE,18801
8
8
  ararpy/calc/err.py,sha256=63LtprqjemlIb1QGDst4Ggcv5KMSDHdlAIL-nyQs1eA,2691
9
9
  ararpy/calc/histogram.py,sha256=0GVbDdsjd91KQ1sa2B7NtZ4KGo0XpRIJapgIrzAwQUo,5777
10
10
  ararpy/calc/isochron.py,sha256=ej9G2e68k6yszonWHsLcEubh3TA7eh1upTJP_X0ttAA,5726
@@ -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=nqv_VfbOzz8ejcnjNoHJafGiYldhYSOLusUGtuZ8jR0,28207
39
39
  ararpy/files/new_file.py,sha256=efblARIBROVLWS2w3-98BxLX5VZ8grRpiTkJFtf_rAk,214
40
- ararpy/files/raw_file.py,sha256=5hnZMS7r78lA0ZXrBEN5SWVurQyl0QsHOI9rJz5BQv8,22302
40
+ ararpy/files/raw_file.py,sha256=FScTqZzMPinNSCew86ETyDEcTjhbV-FQ3o4mWrbiBbU,21564
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
@@ -52,15 +52,15 @@ ararpy/smp/initial.py,sha256=VSNku2fYD1xGkpHxMqnSJCAhSQawfsDCdqYCxtDJryQ,17196
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=dEgy2--RxfS4vXYqlBjD5MlLpw2SaZPDyPxRyiQXjgU,57736
55
+ ararpy/smp/sample.py,sha256=N0ChOxMgNYLU_EwJvGXJARWnubsaKXmvS7jmM-uW7mg,57948
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.21.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
- ararpy-0.1.21.dist-info/METADATA,sha256=L-HbEUtFqNu8W2jo_CXlH1wIM9TikBrhyVZpedtLmIM,24516
64
- ararpy-0.1.21.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
65
- ararpy-0.1.21.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
- ararpy-0.1.21.dist-info/RECORD,,
62
+ ararpy-0.1.24.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
+ ararpy-0.1.24.dist-info/METADATA,sha256=ugp-dLJNZMSuugSyvAvFUrki9T4VUfys5Cv9lpz8DIM,24516
64
+ ararpy-0.1.24.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
65
+ ararpy-0.1.24.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
+ ararpy-0.1.24.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5