ararpy 0.1.25__py3-none-any.whl → 0.1.27__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 +2 -2
- ararpy/calc/basic.py +8 -0
- ararpy/files/calc_file.py +36 -29
- ararpy/files/raw_file.py +139 -114
- ararpy/smp/corr.py +1 -1
- ararpy/smp/export.py +78 -54
- {ararpy-0.1.25.dist-info → ararpy-0.1.27.dist-info}/METADATA +1 -1
- {ararpy-0.1.25.dist-info → ararpy-0.1.27.dist-info}/RECORD +11 -11
- {ararpy-0.1.25.dist-info → ararpy-0.1.27.dist-info}/WHEEL +1 -1
- {ararpy-0.1.25.dist-info → ararpy-0.1.27.dist-info}/licenses/LICENSE +0 -0
- {ararpy-0.1.25.dist-info → ararpy-0.1.27.dist-info}/top_level.txt +0 -0
ararpy/__init__.py
CHANGED
|
@@ -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-05-
|
|
22
|
+
last_update = '2024-05-22'
|
|
23
23
|
|
|
24
24
|
""" ArArPy Functions """
|
|
25
25
|
|
ararpy/calc/basic.py
CHANGED
|
@@ -129,3 +129,11 @@ def monte_carlo(func, inputs, confidence_level, **kwargs):
|
|
|
129
129
|
limits = values[:, [l_range, r_range]]
|
|
130
130
|
|
|
131
131
|
return np.concatenate((means, limits), axis=1), cov
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def parser(v: str, t: type):
|
|
135
|
+
if t == bool:
|
|
136
|
+
if str(v).lower().rstrip() in ["true", "1"]:
|
|
137
|
+
return True
|
|
138
|
+
return t(v)
|
|
139
|
+
|
ararpy/files/calc_file.py
CHANGED
|
@@ -22,7 +22,7 @@ import os
|
|
|
22
22
|
import msoffcrypto
|
|
23
23
|
|
|
24
24
|
from . import xls
|
|
25
|
-
from ..calc.basic import get_datetime
|
|
25
|
+
from ..calc.basic import get_datetime, parser
|
|
26
26
|
from ..calc import arr, err, isochron
|
|
27
27
|
|
|
28
28
|
|
|
@@ -107,9 +107,8 @@ def open_252(data: pd.DataFrame, logs01: pd.DataFrame, logs02: pd.DataFrame):
|
|
|
107
107
|
-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, # 90-99
|
|
108
108
|
-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, # 100-109
|
|
109
109
|
-999, -999, -999, -999, -1, # 110-114
|
|
110
|
-
-999, -999, -999, -999, -999, -999, -999, -999, # 115-
|
|
111
|
-
|
|
112
|
-
-999, -999, -999, -999, -999, # 131-135
|
|
110
|
+
-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, # 115-125
|
|
111
|
+
999, -999, 999, -999, 999, -999, 999, -999, 999, -999, # 126-135
|
|
113
112
|
]
|
|
114
113
|
|
|
115
114
|
# double transpose to remove keys
|
|
@@ -128,6 +127,13 @@ def open_252(data: pd.DataFrame, logs01: pd.DataFrame, logs02: pd.DataFrame):
|
|
|
128
127
|
|
|
129
128
|
# adjustment
|
|
130
129
|
isochron_mark.replace({4.0: '1'}, inplace=True)
|
|
130
|
+
|
|
131
|
+
total_param[71] = 35.96754628
|
|
132
|
+
total_param[73] = 36.9667759
|
|
133
|
+
total_param[75] = 37.9627322
|
|
134
|
+
total_param[77] = 38.964313
|
|
135
|
+
total_param[79] = 39.962383123
|
|
136
|
+
|
|
131
137
|
total_param[83] = logs01[1][9] # No
|
|
132
138
|
total_param[84] = logs01[1][10] # %SD
|
|
133
139
|
total_param[81] = logs01[1][11] # K mass
|
|
@@ -150,9 +156,9 @@ def open_252(data: pd.DataFrame, logs01: pd.DataFrame, logs02: pd.DataFrame):
|
|
|
150
156
|
total_param[51] = logs01[1][27] # %SD
|
|
151
157
|
total_param[52] = logs01[1][28] # 40K(\beta-) activities param
|
|
152
158
|
total_param[53] = logs01[1][29] # %SD
|
|
153
|
-
total_param[48] = logs01[1][26] + logs01[1][28] # 40K
|
|
154
|
-
total_param[49] = 100 / total_param[48] * pow(
|
|
155
|
-
(logs01[1][27] / 100 * logs01[1][26]) ** 2 + (logs01[1][29] / 100 * logs01[1][28]) ** 2, 0.5) # %SD
|
|
159
|
+
total_param[48] = logs01[1][26] + logs01[1][28] # 40K total activities param
|
|
160
|
+
total_param[49] = round(100 / total_param[48] * pow(
|
|
161
|
+
(logs01[1][27] / 100 * logs01[1][26]) ** 2 + (logs01[1][29] / 100 * logs01[1][28]) ** 2, 0.5), 6) # %SD
|
|
156
162
|
|
|
157
163
|
total_param[34] = logs01[1][36] # decay constant of 40K total
|
|
158
164
|
total_param[35] = logs01[1][37] # %SD
|
|
@@ -169,30 +175,29 @@ def open_252(data: pd.DataFrame, logs01: pd.DataFrame, logs02: pd.DataFrame):
|
|
|
169
175
|
total_param[44] = logs01[1][40] # decay constant of 37Ar
|
|
170
176
|
total_param[45] = logs01[1][41] # %SD
|
|
171
177
|
|
|
172
|
-
# logs01[1][49]
|
|
173
|
-
# logs01[1][50]
|
|
174
|
-
#
|
|
178
|
+
# logs01[1][49] # 1 for using weighted YORK isochron regression, 2 for unweighted
|
|
179
|
+
# logs01[1][50] # True for including errors on irradiation constants, False for excluding those
|
|
180
|
+
# logs01[1][67] # MDF method, 'LIN'
|
|
175
181
|
total_param[93] = logs01[1][70] # 40Ar/36Ar air
|
|
176
182
|
total_param[94] = logs01[1][71] # %SD
|
|
177
|
-
|
|
178
|
-
total_param[97] = 'York-2' # Fitting method
|
|
183
|
+
total_param[97] = 'York-2' if int(logs01[1][49]) == 1 else "" # Fitting method
|
|
179
184
|
total_param[98] = logs01[1][0] # Convergence
|
|
180
185
|
total_param[99] = logs01[1][1] # Iterations number
|
|
181
186
|
total_param[100] = logs01[1][67] # MDF method
|
|
182
|
-
total_param[101] = logs01[1][65] # force negative to zero when correct blank
|
|
187
|
+
total_param[101] = parser(logs01[1][65], bool) # force negative to zero when correct blank
|
|
183
188
|
total_param[102] = True # Apply 37Ar decay
|
|
184
189
|
total_param[103] = True # Apply 39Ar decay
|
|
185
|
-
total_param[104] = logs01[1][6] # Apply 37Ar decay
|
|
186
|
-
total_param[105] = logs01[1][7] # Apply 39Ar decay
|
|
187
|
-
total_param[106] = True # Apply
|
|
188
|
-
total_param[107] = True # Apply
|
|
189
|
-
total_param[108] =
|
|
190
|
-
total_param[109] =
|
|
190
|
+
total_param[104] = parser(logs01[1][6], bool) # Apply 37Ar decay
|
|
191
|
+
total_param[105] = parser(logs01[1][7], bool) # Apply 39Ar decay
|
|
192
|
+
total_param[106] = True # Apply Ca degas
|
|
193
|
+
total_param[107] = True # Apply K degas
|
|
194
|
+
total_param[108] = parser(logs01[1][8], bool) # Apply Cl degas
|
|
195
|
+
total_param[109] = True # Apply Trap degas
|
|
191
196
|
|
|
192
197
|
total_param[110] = True if logs01[1][5] == 'MIN' else False # Calculating ages using Min equation [True] or conventional equation [False]
|
|
193
|
-
total_param[111] = logs01[1][89] # Use primary standard or not
|
|
194
|
-
total_param[112] = logs01[1][91] # Use standard age or not
|
|
195
|
-
total_param[113] = logs01[1][92] # Use primary ratio or not
|
|
198
|
+
total_param[111] = parser(logs01[1][89], bool) # Use primary standard or not
|
|
199
|
+
total_param[112] = parser(logs01[1][91], bool) # Use standard age or not
|
|
200
|
+
total_param[113] = parser(logs01[1][92], bool) # Use primary ratio or not
|
|
196
201
|
|
|
197
202
|
# irradiation time
|
|
198
203
|
total_param = general_adjustment(
|
|
@@ -310,12 +315,12 @@ def open_240(data: pd.DataFrame, logs01: pd.DataFrame, logs02: pd.DataFrame):
|
|
|
310
315
|
)
|
|
311
316
|
# Do adjustment
|
|
312
317
|
isochron_mark.replace({4.0: '1'}, inplace=True)
|
|
313
|
-
total_param[44] = logs01[1][40]
|
|
314
|
-
total_param[45] = logs01[1][41]
|
|
315
|
-
total_param[42] = logs01[1][38]
|
|
316
|
-
total_param[43] = logs01[1][39]
|
|
317
318
|
total_param[34] = logs01[1][36]
|
|
318
319
|
total_param[35] = logs01[1][37]
|
|
320
|
+
total_param[42] = logs01[1][38]
|
|
321
|
+
total_param[43] = logs01[1][39]
|
|
322
|
+
total_param[44] = logs01[1][40]
|
|
323
|
+
total_param[45] = logs01[1][41]
|
|
319
324
|
|
|
320
325
|
return [
|
|
321
326
|
sample_values, blank_values, corrected_values, degas_values, publish_values,
|
|
@@ -399,6 +404,8 @@ def general_adjustment(
|
|
|
399
404
|
total_param[32] = [i / (3600 * 24 * 365.242) for i in stand_time_second] # stand year
|
|
400
405
|
|
|
401
406
|
# initial ratios & error display settings
|
|
407
|
+
total_param[95] = logs02[9][irradiation_index] # 38Ar/36Ar air
|
|
408
|
+
total_param[96] = logs02[10][irradiation_index] # %SD
|
|
402
409
|
total_param[115] = 0
|
|
403
410
|
total_param[116] = 298.56
|
|
404
411
|
total_param[117] = 0.31
|
|
@@ -624,10 +631,10 @@ class ArArCalcFile:
|
|
|
624
631
|
# list(range(1, 26, 2)) irradiation correction constants
|
|
625
632
|
# list(range(39, 58, 2)) decay constants
|
|
626
633
|
# list(range(68, 97, 2)) J, MDF, other constants
|
|
627
|
-
for column in list(range(1, 26, 2)) + list(range(68, 71, 2)):
|
|
634
|
+
for column in list(range(1, 26, 2)) + list(range(68, 71, 2)): # irradiation constants and J, MDF uncertainties
|
|
628
635
|
self.content.loc[:, ('pam', column)] = \
|
|
629
|
-
(self.content['pam', column].astype("float") / (
|
|
630
|
-
self.content['pam', column - 1].astype("float")) * 100).replace(np.nan, 0)
|
|
636
|
+
round(self.content['pam', column].astype("float") / (
|
|
637
|
+
self.content['pam', column - 1].astype("float")) * 100, 6).replace(np.nan, 0)
|
|
631
638
|
|
|
632
639
|
# sample info
|
|
633
640
|
self.sample_info = {
|
ararpy/files/raw_file.py
CHANGED
|
@@ -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]]):
|
|
@@ -61,7 +97,6 @@ def open_file(file_path: str, input_filter: List[Union[str, int, bool]]):
|
|
|
61
97
|
'Qtegra Exported XLS': open_qtegra_exported_xls, 'Seq': open_raw_seq}[
|
|
62
98
|
['txt', 'excel', 'Qtegra Exported XLS', 'Seq'][int(input_filter[1])]]
|
|
63
99
|
except KeyError:
|
|
64
|
-
print(traceback.format_exc())
|
|
65
100
|
raise FileNotFoundError("Wrong File.")
|
|
66
101
|
return handler(file_path, input_filter)
|
|
67
102
|
|
|
@@ -217,48 +252,27 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
217
252
|
idx = step_index = 0
|
|
218
253
|
|
|
219
254
|
header = input_filter[5]
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
255
|
+
isotope_index = input_filter[8:28]
|
|
256
|
+
data_index = input_filter[4:33]
|
|
257
|
+
strings_index = input_filter[33:41] # strings: filename, parsing information, datetime, timezone
|
|
258
|
+
optional_info_index = input_filter[41:-7] # from Exp Name to Std Age Error
|
|
259
|
+
check_box_index = input_filter[-7:]
|
|
224
260
|
|
|
225
|
-
timezone = sample_info_index[3] if sample_info_index[3] != "" else "utc"
|
|
226
261
|
while True: # measurment steps sloop
|
|
227
262
|
|
|
228
|
-
# all text information
|
|
263
|
+
# ============ all text information ============
|
|
229
264
|
options = get_sample_info(file_contents, optional_info_index, default="", base=[1, 1 - idx, 1])
|
|
230
265
|
|
|
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
|
|
266
|
+
# ============ Step name ============
|
|
254
267
|
try:
|
|
255
268
|
step_name = options.get('StepName')
|
|
256
269
|
experiment_name = options.get('ExpName')
|
|
257
|
-
if check_box_index[1] and
|
|
258
|
-
|
|
259
|
-
if
|
|
260
|
-
experiment_name =
|
|
261
|
-
|
|
270
|
+
if check_box_index[1] and strings_index[0].strip() != "":
|
|
271
|
+
res = string_parser(strings_index[0], file_name)
|
|
272
|
+
if res is not None and "en" in res.named.keys():
|
|
273
|
+
experiment_name = res.named.get("en")
|
|
274
|
+
if res is not None and "sn" in res.named.keys():
|
|
275
|
+
step_index = res.named.get("sn")
|
|
262
276
|
if step_index.isnumeric():
|
|
263
277
|
step_name = f"{experiment_name}-{int(step_index):02d}"
|
|
264
278
|
else:
|
|
@@ -273,33 +287,71 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
273
287
|
options.update({'StepName': step_name})
|
|
274
288
|
options.update({'ExpName': experiment_name})
|
|
275
289
|
|
|
290
|
+
# ============ Step information ============
|
|
291
|
+
try:
|
|
292
|
+
if check_box_index[2]:
|
|
293
|
+
string = get_item(file_contents, strings_index[1:4], default="", base=[1, 1 - idx, 1])
|
|
294
|
+
res = string_parser(strings_index[4], string)
|
|
295
|
+
if res is not None:
|
|
296
|
+
options.update(dict(zip(DEFAULT_SAMPLE_INFO.keys(), [res.named.get(value, options.get(key)) for key, value in DEFAULT_SAMPLE_INFO.items()])))
|
|
297
|
+
except (TypeError, ValueError, IndexError):
|
|
298
|
+
break
|
|
299
|
+
else:
|
|
300
|
+
pass
|
|
301
|
+
|
|
302
|
+
# ============ Zero datetime ============
|
|
303
|
+
timezone = strings_index[7] if strings_index[7] != "" else "utc"
|
|
304
|
+
options.update({'TimeZone': timezone})
|
|
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
|
+
options.update({'ZeroDT': zero_datetime})
|
|
323
|
+
except (TypeError, ValueError, IndexError) as e:
|
|
324
|
+
print(traceback.format_exc())
|
|
325
|
+
raise ValueError(f"Failed to parse zero datetime: {e}")
|
|
326
|
+
# zero_datetime = datetime(1970, 1, 1, 0, 0, 0).isoformat(timespec='seconds')
|
|
276
327
|
current_step = [[step_name, zero_datetime, options]]
|
|
277
328
|
|
|
329
|
+
# ============ isotope data ============
|
|
278
330
|
break_num = 0
|
|
279
331
|
cycle_num = 0
|
|
280
|
-
f = float(
|
|
281
|
-
data_content = file_contents[
|
|
332
|
+
f = float(data_index[27]) # Intensity Scale Factor
|
|
333
|
+
data_content = file_contents[data_index[0] - 1 if data_index[0] != 0 else 0]
|
|
282
334
|
for i in range(2000): # measurement cycle sloop
|
|
283
|
-
if break_num <
|
|
335
|
+
if break_num < data_index[25]:
|
|
284
336
|
break_num += 1
|
|
285
337
|
continue
|
|
286
338
|
break_num = 0
|
|
287
|
-
if int(
|
|
288
|
-
start_row =
|
|
339
|
+
if int(data_index[2]) == 0: # == 0, vertical
|
|
340
|
+
start_row = data_index[24] * cycle_num + data_index[25] * cycle_num + header + idx - 1
|
|
289
341
|
try:
|
|
290
342
|
current_step.append([
|
|
291
343
|
str(cycle_num + 1),
|
|
292
344
|
# 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 +
|
|
345
|
+
float(data_content[start_row + isotope_index[18]][isotope_index[19] - 1]),
|
|
346
|
+
float(data_content[start_row + isotope_index[16]][isotope_index[17] - 1]) * f,
|
|
347
|
+
float(data_content[start_row + isotope_index[14]][isotope_index[15] - 1]),
|
|
348
|
+
float(data_content[start_row + isotope_index[12]][isotope_index[13] - 1]) * f,
|
|
349
|
+
float(data_content[start_row + isotope_index[10]][isotope_index[11] - 1]),
|
|
350
|
+
float(data_content[start_row + isotope_index[ 8]][isotope_index[ 9] - 1]) * f,
|
|
351
|
+
float(data_content[start_row + isotope_index[ 6]][isotope_index[ 7] - 1]),
|
|
352
|
+
float(data_content[start_row + isotope_index[ 4]][isotope_index[ 5] - 1]) * f,
|
|
353
|
+
float(data_content[start_row + isotope_index[ 2]][isotope_index[ 3] - 1]),
|
|
354
|
+
float(data_content[start_row + isotope_index[ 0]][isotope_index[ 1] - 1]) * f,
|
|
303
355
|
])
|
|
304
356
|
except (ValueError, IndexError):
|
|
305
357
|
print(f"Cannot parse isotope data")
|
|
@@ -307,23 +359,23 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
307
359
|
current_step.append([
|
|
308
360
|
str(cycle_num + 1), None, None, None, None, None, None, None, None, None, None,
|
|
309
361
|
])
|
|
310
|
-
elif int(
|
|
311
|
-
start_row =
|
|
312
|
-
col_inc =
|
|
362
|
+
elif int(data_index[2]) == 1: # == 1, horizontal
|
|
363
|
+
start_row = data_index[1] + idx
|
|
364
|
+
col_inc = data_index[24] * cycle_num + data_index[25] * cycle_num - 1
|
|
313
365
|
try:
|
|
314
366
|
current_step.append([
|
|
315
367
|
str(cycle_num + 1),
|
|
316
368
|
# 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][
|
|
369
|
+
float(data_content[start_row][isotope_index[19] + col_inc]),
|
|
370
|
+
float(data_content[start_row][isotope_index[17] + col_inc]) * f,
|
|
371
|
+
float(data_content[start_row][isotope_index[15] + col_inc]),
|
|
372
|
+
float(data_content[start_row][isotope_index[13] + col_inc]) * f,
|
|
373
|
+
float(data_content[start_row][isotope_index[11] + col_inc]),
|
|
374
|
+
float(data_content[start_row][isotope_index[ 9] + col_inc]) * f,
|
|
375
|
+
float(data_content[start_row][isotope_index[ 7] + col_inc]),
|
|
376
|
+
float(data_content[start_row][isotope_index[ 5] + col_inc]) * f,
|
|
377
|
+
float(data_content[start_row][isotope_index[ 3] + col_inc]),
|
|
378
|
+
float(data_content[start_row][isotope_index[ 1] + col_inc]) * f,
|
|
327
379
|
])
|
|
328
380
|
except (ValueError, IndexError):
|
|
329
381
|
print(f"Cannot parse isotope data")
|
|
@@ -332,18 +384,21 @@ def get_raw_data(file_contents: List[List[Union[int, float, str, bool, list]]],
|
|
|
332
384
|
str(cycle_num + 1), None, None, None, None, None, None, None, None, None, None,
|
|
333
385
|
])
|
|
334
386
|
else:
|
|
335
|
-
raise ValueError(f"{
|
|
387
|
+
raise ValueError(f"{data_index[2]} not in [0, 1]")
|
|
336
388
|
|
|
337
389
|
cycle_num += 1
|
|
338
|
-
if cycle_num >=
|
|
390
|
+
if cycle_num >= data_index[3]:
|
|
339
391
|
break
|
|
340
392
|
|
|
341
393
|
step_list.append(current_step)
|
|
342
|
-
idx =
|
|
394
|
+
idx = data_index[28] * len(step_list)
|
|
343
395
|
|
|
344
396
|
if not check_box_index[0] or len(step_list) >= 500: # check_box_index[0]: multiple sequences
|
|
345
397
|
break
|
|
346
398
|
|
|
399
|
+
if not step_list:
|
|
400
|
+
raise ValueError("Failed to read the original file. It might be because the names of the experiments or steps were not recognized.")
|
|
401
|
+
|
|
347
402
|
return step_list
|
|
348
403
|
|
|
349
404
|
|
|
@@ -366,12 +421,12 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
|
|
|
366
421
|
"StepName": get_item(file_contents, index_list[3:6], default=default, base=base),
|
|
367
422
|
"StepType": get_item(file_contents, index_list[6:9], default=default, base=base),
|
|
368
423
|
"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),
|
|
424
|
+
"ZeroYear": get_item(file_contents, index_list[12:15], default=default, base=base),
|
|
425
|
+
"ZeroHour": get_item(file_contents, index_list[15:18], default=default, base=base),
|
|
426
|
+
"ZeroMon": get_item(file_contents, index_list[18:21], default=default, base=base),
|
|
427
|
+
"ZeroMin": get_item(file_contents, index_list[21:24], default=default, base=base),
|
|
428
|
+
"ZeroDay": get_item(file_contents, index_list[24:27], default=default, base=base),
|
|
429
|
+
"ZeroSec": get_item(file_contents, index_list[27:30], default=default, base=base),
|
|
375
430
|
"SmpName": get_item(file_contents, index_list[30:33], default=default, base=base),
|
|
376
431
|
"SmpLoc": get_item(file_contents, index_list[33:36], default=default, base=base),
|
|
377
432
|
"SmpMatr": get_item(file_contents, index_list[36:39], default=default, base=base),
|
|
@@ -385,46 +440,16 @@ def get_sample_info(file_contents: list, index_list: list, default="", base: Uni
|
|
|
385
440
|
"Lab": get_item(file_contents, index_list[60:63], default=default, base=base),
|
|
386
441
|
"Jv": get_item(file_contents, index_list[63:66], default=default, base=base),
|
|
387
442
|
"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),
|
|
443
|
+
"MDF": get_item(file_contents, index_list[69:72], default=default, base=base),
|
|
444
|
+
"MDFSig": get_item(file_contents, index_list[72:75], default=default, base=base),
|
|
445
|
+
"CalcName": get_item(file_contents, index_list[75:78], default=default, base=base),
|
|
446
|
+
"IrraName": get_item(file_contents, index_list[78:81], default=default, base=base),
|
|
447
|
+
"IrraLabel": get_item(file_contents, index_list[81:84], default=default, base=base),
|
|
448
|
+
"IrraPosH": get_item(file_contents, index_list[84:87], default=default, base=base),
|
|
449
|
+
"IrraPosX": get_item(file_contents, index_list[87:90], default=default, base=base),
|
|
450
|
+
"IrraPosY": get_item(file_contents, index_list[90:93], default=default, base=base),
|
|
451
|
+
"StdName": get_item(file_contents, index_list[93:96], default=default, base=base),
|
|
452
|
+
"StdAge": get_item(file_contents, index_list[96:99], default=default, base=base),
|
|
453
|
+
"StdAgeSig": get_item(file_contents, index_list[99:102], default=default, base=base),
|
|
429
454
|
})
|
|
430
455
|
return sample_info
|
ararpy/smp/corr.py
CHANGED
|
@@ -266,7 +266,7 @@ def calc_degas_cl(sample: Sample):
|
|
|
266
266
|
d6 = (a1 - a2 + (a3 + a4) / a7 - a5 / a7) / a7 / (1 - a6 / a7) ** 2
|
|
267
267
|
d7 = -(a1 - a2) * (a6) / (a7 - a6) ** 2 - (a3 + a4 - a5) / (a7 - a6) ** 2
|
|
268
268
|
|
|
269
|
-
v1 = (a1 - a2 + (a3 + a4
|
|
269
|
+
v1 = (a1 - a2 + (a3 + a4 - a5) / a7) / (1 - a6 / a7)
|
|
270
270
|
s1 = (d1**2*s1**2 + d2**2*s2**2 + d3**2*s3**2 + d4**2*s4**2+ d5**2*s5**2 + d6**2*s6**2 + d7**2*s7**2) ** .5
|
|
271
271
|
s2 = calc.err.mul((v1, s1), (vDecay[i], sDecay[i]))
|
|
272
272
|
v1 = 0 if (ar36acl[0][i] - v1 < 0 or v1 < 0) and set_negative_zero[i] else v1
|
ararpy/smp/export.py
CHANGED
|
@@ -19,6 +19,7 @@ import pickle
|
|
|
19
19
|
import traceback
|
|
20
20
|
import pdf_maker as pm
|
|
21
21
|
import numpy as np
|
|
22
|
+
from math import log
|
|
22
23
|
from decimal import Decimal
|
|
23
24
|
|
|
24
25
|
from ..calc import arr, isochron, spectra, err
|
|
@@ -63,19 +64,19 @@ def get_cv_from_dict(data: dict, **kwargs):
|
|
|
63
64
|
scale = (float(scale[0]), float(scale[1]), float(scale[2]), float(scale[3]))
|
|
64
65
|
# create plot area based on axis scale
|
|
65
66
|
plot_area = (kwargs.get("pt_left", 0.15), kwargs.get("pt_bottom", 0.15), kwargs.get("pt_width", 0.8), kwargs.get("pt_height", 0.8))
|
|
66
|
-
pt = cv.add_plot_area(name=f"PlotArea{i}", plot_area=plot_area, plot_scale=scale,
|
|
67
|
+
pt = cv.add_plot_area(name=f"PlotArea{i}", plot_area=plot_area, plot_scale=scale, **data['xAxis'][i])
|
|
67
68
|
for stick in data['xAxis'][i]['interval']:
|
|
68
69
|
start = pt.scale_to_points(float(stick), scale[2])
|
|
69
70
|
end = pt.scale_to_points(float(stick), scale[2])
|
|
70
71
|
end = (end[0], end[1] - 5)
|
|
71
|
-
if pt.line(start=start, end=end, width=
|
|
72
|
+
if pt.line(start=start, end=end, width=data['xAxis'][i]['line_width'], line_style="solid", y_clip=False, coordinate="pt", z_index=100):
|
|
72
73
|
pt.text(x=start[0], y=end[1] - 15, text=f"{stick}", clip=False, size=int(data['xAxis'][i]['label_size']),
|
|
73
74
|
coordinate="pt", h_align="middle", z_index=150)
|
|
74
75
|
for stick in data['yAxis'][i]['interval']:
|
|
75
76
|
start = pt.scale_to_points(scale[0], float(stick))
|
|
76
77
|
end = pt.scale_to_points(scale[0], float(stick))
|
|
77
78
|
end = (end[0] - 5, end[1])
|
|
78
|
-
if pt.line(start=start, end=end, width=
|
|
79
|
+
if pt.line(start=start, end=end, width=data['xAxis'][i]['line_width'], line_style="solid", x_clip=False, coordinate="pt", z_index=100):
|
|
79
80
|
pt.text(x=end[0] - 5, y=end[1], text=f"{stick}", clip=False, size=int(data['yAxis'][i]['label_size']),
|
|
80
81
|
coordinate="pt", h_align="right", v_align="center", z_index=150)
|
|
81
82
|
# axis titles
|
|
@@ -107,13 +108,13 @@ def get_cv_from_dict(data: dict, **kwargs):
|
|
|
107
108
|
start=data[index - 1], end=data[index], width=se.get('line_width', 1),
|
|
108
109
|
line_style=se.get('line_style', 'solid'), name=se['name'],
|
|
109
110
|
color=se.get('color', 'black'), clip=True, line_caps=se.get('line_caps', 'none'),
|
|
110
|
-
z_index=se.get('z_index', 9))
|
|
111
|
+
z_index=int(se.get('z_index', 9)))
|
|
111
112
|
if 'scatter' in se['type'] and se['name'] != 'Text':
|
|
112
113
|
for each in data:
|
|
113
114
|
pt.scatter(
|
|
114
115
|
each[0], each[1], fill_color=se.get('fill_color', 'black'), size=se.get('size', 5),
|
|
115
116
|
stroke_color=se.get('stroke_color', se.get('color', 'black')),
|
|
116
|
-
z_index=se.get('z_index', 9)
|
|
117
|
+
z_index=int(se.get('z_index', 9))
|
|
117
118
|
)
|
|
118
119
|
if 'scatter' in se['type'] and se['name'] == 'Text' or 'text' in se['type']:
|
|
119
120
|
for each in data:
|
|
@@ -181,6 +182,12 @@ def export_chart_to_pdf(cvs, file_name: str = "", file_path: str = "", **kwargs)
|
|
|
181
182
|
-------
|
|
182
183
|
|
|
183
184
|
"""
|
|
185
|
+
# capital letter for label
|
|
186
|
+
def get_label(l="", num=0):
|
|
187
|
+
if num // 26 > 0:
|
|
188
|
+
return get_label(get_label(l, num // 26 - 1), num % 26)
|
|
189
|
+
return l + chr(num % 26 + 65)
|
|
190
|
+
|
|
184
191
|
# write pdf
|
|
185
192
|
show_label = kwargs.get('show_label', False)
|
|
186
193
|
num_cols = kwargs.get('num_columns', 2)
|
|
@@ -195,21 +202,12 @@ def export_chart_to_pdf(cvs, file_name: str = "", file_path: str = "", **kwargs)
|
|
|
195
202
|
file.del_obj(i)
|
|
196
203
|
file.add_page(size=page_size[kwargs.get('page_size', 'a4').lower()], unit='mm')
|
|
197
204
|
for page_index, page in enumerate(cvs):
|
|
198
|
-
|
|
199
|
-
# for x in range(0, 600, 10):
|
|
200
|
-
# file.line(page_index, start=(x, 0), end=(x, 900), style='dash', color='grey')
|
|
201
|
-
# for y in range(0, 900, 10):
|
|
202
|
-
# file.line(page_index, start=(0, y), end=(800, y), style='dash', color='grey')
|
|
203
|
-
|
|
204
|
-
numbers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N']
|
|
205
|
-
|
|
206
205
|
for cv_index, cv in enumerate(page):
|
|
207
206
|
left = 10 + cv_index % num_cols * cv.width()
|
|
208
207
|
top = 20 + cv_index // num_cols * cv.height()
|
|
209
208
|
if show_label:
|
|
210
|
-
# file.text(page=page_index, x=left + 65, y=810 - top, text=numbers[cv_index])
|
|
211
209
|
cv._plot_areas[1].text(
|
|
212
|
-
x=5, y=95, text=
|
|
210
|
+
x=5, y=95, text=f"({get_label(num=cv_index)})",
|
|
213
211
|
id=f'text-label-{page_index}-{cv_index}',
|
|
214
212
|
name=f'text-label-{page_index}-{cv_index}',
|
|
215
213
|
color='black', size=title_size, axis_index=1, h_align='middle', v_align='center'
|
|
@@ -327,28 +325,36 @@ def _get_additional_text_series(name):
|
|
|
327
325
|
|
|
328
326
|
def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
329
327
|
color = options.get('color', 'black')
|
|
330
|
-
sigma = options.get('sigma',
|
|
328
|
+
sigma = options.get('sigma', smp.Info.preference['confidenceLevel'])
|
|
329
|
+
unit = options.get('unit', smp.Info.preference['ageUnit'])
|
|
331
330
|
xAxis = options.get('xAxis', [{}])
|
|
332
331
|
yAxis = options.get('yAxis', [{}])
|
|
332
|
+
line_width = options.get('line_width', 1)
|
|
333
|
+
line_caps = options.get('line_caps', 'square')
|
|
333
334
|
series = []
|
|
335
|
+
# apparent spectra lines
|
|
334
336
|
age = smp.ApparentAgeValues[2:4]
|
|
335
337
|
ar = smp.DegasValues[20]
|
|
336
|
-
data = spectra.get_data(*age, ar, cumulative=False)
|
|
338
|
+
data = spectra.get_data(*age, ar, cumulative=False, sigma=sigma)
|
|
337
339
|
series.append({
|
|
338
340
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}', 'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
339
|
-
'color': color, 'fill_color': color, 'line_width':
|
|
340
|
-
'data': np.transpose([data[0], data[1]]).tolist(),
|
|
341
|
+
'color': color, 'fill_color': color, 'line_width': line_width, 'line_style': 'solid', 'z_index': 19,
|
|
342
|
+
'data': np.transpose([data[0], data[1]]).tolist(),
|
|
343
|
+
'line_caps': line_caps,
|
|
344
|
+
# 'line_caps': 'none',
|
|
341
345
|
'axis_index': 0,
|
|
342
346
|
})
|
|
343
347
|
series.append({
|
|
344
348
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}', 'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
345
|
-
'color': color, 'fill_color': color, 'line_width':
|
|
346
|
-
'data': np.transpose([data[0], data[2]]).tolist(),
|
|
349
|
+
'color': color, 'fill_color': color, 'line_width': line_width, 'line_style': 'solid', 'z_index': 19,
|
|
350
|
+
'data': np.transpose([data[0], data[2]]).tolist(),
|
|
351
|
+
'line_caps': line_caps,
|
|
352
|
+
# 'line_caps': 'none',
|
|
347
353
|
'axis_index': 0,
|
|
348
354
|
})
|
|
355
|
+
# initial values corrected spectra lines and rect
|
|
349
356
|
text1 = smp.AgeSpectraPlot.text1
|
|
350
357
|
text2 = smp.AgeSpectraPlot.text2
|
|
351
|
-
sigma = 1
|
|
352
358
|
set_data = [spectraData2Sgima(smp.AgeSpectraPlot.set1.data, sigma),
|
|
353
359
|
spectraData2Sgima(smp.AgeSpectraPlot.set2.data, sigma)]
|
|
354
360
|
for index, text in enumerate([text1, text2]):
|
|
@@ -358,56 +364,63 @@ def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
|
358
364
|
plateau_data = np.array(set_data[index])
|
|
359
365
|
# spectra_fill_data = list(map(lambda each: [data[0][each - 1], min(data[1][each], data[2][each]), data[0][each + 1] - data[0][each], sigma * abs(data[1][each] - data[2][each])], selection))
|
|
360
366
|
spectra_fill_data = getRectFromSpectra(plateau_data)
|
|
367
|
+
print(spectra_fill_data)
|
|
361
368
|
series.append({
|
|
362
369
|
'type': 'series.rect', 'id': f'rect-{smp.name()}-{get_random_digits()}', 'name': f'rect-{smp.name()}-{get_random_digits()}',
|
|
363
|
-
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index], 'line_width': 0, 'line_style': '
|
|
364
|
-
'data': spectra_fill_data, 'line_caps': '
|
|
370
|
+
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index], 'line_width': 0, 'line_style': 'none', 'z_index': 9,
|
|
371
|
+
'data': spectra_fill_data, 'line_caps': 'none', 'fill': True,
|
|
365
372
|
'axis_index': 0,
|
|
366
373
|
})
|
|
367
374
|
series.append({
|
|
368
375
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
369
376
|
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
370
|
-
'color': ['red', 'blue'][index], 'line_width':
|
|
371
|
-
'data': plateau_data[:,[0,1]].tolist(),
|
|
377
|
+
'color': ['red', 'blue'][index], 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
378
|
+
'data': plateau_data[:,[0,1]].tolist(),
|
|
379
|
+
'line_caps': line_caps,
|
|
380
|
+
# 'line_caps': 'none',
|
|
372
381
|
'axis_index': 0,
|
|
373
382
|
})
|
|
374
383
|
series.append({
|
|
375
384
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
376
385
|
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
377
|
-
'color': ['red', 'blue'][index], 'line_width':
|
|
378
|
-
'data': plateau_data[:,[0,2]].tolist(),
|
|
386
|
+
'color': ['red', 'blue'][index], 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
387
|
+
'data': plateau_data[:,[0,2]].tolist(),
|
|
388
|
+
'line_caps': line_caps,
|
|
389
|
+
# 'line_caps': 'none',
|
|
379
390
|
'axis_index': 0,
|
|
380
391
|
})
|
|
381
392
|
series.append({
|
|
382
393
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
383
394
|
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index],
|
|
384
|
-
'text': f"WMPA = {res['age']:.2f} ± {(sigma * res['s3']):.2f}
|
|
395
|
+
'text': f"WMPA = {res['age']:.2f} ± {(sigma * res['s3']):.2f} {unit} ({sigma}s)<r>"
|
|
385
396
|
f"MSWD = {res['MSWD']:.2f}, n = {res['Num']:.0f}<r>"
|
|
386
|
-
f"<sup>39</sup>Ar = {res['Ar39']:.2f}%",
|
|
397
|
+
f"<sup>39</sup>Ar = {res['Ar39']*100:.2f}%",
|
|
387
398
|
'size': title_size,
|
|
388
|
-
'data': [text.pos],
|
|
389
|
-
'
|
|
399
|
+
# 'data': [text.pos],
|
|
400
|
+
'data': [[50, 50]],
|
|
401
|
+
'axis_index': 1, 'z_index': 29,
|
|
390
402
|
'h_align': "middle",
|
|
391
403
|
'v_align': "center",
|
|
392
404
|
})
|
|
405
|
+
# TGA
|
|
393
406
|
tga = smp.Info.results.age_spectra['TGA']
|
|
394
407
|
if not np.isnan(tga['age']):
|
|
395
408
|
series.append({
|
|
396
409
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
397
410
|
'color': color, 'fill_color': color,
|
|
398
|
-
'text': f"TGA = {tga['age']:.2f} ± {(sigma * tga['s3']):.2f}
|
|
411
|
+
'text': f"TGA = {tga['age']:.2f} ± {(sigma * tga['s3']):.2f} {unit} ({sigma}s)",
|
|
399
412
|
'size': title_size,
|
|
400
413
|
'data': [[50, 3]],
|
|
401
414
|
'axis_index': 1,
|
|
402
415
|
'h_align': "middle",
|
|
403
416
|
'v_align': "bottom",
|
|
404
417
|
})
|
|
405
|
-
|
|
418
|
+
# title
|
|
406
419
|
series.append({
|
|
407
420
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}',
|
|
408
421
|
'name': f'text-{smp.name()}-{get_random_digits()}', 'color': color,
|
|
409
422
|
'text': smp.name(), 'size': title_size,
|
|
410
|
-
'data': [[50, 95]], 'axis_index': 1,
|
|
423
|
+
'data': [[50, 95]], 'axis_index': 1, 'z_index': 29,
|
|
411
424
|
'h_align': "middle", 'v_align': "center",
|
|
412
425
|
})
|
|
413
426
|
|
|
@@ -416,50 +429,60 @@ def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
|
416
429
|
|
|
417
430
|
def _get_plot_data_age_spectra_axis(smp: sample, **options):
|
|
418
431
|
color = options.get('color', 'black')
|
|
432
|
+
line_width = options.get('line_width', 1)
|
|
419
433
|
xAxis, yAxis = [], []
|
|
420
434
|
age = smp.ApparentAgeValues[2:4]
|
|
421
435
|
ar = smp.DegasValues[20]
|
|
422
436
|
data = spectra.get_data(*age, ar, cumulative=False)
|
|
423
437
|
|
|
424
|
-
y_low_limit, y_up_limit, stick_num, inc = get_axis_scale(np.array(data[1:3]).flatten())
|
|
425
|
-
y_extent = [y_low_limit, y_up_limit]
|
|
426
|
-
y_interval = [y_low_limit + i * inc for i in range(stick_num + 1)]
|
|
427
|
-
y_interval.extend([y_up_limit * 10] * 3)
|
|
428
|
-
dp = int(np.log10(abs(y_up_limit - y_low_limit)) - 1)
|
|
429
|
-
dp = 0 if dp >= 0 else abs(dp)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
438
|
+
# y_low_limit, y_up_limit, stick_num, inc = get_axis_scale(np.array(data[1:3]).flatten())
|
|
439
|
+
# y_extent = [y_low_limit, y_up_limit]
|
|
440
|
+
# y_interval = [y_low_limit + i * inc for i in range(stick_num + 1)]
|
|
441
|
+
# y_interval.extend([y_up_limit * 10] * 3)
|
|
442
|
+
# dp = int(np.log10(abs(y_up_limit - y_low_limit)) - 1)
|
|
443
|
+
# dp = 0 if dp >= 0 else abs(dp)
|
|
444
|
+
# y_interval = [f"{i:.{dp}f}" for i in y_interval]
|
|
445
|
+
try:
|
|
446
|
+
y_low_limit = float(smp.AgeSpectraPlot.yaxis.min)
|
|
447
|
+
y_up_limit = float(smp.AgeSpectraPlot.yaxis.max)
|
|
448
|
+
y_extent = [y_low_limit, y_up_limit]
|
|
449
|
+
stick_num = int(smp.AgeSpectraPlot.yaxis.split_number)
|
|
450
|
+
inc = float(smp.AgeSpectraPlot.yaxis.interval)
|
|
451
|
+
y_interval = [y_low_limit + i * inc for i in range(stick_num + 1)]
|
|
452
|
+
dp = int(np.log10(abs(y_up_limit - y_low_limit)) - 1)
|
|
453
|
+
dp = 0 if dp >= 0 else abs(dp)
|
|
454
|
+
y_interval = [f"{i:.{dp}f}" for i in y_interval]
|
|
455
|
+
except (BaseException, Exception):
|
|
456
|
+
y_extent = [0, 250]
|
|
457
|
+
y_interval = ['0', '50', '100', '150', '200', '250', '600', '700', '800', '900', '1000']
|
|
436
458
|
|
|
437
459
|
xAxis.append({
|
|
438
460
|
'extent': [0, 100], 'interval': [0, 20, 40, 60, 80, 100], 'id': 0, 'show_frame': True,
|
|
439
|
-
'title': 'Cumulative <sup>39</sup>Ar
|
|
440
|
-
'line_width':
|
|
461
|
+
'title': 'Cumulative <sup>39</sup>Ar released (%)', 'name_location': 'middle',
|
|
462
|
+
'line_width': line_width, 'line_style': 'solid', 'z_index': 9, 'label_size': label_size, 'title_size': title_size,
|
|
441
463
|
})
|
|
442
464
|
xAxis.append({
|
|
443
465
|
'extent': [0, 100], 'interval': [], 'id': 1, 'show_frame': False,
|
|
444
466
|
'title': '', 'name_location': 'middle',
|
|
445
|
-
'line_width':
|
|
467
|
+
'line_width': 0, 'line_style': 'none', 'z_index': 0, 'label_size': label_size, 'title_size': title_size,
|
|
446
468
|
})
|
|
447
469
|
yAxis.append({
|
|
448
470
|
'extent': y_extent, 'interval': y_interval,
|
|
449
471
|
'id': 0, 'show_frame': True,
|
|
450
|
-
'title': 'Apparent
|
|
451
|
-
'line_width':
|
|
472
|
+
'title': 'Apparent age (Ma)', 'name_location': 'middle',
|
|
473
|
+
'line_width': line_width, 'line_style': 'solid', 'z_index': 9, 'label_size': label_size, 'title_size': title_size,
|
|
452
474
|
})
|
|
453
475
|
yAxis.append({
|
|
454
476
|
'extent': [0, 100], 'interval': [], 'id': 1, 'show_frame': False,
|
|
455
477
|
'title': '', 'name_location': 'middle',
|
|
456
|
-
'line_width':
|
|
478
|
+
'line_width': 0, 'line_style': 'none', 'z_index': 0, 'label_size': label_size, 'title_size': title_size,
|
|
457
479
|
})
|
|
458
480
|
return xAxis, yAxis
|
|
459
481
|
|
|
460
482
|
|
|
461
483
|
def _get_plot_data_inv_isochron_axis(smp: sample, **options):
|
|
462
484
|
color = options.get('color', 'black')
|
|
485
|
+
line_width = options.get('line_width', 1)
|
|
463
486
|
xAxis, yAxis = [], []
|
|
464
487
|
data = np.array(smp.InvIsochronPlot.data)
|
|
465
488
|
set1 = smp.InvIsochronPlot.set1.data
|
|
@@ -478,10 +501,12 @@ def _get_plot_data_inv_isochron_axis(smp: sample, **options):
|
|
|
478
501
|
'interval': interval,
|
|
479
502
|
'id': 0, 'show_frame': True, 'z_index': 9, 'label_size': label_size, 'title_size': title_size,
|
|
480
503
|
'title': '<sup>39</sup>Ar<sub>K</sub> / <sup>40</sup>Ar<sup>*</sup>', 'name_location': 'middle',
|
|
504
|
+
'line_width': line_width,
|
|
481
505
|
})
|
|
482
506
|
xAxis.append({
|
|
483
507
|
'extent': [0, 100], 'interval': [], 'id': 1, 'show_frame': False,
|
|
484
508
|
'title': '', 'name_location': 'middle', 'z_index': 0, 'label_size': label_size, 'title_size': title_size,
|
|
509
|
+
'line_width': 0,
|
|
485
510
|
})
|
|
486
511
|
|
|
487
512
|
low_limit, up_limit, stick_num, inc = get_axis_scale(data[2])
|
|
@@ -1164,7 +1189,6 @@ class WritingWorkbook:
|
|
|
1164
1189
|
]:
|
|
1165
1190
|
for index, _ in enumerate(['Set 1', 'Set 2']):
|
|
1166
1191
|
ar39[index] = res[index].get('Ar39', ar39[index] * 100) / 100
|
|
1167
|
-
print(res[index])
|
|
1168
1192
|
try:
|
|
1169
1193
|
content.extend([
|
|
1170
1194
|
[(row + num_step, 0, row + 1 + num_step, 0), _, {'bold': 1, 'align': 'center'}],
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
ararpy/__init__.py,sha256=
|
|
1
|
+
ararpy/__init__.py,sha256=vsCWb5yzto-kGLLNpOzAb74KvfITyybMQ5RgEJJkmlU,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
|
-
ararpy/calc/basic.py,sha256=
|
|
6
|
+
ararpy/calc/basic.py,sha256=fVpdXmyqcIUU26nhU1bnI-YK4ZQ4Qqk24P3Yi9YwUwI,4187
|
|
7
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
|
|
@@ -35,18 +35,18 @@ ararpy/examples/sample-default.smp,sha256=YNkoQGgPrsL_fXS7ZHxfRtLQWekCDqT9czS6vB
|
|
|
35
35
|
ararpy/files/__init__.py,sha256=l5B5ZQ01WdtvjjN0aMkyAFNgpwANdM_1I0tQbqnRuEY,69
|
|
36
36
|
ararpy/files/arr_file.py,sha256=KqksGlEA6nmMQofTgi7v45flscQZVtefxaNCKrV3Am4,837
|
|
37
37
|
ararpy/files/basic.py,sha256=nc7Hgo_qLSkdmtKzZmd5SQ8Jy0dhW46ly4gh-oisUDs,2095
|
|
38
|
-
ararpy/files/calc_file.py,sha256=
|
|
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=
|
|
40
|
+
ararpy/files/raw_file.py,sha256=PSJ0WwZHSIRrNDre69UwzpGevZQkI7utqhm9aKAm_Rs,20797
|
|
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
|
|
44
44
|
ararpy/smp/basic.py,sha256=PMvlSoToY8CJEORRrhEo4rYM2-VfSmjg0IuDpGFOGUM,24899
|
|
45
45
|
ararpy/smp/calculation.py,sha256=LCFJWjLVLEKEQ5b7RFUIxsMahEzgLdodW4kCYXV5Z34,2919
|
|
46
46
|
ararpy/smp/consts.py,sha256=XIdjdz8cYxspG2jMnoItdlUsxr3hKbNFJjMZJh1bpzw,393
|
|
47
|
-
ararpy/smp/corr.py,sha256=
|
|
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=
|
|
49
|
+
ararpy/smp/export.py,sha256=VvpqV_WxScbJ1bcmS6lDiBCa2bIn-TuumUOcDo78ItA,116201
|
|
50
50
|
ararpy/smp/info.py,sha256=iKUELm-BuUduDlJKC1d8tKKNHbwwbNmhUg2pi6bcBvA,489
|
|
51
51
|
ararpy/smp/initial.py,sha256=VSNku2fYD1xGkpHxMqnSJCAhSQawfsDCdqYCxtDJryQ,17196
|
|
52
52
|
ararpy/smp/json.py,sha256=BTZCjVN0aj9epc700nwkYEYMKN2lHBYo-pLmtnz5oHY,2300
|
|
@@ -59,8 +59,8 @@ 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.
|
|
63
|
-
ararpy-0.1.
|
|
64
|
-
ararpy-0.1.
|
|
65
|
-
ararpy-0.1.
|
|
66
|
-
ararpy-0.1.
|
|
62
|
+
ararpy-0.1.27.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
|
|
63
|
+
ararpy-0.1.27.dist-info/METADATA,sha256=ekOHHUdF4oyaBG5S7NJR7I4daFUFs-YzFCLo-Z3JXng,24516
|
|
64
|
+
ararpy-0.1.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
65
|
+
ararpy-0.1.27.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
|
|
66
|
+
ararpy-0.1.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|