ararpy 0.1.24__tar.gz → 0.1.26__tar.gz
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-0.1.24 → ararpy-0.1.26}/PKG-INFO +1 -1
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/__init__.py +2 -2
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/regression.py +28 -43
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/raw_file.py +134 -113
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy.egg-info/PKG-INFO +1 -1
- {ararpy-0.1.24 → ararpy-0.1.26}/setup.py +1 -1
- {ararpy-0.1.24 → ararpy-0.1.26}/LICENSE +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/README.md +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/__init__.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/age.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/arr.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/basic.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/corr.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/err.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/histogram.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/isochron.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/jvalue.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/plot.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/raw_funcs.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/calc/spectra.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/022_VU124-M11a.ahd +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/20WHA0103.age +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/22WHA0078.xls +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/22WHA0433.age +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/22WHA0433.arr +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/22WHA0433.full.xls +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/24WHN0001-51-592.XLS +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/AHD.input-filter +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/ArAr.calc +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/ArArCALC.age +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/NGX-600 - Copy.TXT +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/NGX-600.TXT +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/NGX-XLS.input-filter +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/Qtegra-exported-xls.input-filter +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/S01-239.csv +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/WH01.irra +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/WHA.pdf +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/raw_example.xls +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/examples/sample-default.smp +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/__init__.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/arr_file.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/basic.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/calc_file.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/new_file.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/files/xls.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/EXPORT_TO_PDF_DATA_PROPERTIES.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/__init__.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/basic.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/calculation.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/consts.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/corr.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/diffusion_funcs.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/export.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/info.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/initial.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/json.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/plots.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/raw.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/sample.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/style.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/smp/table.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/test.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/thermo/__init__.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/thermo/arrhenius.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/thermo/atomic_level_random_walk.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy/thermo/basic.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy.egg-info/SOURCES.txt +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy.egg-info/dependency_links.txt +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/ararpy.egg-info/top_level.txt +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/setup.cfg +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/tests/test.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/tests/test2.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/tests/test_error_correlation.py +0 -0
- {ararpy-0.1.24 → ararpy-0.1.26}/tests/test_regression_methods.py +0 -0
|
@@ -16,10 +16,10 @@ from . import calc, smp, files, thermo, test
|
|
|
16
16
|
""" Information """
|
|
17
17
|
|
|
18
18
|
name = 'ararpy'
|
|
19
|
-
version = '0.1.
|
|
19
|
+
version = '0.1.26'
|
|
20
20
|
__version__ = version
|
|
21
21
|
full_version = version
|
|
22
|
-
last_update = '2024-
|
|
22
|
+
last_update = '2024-05-22'
|
|
23
23
|
|
|
24
24
|
""" ArArPy Functions """
|
|
25
25
|
|
|
@@ -794,39 +794,31 @@ def power(a0: list, a1: list):
|
|
|
794
794
|
def _pow_func(x, a, b, c):
|
|
795
795
|
return a * x ** b + c
|
|
796
796
|
|
|
797
|
-
def
|
|
797
|
+
def _residuals(params):
|
|
798
798
|
a, b, c = params
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
y[1] = sum(a0) / len(a0)
|
|
804
|
-
x[2] = sum(a1[-3:]) / 3
|
|
805
|
-
y[2] = sum(a0[-3:]) / 3
|
|
806
|
-
return np.array([
|
|
807
|
-
_pow_func(x[0], a, b, c) - y[0],
|
|
808
|
-
_pow_func(x[1], a, b, c) - y[1],
|
|
809
|
-
_pow_func(x[2], a, b, c) - y[2],
|
|
810
|
-
])
|
|
811
|
-
|
|
812
|
-
def _get_sum(a, b, c):
|
|
813
|
-
y_predicted = [_pow_func(_x, a, b, c) for _x in a1]
|
|
814
|
-
return sum([(y_predicted[i] - a0[i]) ** 2 for i in range(len(a0))])
|
|
799
|
+
return [_pow_func(xi, a, b, c) - yi for xi, yi in zip(a1, a0)]
|
|
800
|
+
|
|
801
|
+
def _sum_squared_error(params):
|
|
802
|
+
return sum(r**2 for r in _residuals(params))
|
|
815
803
|
|
|
816
804
|
def _get_abc(b): # Return a, b, c given b based on linest regression
|
|
817
805
|
f = linest(a0, [_x ** b for _x in a1])
|
|
818
806
|
return f[5][1], b, f[0]
|
|
819
807
|
|
|
808
|
+
def _get_init():
|
|
809
|
+
f = linest(np.log(np.array(a0)), np.log(np.array(a1)))
|
|
810
|
+
return np.exp(f[0]), f[5][1], 0
|
|
811
|
+
|
|
820
812
|
try:
|
|
821
|
-
a, b, c =
|
|
813
|
+
a, b, c = _get_init() # initial estimate
|
|
822
814
|
count = 0
|
|
823
815
|
step = 0.01
|
|
824
816
|
while count < 100:
|
|
825
817
|
a, b, c = _get_abc(b)
|
|
826
|
-
s =
|
|
818
|
+
s = _sum_squared_error([a, b, c])
|
|
827
819
|
b_left, b_right = b - step * b, b + step * b
|
|
828
|
-
s_left =
|
|
829
|
-
s_right =
|
|
820
|
+
s_left = _sum_squared_error(_get_abc(b_left))
|
|
821
|
+
s_right = _sum_squared_error(_get_abc(b_right))
|
|
830
822
|
if s_left > s > s_right:
|
|
831
823
|
b = b_right
|
|
832
824
|
continue
|
|
@@ -886,39 +878,32 @@ def exponential(a0: list, a1: list):
|
|
|
886
878
|
def _exp_func(x, a, b, c):
|
|
887
879
|
return a * b ** x + c
|
|
888
880
|
|
|
889
|
-
def
|
|
881
|
+
def _residuals(params):
|
|
890
882
|
a, b, c = params
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
y[1] = sum(a0) / len(a0)
|
|
896
|
-
x[2] = sum(a1[-3:]) / 3
|
|
897
|
-
y[2] = sum(a0[-3:]) / 3
|
|
898
|
-
return np.array([
|
|
899
|
-
_exp_func(x[0], a, b, c) - y[0],
|
|
900
|
-
_exp_func(x[1], a, b, c) - y[1],
|
|
901
|
-
_exp_func(x[2], a, b, c) - y[2],
|
|
902
|
-
])
|
|
903
|
-
|
|
904
|
-
def _get_sum(a, b, c):
|
|
905
|
-
y_predicted = [_exp_func(_x, a, b, c) for _x in a1]
|
|
906
|
-
return sum([(y_predicted[i] - a0[i]) ** 2 for i in range(len(a0))])
|
|
883
|
+
return [_exp_func(xi, a, b, c) - yi for xi, yi in zip(a1, a0)]
|
|
884
|
+
|
|
885
|
+
def _sum_squared_error(params):
|
|
886
|
+
return sum(r**2 for r in _residuals(params))
|
|
907
887
|
|
|
908
888
|
def _get_ac(b):
|
|
909
|
-
f = linest(a0, [b **
|
|
889
|
+
f = linest(a0, [b ** xi for xi in a1])
|
|
910
890
|
return f[5][1], b, f[0]
|
|
911
891
|
|
|
892
|
+
def _get_init():
|
|
893
|
+
f = linest(np.log(np.array(a0)), np.array(a1))
|
|
894
|
+
return np.exp(f[0]), np.exp(f[5][1]), 0
|
|
895
|
+
|
|
912
896
|
try:
|
|
913
|
-
a, b, c =
|
|
897
|
+
a, b, c = _get_init()
|
|
898
|
+
# a, b, c = minimize(_sum_squared_error, [a, b, c], method="Nelder-Mead").x # 优化方法
|
|
914
899
|
count = 0
|
|
915
900
|
step = 0.01
|
|
916
901
|
while count < 100:
|
|
917
902
|
a, b, c = _get_ac(b)
|
|
918
|
-
s =
|
|
903
|
+
s = _sum_squared_error([a, b, c])
|
|
919
904
|
b_left, b_right = b - step * b, b + step * b
|
|
920
|
-
s_left =
|
|
921
|
-
s_right =
|
|
905
|
+
s_left = _sum_squared_error(_get_ac(b_left))
|
|
906
|
+
s_right = _sum_squared_error(_get_ac(b_right))
|
|
922
907
|
if s_left > s > s_right:
|
|
923
908
|
b = b_right
|
|
924
909
|
continue
|
|
@@ -25,7 +25,43 @@ from ..calc.basic import utc_dt
|
|
|
25
25
|
|
|
26
26
|
""" Open raw data file """
|
|
27
27
|
|
|
28
|
-
DEFAULT_SAMPLE_INFO = {
|
|
28
|
+
DEFAULT_SAMPLE_INFO = {
|
|
29
|
+
"ExpName": "en", # "Experiment Name"
|
|
30
|
+
"StepName": "sn", # "Step Name"
|
|
31
|
+
"StepType": "st", # "Step Type"
|
|
32
|
+
"StepLabel": "sl", # "Step Label"
|
|
33
|
+
"ZeroYear": "date", # "Zero Date Year"
|
|
34
|
+
"ZeroHour": "time", # "Zero Time Hour"
|
|
35
|
+
"ZeroMon": "mon", # "Zero Date Month"
|
|
36
|
+
"ZeroMin": "min", # "Zero Time Minute"
|
|
37
|
+
"ZeroDay": "day", # "Zero Date Day"
|
|
38
|
+
"ZeroSec": "sec", # "Zero Time Second"
|
|
39
|
+
"SmpName": "smpn", # "Sample Name"
|
|
40
|
+
"SmpLoc": "smpl", # "Sample location"
|
|
41
|
+
"SmpMatr": "smpm", # "Sample Material"
|
|
42
|
+
"ExpType": "et", # "Experiment Type"
|
|
43
|
+
"SmpWeight": "smpw", # "Sample Weight"
|
|
44
|
+
"Stepunit": "su", # "Step unit"
|
|
45
|
+
"HeatingTime": "ht", # "Heating time"
|
|
46
|
+
"InstrName": "inn", # "Instrument name"
|
|
47
|
+
"Researcher": "re", # "Researcher"
|
|
48
|
+
"Analyst": "an", # "Analyst"
|
|
49
|
+
"Lab": "la", # "Laboratory"
|
|
50
|
+
"Jv": "jv", # "J value"
|
|
51
|
+
"Jsig": "je", # "J value error"
|
|
52
|
+
"MDF": "mdf", # "MDF"
|
|
53
|
+
"MDFSig": "mdfe", # "MDF error"
|
|
54
|
+
"CalcName": "cp", # "Calc params"
|
|
55
|
+
"IrraName": "in", # "Irra name"
|
|
56
|
+
"IrraLabel": "il", # "Irra label"
|
|
57
|
+
"IrraPosH": "ih", # "Irra position H"
|
|
58
|
+
"IrraPosX": "ix", # "Irra position X"
|
|
59
|
+
"IrraPosY": "iy", # "Irra position Y"
|
|
60
|
+
"StdName": "stdn", # "Standard name"
|
|
61
|
+
"StdAge": "stda", # "Standard age"
|
|
62
|
+
"StdAgeSig": "stde", # "Standard age error"
|
|
63
|
+
}
|
|
64
|
+
|
|
29
65
|
|
|
30
66
|
|
|
31
67
|
def open_file(file_path: str, input_filter: List[Union[str, int, bool]]):
|
|
@@ -217,48 +253,27 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
217
253
|
idx = step_index = 0
|
|
218
254
|
|
|
219
255
|
header = input_filter[5]
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
256
|
+
isotope_index = input_filter[8:28]
|
|
257
|
+
data_index = input_filter[4:33]
|
|
258
|
+
strings_index = input_filter[33:41] # strings: filename, parsing information, datetime, timezone
|
|
259
|
+
optional_info_index = input_filter[41:-7] # from Exp Name to Std Age Error
|
|
260
|
+
check_box_index = input_filter[-7:]
|
|
224
261
|
|
|
225
|
-
timezone = sample_info_index[3] if sample_info_index[3] != "" else "utc"
|
|
226
262
|
while True: # measurment steps sloop
|
|
227
263
|
|
|
228
|
-
# all text information
|
|
264
|
+
# ============ all text information ============
|
|
229
265
|
options = get_sample_info(file_contents, optional_info_index, default="", base=[1, 1 - idx, 1])
|
|
230
266
|
|
|
231
|
-
#
|
|
232
|
-
try:
|
|
233
|
-
if check_box_index[2]: # input_filter[134]: date in one string
|
|
234
|
-
zero_date = datetime_parse(options.get('ZeroYear'), sample_info_index[1])
|
|
235
|
-
else:
|
|
236
|
-
zero_date = datetime(year=options.get('ZeroYear'), month=options.get('ZeroMon'),
|
|
237
|
-
day=options.get('ZeroDay'))
|
|
238
|
-
|
|
239
|
-
if check_box_index[3]: # input_filter[135]: time in one string
|
|
240
|
-
zero_time = datetime_parse(options.get('ZeroHour'), sample_info_index[2])
|
|
241
|
-
else:
|
|
242
|
-
zero_time = datetime(year=2020, month=12, day=31, hour=options.get('ZeroHour'),
|
|
243
|
-
minute=options.get('ZeroMin'), second=options.get('ZeroSec'))
|
|
244
|
-
|
|
245
|
-
zero_datetime = datetime(
|
|
246
|
-
zero_date.year, zero_date.month, zero_date.day, zero_time.hour, zero_time.minute, zero_time.second)
|
|
247
|
-
# adjust to UTC
|
|
248
|
-
zero_datetime = utc_dt(zero_datetime, tz=timezone).isoformat(timespec='seconds')
|
|
249
|
-
except (TypeError, ValueError, IndexError):
|
|
250
|
-
# print(f"Cannot parse zero datetime")
|
|
251
|
-
zero_datetime = datetime(1970, 1, 1, 0, 0, 0).isoformat(timespec='seconds')
|
|
252
|
-
|
|
253
|
-
# Step name
|
|
267
|
+
# ============ Step name ============
|
|
254
268
|
try:
|
|
255
269
|
step_name = options.get('StepName')
|
|
256
270
|
experiment_name = options.get('ExpName')
|
|
257
|
-
if check_box_index[1] and
|
|
258
|
-
|
|
259
|
-
if
|
|
260
|
-
experiment_name =
|
|
261
|
-
|
|
271
|
+
if check_box_index[1] and strings_index[0].strip() != "":
|
|
272
|
+
res = string_parser(strings_index[0], file_name)
|
|
273
|
+
if res is not None and "en" in res.named.keys():
|
|
274
|
+
experiment_name = res.named.get("en")
|
|
275
|
+
if res is not None and "sn" in res.named.keys():
|
|
276
|
+
step_index = res.named.get("sn")
|
|
262
277
|
if step_index.isnumeric():
|
|
263
278
|
step_name = f"{experiment_name}-{int(step_index):02d}"
|
|
264
279
|
else:
|
|
@@ -273,33 +288,69 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
273
288
|
options.update({'StepName': step_name})
|
|
274
289
|
options.update({'ExpName': experiment_name})
|
|
275
290
|
|
|
291
|
+
# ============ Step information ============
|
|
292
|
+
try:
|
|
293
|
+
if check_box_index[2]:
|
|
294
|
+
string = get_item(file_contents, strings_index[1:4], default="", base=[1, 1 - idx, 1])
|
|
295
|
+
res = string_parser(strings_index[4], string)
|
|
296
|
+
if res is not None:
|
|
297
|
+
options.update(dict(zip(DEFAULT_SAMPLE_INFO.keys(), [res.named.get(value, options.get(key)) for key, value in DEFAULT_SAMPLE_INFO.items()])))
|
|
298
|
+
except (TypeError, ValueError, IndexError):
|
|
299
|
+
break
|
|
300
|
+
else:
|
|
301
|
+
pass
|
|
302
|
+
|
|
303
|
+
# ============ Zero datetime ============
|
|
304
|
+
timezone = strings_index[7] if strings_index[7] != "" else "utc"
|
|
305
|
+
try:
|
|
306
|
+
if check_box_index[3]: # date in one string
|
|
307
|
+
zero_date = datetime_parse(options.get('ZeroYear'), strings_index[5])
|
|
308
|
+
else:
|
|
309
|
+
zero_date = datetime(year=options.get('ZeroYear'), month=options.get('ZeroMon'),
|
|
310
|
+
day=options.get('ZeroDay'))
|
|
311
|
+
|
|
312
|
+
if check_box_index[4]: # time in one string
|
|
313
|
+
zero_time = datetime_parse(options.get('ZeroHour'), strings_index[6])
|
|
314
|
+
else:
|
|
315
|
+
zero_time = datetime(year=2020, month=12, day=31, hour=options.get('ZeroHour'),
|
|
316
|
+
minute=options.get('ZeroMin'), second=options.get('ZeroSec'))
|
|
317
|
+
|
|
318
|
+
zero_datetime = datetime(
|
|
319
|
+
zero_date.year, zero_date.month, zero_date.day, zero_time.hour, zero_time.minute, zero_time.second)
|
|
320
|
+
# adjust to UTC
|
|
321
|
+
zero_datetime = utc_dt(zero_datetime, tz=timezone).isoformat(timespec='seconds')
|
|
322
|
+
except (TypeError, ValueError, IndexError):
|
|
323
|
+
# print(f"Cannot parse zero datetime")
|
|
324
|
+
zero_datetime = datetime(1970, 1, 1, 0, 0, 0).isoformat(timespec='seconds')
|
|
325
|
+
|
|
276
326
|
current_step = [[step_name, zero_datetime, options]]
|
|
277
327
|
|
|
328
|
+
# ============ isotope data ============
|
|
278
329
|
break_num = 0
|
|
279
330
|
cycle_num = 0
|
|
280
|
-
f = float(
|
|
281
|
-
data_content = file_contents[
|
|
331
|
+
f = float(data_index[27]) # Intensity Scale Factor
|
|
332
|
+
data_content = file_contents[data_index[0] - 1 if data_index[0] != 0 else 0]
|
|
282
333
|
for i in range(2000): # measurement cycle sloop
|
|
283
|
-
if break_num <
|
|
334
|
+
if break_num < data_index[25]:
|
|
284
335
|
break_num += 1
|
|
285
336
|
continue
|
|
286
337
|
break_num = 0
|
|
287
|
-
if int(
|
|
288
|
-
start_row =
|
|
338
|
+
if int(data_index[2]) == 0: # == 0, vertical
|
|
339
|
+
start_row = data_index[24] * cycle_num + data_index[25] * cycle_num + header + idx - 1
|
|
289
340
|
try:
|
|
290
341
|
current_step.append([
|
|
291
342
|
str(cycle_num + 1),
|
|
292
343
|
# in sequence: Ar36, Ar37, Ar38, Ar39, Ar40
|
|
293
|
-
float(data_content[start_row +
|
|
294
|
-
float(data_content[start_row +
|
|
295
|
-
float(data_content[start_row +
|
|
296
|
-
float(data_content[start_row +
|
|
297
|
-
float(data_content[start_row +
|
|
298
|
-
float(data_content[start_row +
|
|
299
|
-
float(data_content[start_row +
|
|
300
|
-
float(data_content[start_row +
|
|
301
|
-
float(data_content[start_row +
|
|
302
|
-
float(data_content[start_row +
|
|
344
|
+
float(data_content[start_row + isotope_index[18]][isotope_index[19] - 1]),
|
|
345
|
+
float(data_content[start_row + isotope_index[16]][isotope_index[17] - 1]) * f,
|
|
346
|
+
float(data_content[start_row + isotope_index[14]][isotope_index[15] - 1]),
|
|
347
|
+
float(data_content[start_row + isotope_index[12]][isotope_index[13] - 1]) * f,
|
|
348
|
+
float(data_content[start_row + isotope_index[10]][isotope_index[11] - 1]),
|
|
349
|
+
float(data_content[start_row + isotope_index[ 8]][isotope_index[ 9] - 1]) * f,
|
|
350
|
+
float(data_content[start_row + isotope_index[ 6]][isotope_index[ 7] - 1]),
|
|
351
|
+
float(data_content[start_row + isotope_index[ 4]][isotope_index[ 5] - 1]) * f,
|
|
352
|
+
float(data_content[start_row + isotope_index[ 2]][isotope_index[ 3] - 1]),
|
|
353
|
+
float(data_content[start_row + isotope_index[ 0]][isotope_index[ 1] - 1]) * f,
|
|
303
354
|
])
|
|
304
355
|
except (ValueError, IndexError):
|
|
305
356
|
print(f"Cannot parse isotope data")
|
|
@@ -307,23 +358,23 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
307
358
|
current_step.append([
|
|
308
359
|
str(cycle_num + 1), None, None, None, None, None, None, None, None, None, None,
|
|
309
360
|
])
|
|
310
|
-
elif int(
|
|
311
|
-
start_row =
|
|
312
|
-
col_inc =
|
|
361
|
+
elif int(data_index[2]) == 1: # == 1, horizontal
|
|
362
|
+
start_row = data_index[1] + idx
|
|
363
|
+
col_inc = data_index[24] * cycle_num + data_index[25] * cycle_num - 1
|
|
313
364
|
try:
|
|
314
365
|
current_step.append([
|
|
315
366
|
str(cycle_num + 1),
|
|
316
367
|
# Ar36, Ar37, Ar38, Ar39, Ar40
|
|
317
|
-
float(data_content[start_row][
|
|
318
|
-
float(data_content[start_row][
|
|
319
|
-
float(data_content[start_row][
|
|
320
|
-
float(data_content[start_row][
|
|
321
|
-
float(data_content[start_row][
|
|
322
|
-
float(data_content[start_row][
|
|
323
|
-
float(data_content[start_row][
|
|
324
|
-
float(data_content[start_row][
|
|
325
|
-
float(data_content[start_row][
|
|
326
|
-
float(data_content[start_row][
|
|
368
|
+
float(data_content[start_row][isotope_index[19] + col_inc]),
|
|
369
|
+
float(data_content[start_row][isotope_index[17] + col_inc]) * f,
|
|
370
|
+
float(data_content[start_row][isotope_index[15] + col_inc]),
|
|
371
|
+
float(data_content[start_row][isotope_index[13] + col_inc]) * f,
|
|
372
|
+
float(data_content[start_row][isotope_index[11] + col_inc]),
|
|
373
|
+
float(data_content[start_row][isotope_index[ 9] + col_inc]) * f,
|
|
374
|
+
float(data_content[start_row][isotope_index[ 7] + col_inc]),
|
|
375
|
+
float(data_content[start_row][isotope_index[ 5] + col_inc]) * f,
|
|
376
|
+
float(data_content[start_row][isotope_index[ 3] + col_inc]),
|
|
377
|
+
float(data_content[start_row][isotope_index[ 1] + col_inc]) * f,
|
|
327
378
|
])
|
|
328
379
|
except (ValueError, IndexError):
|
|
329
380
|
print(f"Cannot parse isotope data")
|
|
@@ -332,14 +383,14 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
332
383
|
str(cycle_num + 1), None, None, None, None, None, None, None, None, None, None,
|
|
333
384
|
])
|
|
334
385
|
else:
|
|
335
|
-
raise ValueError(f"{
|
|
386
|
+
raise ValueError(f"{data_index[2]} not in [0, 1]")
|
|
336
387
|
|
|
337
388
|
cycle_num += 1
|
|
338
|
-
if cycle_num >=
|
|
389
|
+
if cycle_num >= data_index[3]:
|
|
339
390
|
break
|
|
340
391
|
|
|
341
392
|
step_list.append(current_step)
|
|
342
|
-
idx =
|
|
393
|
+
idx = data_index[28] * len(step_list)
|
|
343
394
|
|
|
344
395
|
if not check_box_index[0] or len(step_list) >= 500: # check_box_index[0]: multiple sequences
|
|
345
396
|
break
|
|
@@ -366,12 +417,12 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
|
|
|
366
417
|
"StepName": get_item(file_contents, index_list[3:6], default=default, base=base),
|
|
367
418
|
"StepType": get_item(file_contents, index_list[6:9], default=default, base=base),
|
|
368
419
|
"StepLabel": get_item(file_contents, index_list[9:12], default=default, base=base),
|
|
369
|
-
"ZeroYear": get_item(file_contents, index_list[12:15], default=default, base=base),
|
|
370
|
-
"ZeroHour": get_item(file_contents, index_list[15:18], default=default, base=base),
|
|
371
|
-
"ZeroMon": get_item(file_contents, index_list[18:21], default=default, base=base),
|
|
372
|
-
"ZeroMin": get_item(file_contents, index_list[21:24], default=default, base=base),
|
|
373
|
-
"ZeroDay": get_item(file_contents, index_list[24:27], default=default, base=base),
|
|
374
|
-
"ZeroSec": get_item(file_contents, index_list[27:30], default=default, base=base),
|
|
420
|
+
"ZeroYear": get_item(file_contents, index_list[12:15], default=default, base=base),
|
|
421
|
+
"ZeroHour": get_item(file_contents, index_list[15:18], default=default, base=base),
|
|
422
|
+
"ZeroMon": get_item(file_contents, index_list[18:21], default=default, base=base),
|
|
423
|
+
"ZeroMin": get_item(file_contents, index_list[21:24], default=default, base=base),
|
|
424
|
+
"ZeroDay": get_item(file_contents, index_list[24:27], default=default, base=base),
|
|
425
|
+
"ZeroSec": get_item(file_contents, index_list[27:30], default=default, base=base),
|
|
375
426
|
"SmpName": get_item(file_contents, index_list[30:33], default=default, base=base),
|
|
376
427
|
"SmpLoc": get_item(file_contents, index_list[33:36], default=default, base=base),
|
|
377
428
|
"SmpMatr": get_item(file_contents, index_list[36:39], default=default, base=base),
|
|
@@ -385,46 +436,16 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
|
|
|
385
436
|
"Lab": get_item(file_contents, index_list[60:63], default=default, base=base),
|
|
386
437
|
"Jv": get_item(file_contents, index_list[63:66], default=default, base=base),
|
|
387
438
|
"Jsig": get_item(file_contents, index_list[66:69], default=default, base=base),
|
|
388
|
-
"
|
|
389
|
-
"
|
|
390
|
-
"
|
|
391
|
-
"
|
|
392
|
-
"
|
|
393
|
-
"
|
|
394
|
-
"
|
|
395
|
-
"
|
|
396
|
-
"
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
# "Step Type": get_item(file_contents, sample_info_index[6:9], default=default, base=base),
|
|
400
|
-
# "Step Label": get_item(file_contents, sample_info_index[9:12], default=default, base=base),
|
|
401
|
-
# "Zero Date Year": get_item(file_contents, sample_info_index[12:15], default=default, base=base),
|
|
402
|
-
# "Zero Time Hour": get_item(file_contents, sample_info_index[15:18], default=default, base=base),
|
|
403
|
-
# "Zero Date Month": get_item(file_contents, sample_info_index[18:21], default=default, base=base),
|
|
404
|
-
# "Zero Time Minute": get_item(file_contents, sample_info_index[21:24], default=default, base=base),
|
|
405
|
-
# "Zero Date Day": get_item(file_contents, sample_info_index[24:27], default=default, base=base),
|
|
406
|
-
# "Zero Time Second": get_item(file_contents, sample_info_index[27:30], default=default, base=base),
|
|
407
|
-
# "Sample Name": get_item(file_contents, sample_info_index[30:33], default=default, base=base),
|
|
408
|
-
# "Sample location": get_item(file_contents, sample_info_index[33:36], default=default, base=base),
|
|
409
|
-
# "Sample Material": get_item(file_contents, sample_info_index[36:39], default=default, base=base),
|
|
410
|
-
# "Experiment Type": get_item(file_contents, sample_info_index[39:42], default=default, base=base),
|
|
411
|
-
# "Sample Weight": get_item(file_contents, sample_info_index[42:45], default=default, base=base),
|
|
412
|
-
# "Step unit": get_item(file_contents, sample_info_index[45:48], default=default, base=base),
|
|
413
|
-
# "Heating time": get_item(file_contents, sample_info_index[48:51], default=default, base=base),
|
|
414
|
-
# "Instrument name": get_item(file_contents, sample_info_index[51:54], default=default, base=base),
|
|
415
|
-
# "Researcher": get_item(file_contents, sample_info_index[54:57], default=default, base=base),
|
|
416
|
-
# "Analyst": get_item(file_contents, sample_info_index[57:60], default=default, base=base),
|
|
417
|
-
# "Laboratory": get_item(file_contents, sample_info_index[60:63], default=default, base=base),
|
|
418
|
-
# "J value": get_item(file_contents, sample_info_index[63:66], default=default, base=base),
|
|
419
|
-
# "J value error": get_item(file_contents, sample_info_index[66:69], default=default, base=base),
|
|
420
|
-
# "Calc params": get_item(file_contents, sample_info_index[69:72], default=default, base=base),
|
|
421
|
-
# "Irra name": get_item(file_contents, sample_info_index[72:75], default=default, base=base),
|
|
422
|
-
# "Irra label": get_item(file_contents, sample_info_index[75:78], default=default, base=base),
|
|
423
|
-
# "Irra position H": get_item(file_contents, sample_info_index[78:81], default=default, base=base),
|
|
424
|
-
# "Irra position X": get_item(file_contents, sample_info_index[81:84], default=default, base=base),
|
|
425
|
-
# "Irra position Y": get_item(file_contents, sample_info_index[84:87], default=default, base=base),
|
|
426
|
-
# "Standard name": get_item(file_contents, sample_info_index[87:90], default=default, base=base),
|
|
427
|
-
# "Standard age": get_item(file_contents, sample_info_index[90:93], default=default, base=base),
|
|
428
|
-
# "Standard age error": get_item(file_contents, sample_info_index[93:96], default=default, base=base),
|
|
439
|
+
"MDF": get_item(file_contents, index_list[69:72], default=default, base=base),
|
|
440
|
+
"MDFSig": get_item(file_contents, index_list[72:75], default=default, base=base),
|
|
441
|
+
"CalcName": get_item(file_contents, index_list[75:78], default=default, base=base),
|
|
442
|
+
"IrraName": get_item(file_contents, index_list[78:81], default=default, base=base),
|
|
443
|
+
"IrraLabel": get_item(file_contents, index_list[81:84], default=default, base=base),
|
|
444
|
+
"IrraPosH": get_item(file_contents, index_list[84:87], default=default, base=base),
|
|
445
|
+
"IrraPosX": get_item(file_contents, index_list[87:90], default=default, base=base),
|
|
446
|
+
"IrraPosY": get_item(file_contents, index_list[90:93], default=default, base=base),
|
|
447
|
+
"StdName": get_item(file_contents, index_list[93:96], default=default, base=base),
|
|
448
|
+
"StdAge": get_item(file_contents, index_list[96:99], default=default, base=base),
|
|
449
|
+
"StdAgeSig": get_item(file_contents, index_list[99:102], default=default, base=base),
|
|
429
450
|
})
|
|
430
451
|
return sample_info
|
|
@@ -16,7 +16,7 @@ long_description = (here / 'README.md').read_text(encoding='utf-8')
|
|
|
16
16
|
|
|
17
17
|
setuptools.setup(
|
|
18
18
|
name='ararpy', #
|
|
19
|
-
version='0.1.
|
|
19
|
+
version='0.1.26', # version
|
|
20
20
|
author='Yang Wu',
|
|
21
21
|
author_email='wuycug@hotmail.com',
|
|
22
22
|
description='A project for Ar-Ar geochronology', # short description
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|