ararpy 0.1.195__py3-none-any.whl → 0.1.198__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 +1 -1
- ararpy/calc/age.py +2 -1
- ararpy/calc/arr.py +1 -1
- ararpy/calc/corr.py +5 -3
- ararpy/smp/corr.py +65 -45
- ararpy/smp/initial.py +19 -2
- ararpy/smp/plots.py +29 -15
- ararpy/smp/sample.py +12 -10
- {ararpy-0.1.195.dist-info → ararpy-0.1.198.dist-info}/METADATA +1 -1
- {ararpy-0.1.195.dist-info → ararpy-0.1.198.dist-info}/RECORD +13 -13
- {ararpy-0.1.195.dist-info → ararpy-0.1.198.dist-info}/WHEEL +0 -0
- {ararpy-0.1.195.dist-info → ararpy-0.1.198.dist-info}/licenses/LICENSE +0 -0
- {ararpy-0.1.195.dist-info → ararpy-0.1.198.dist-info}/top_level.txt +0 -0
ararpy/__init__.py
CHANGED
ararpy/calc/age.py
CHANGED
|
@@ -61,7 +61,7 @@ def calc_age_min(F, sF, **kwargs) -> tuple:
|
|
|
61
61
|
Lb = arr.array_as_float(kwargs.pop('Lb'))
|
|
62
62
|
sLb = arr.array_as_float(kwargs.pop('sLb') * Lb / 100)
|
|
63
63
|
t = arr.array_as_float(kwargs.pop('t'))
|
|
64
|
-
st = arr.array_as_float(kwargs.pop('st')
|
|
64
|
+
st = arr.array_as_float(kwargs.pop('st'))
|
|
65
65
|
# Ap = arr.array_as_float(kwargs.pop('Ap'))
|
|
66
66
|
# sAp = arr.array_as_float(kwargs.pop('sAp') * Ap / 100)
|
|
67
67
|
# Kp = arr.array_as_float(kwargs.pop('Kp'))
|
|
@@ -70,6 +70,7 @@ def calc_age_min(F, sF, **kwargs) -> tuple:
|
|
|
70
70
|
# recalculation using Min et al.(2000) equation
|
|
71
71
|
# lmd = A * W * Y / (f * No)
|
|
72
72
|
V = f * No / ((Ab + Ae) * W * Y)
|
|
73
|
+
sf = 0
|
|
73
74
|
sV = pow((V / f * sf) ** 2 + (V / No * sNo) ** 2 + (V / (Ab + Ae)) ** 2 * (sAb ** 2 + sAe ** 2) +
|
|
74
75
|
(V / W * sW) ** 2 + (V / Y * sY) ** 2, 0.5)
|
|
75
76
|
# standard age in year, change to Ma
|
ararpy/calc/arr.py
CHANGED
ararpy/calc/corr.py
CHANGED
|
@@ -268,7 +268,7 @@ def Monte_Carlo_F(ar40m: Tuple[float, float], ar39m: Tuple[float, float], ar38m:
|
|
|
268
268
|
M37: Tuple[float, float], M36: Tuple[float, float],
|
|
269
269
|
G40: Tuple[float, float], G39: Tuple[float, float], G38: Tuple[float, float],
|
|
270
270
|
G37: Tuple[float, float], G36: Tuple[float, float],
|
|
271
|
-
stand_time_year: float,
|
|
271
|
+
stand_time_year: float, JNFactor: Tuple[float, float],
|
|
272
272
|
**options):
|
|
273
273
|
"""
|
|
274
274
|
|
|
@@ -294,6 +294,7 @@ def Monte_Carlo_F(ar40m: Tuple[float, float], ar39m: Tuple[float, float], ar38m:
|
|
|
294
294
|
L36cl
|
|
295
295
|
MDFunc
|
|
296
296
|
MDF
|
|
297
|
+
JNFactor
|
|
297
298
|
options
|
|
298
299
|
|
|
299
300
|
Returns
|
|
@@ -307,9 +308,7 @@ def Monte_Carlo_F(ar40m: Tuple[float, float], ar39m: Tuple[float, float], ar38m:
|
|
|
307
308
|
Monte_Carlo_Size = 10000
|
|
308
309
|
|
|
309
310
|
# generate random
|
|
310
|
-
print(ar40m)
|
|
311
311
|
ar40m = random_normal_absolute(*ar40m, size=Monte_Carlo_Size)
|
|
312
|
-
print(ar40m)
|
|
313
312
|
ar39m = random_normal_absolute(*ar39m, size=Monte_Carlo_Size)
|
|
314
313
|
ar38m = random_normal_absolute(*ar38m, size=Monte_Carlo_Size)
|
|
315
314
|
ar37m = random_normal_absolute(*ar37m, size=Monte_Carlo_Size)
|
|
@@ -347,6 +346,8 @@ def Monte_Carlo_F(ar40m: Tuple[float, float], ar39m: Tuple[float, float], ar38m:
|
|
|
347
346
|
R38v39k = random_normal_relative(*R38v39k, size=Monte_Carlo_Size)
|
|
348
347
|
R36v38clp = random_normal_relative(*R36v38clp, size=Monte_Carlo_Size)
|
|
349
348
|
|
|
349
|
+
JNFactor = random_normal_absolute(*JNFactor, size=Monte_Carlo_Size)
|
|
350
|
+
|
|
350
351
|
blank_gain_corr = options.get('blank_gain_corr', True)
|
|
351
352
|
|
|
352
353
|
def do_simulation():
|
|
@@ -376,6 +377,7 @@ def Monte_Carlo_F(ar40m: Tuple[float, float], ar39m: Tuple[float, float], ar38m:
|
|
|
376
377
|
_ar36a = _ar36res - _ar36cl
|
|
377
378
|
_ar40r = _ar40 - _ar36a * R40v36a[i] - _ar39k * R40v39k[i]
|
|
378
379
|
_ar40ar = _ar40 - _ar39k * R40v39k[i]
|
|
380
|
+
_ar39k = _ar39k * JNFactor[i]
|
|
379
381
|
_f = _ar40r / _ar39k
|
|
380
382
|
i += 1
|
|
381
383
|
# yield _f, _ar36, _ar37, _ar38, _ar39, _ar40, _ar36a, _ar37ca, _ar39k, _ar40r, _ar36cl
|
ararpy/smp/corr.py
CHANGED
|
@@ -156,15 +156,12 @@ def calc_degas_ca(sample: Sample):
|
|
|
156
156
|
ar39ca = calc.arr.mul_factor(ar37ca, sample.TotalParam[8:10], isRelative=True)
|
|
157
157
|
ar38ca = calc.arr.mul_factor(ar37ca, sample.TotalParam[10:12], isRelative=True)
|
|
158
158
|
ar36ca = calc.arr.mul_factor(ar37ca, sample.TotalParam[12:14], isRelative=True)
|
|
159
|
-
sample.DegasValues[8:10] = copy.deepcopy(ar37ca)
|
|
160
|
-
|
|
161
|
-
# sample.DegasValues[18:20] = ar38ca if corrDecasCa else [[0] * n, [0] * n]
|
|
162
|
-
# sample.DegasValues[4:6] = ar36ca if corrDecasCa else [[0] * n, [0] * n]
|
|
163
|
-
sample.DegasValues[ 4] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar36ca[0])]
|
|
159
|
+
sample.DegasValues[8:10] = copy.deepcopy(ar37ca) # 37Ca
|
|
160
|
+
sample.DegasValues[ 4] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar36ca[0])] # 36Ca
|
|
164
161
|
sample.DegasValues[ 5] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar36ca[1])]
|
|
165
|
-
sample.DegasValues[18] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar38ca[0])]
|
|
162
|
+
sample.DegasValues[18] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar38ca[0])] # 38Ca
|
|
166
163
|
sample.DegasValues[19] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar38ca[1])]
|
|
167
|
-
sample.DegasValues[22] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar39ca[0])]
|
|
164
|
+
sample.DegasValues[22] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar39ca[0])] # 39Ca
|
|
168
165
|
sample.DegasValues[23] = [val if corrDecasCa[idx] else 0 for idx, val in enumerate(ar39ca[1])]
|
|
169
166
|
sample.PublishValues[1] = copy.deepcopy(ar37ca[0])
|
|
170
167
|
|
|
@@ -241,43 +238,51 @@ def calc_degas_cl(sample: Sample):
|
|
|
241
238
|
try:
|
|
242
239
|
if not corrDecasCl:
|
|
243
240
|
raise ValueError("Do not apply degas chlorine")
|
|
244
|
-
|
|
241
|
+
vDecay = [cl36_cl38_p[0][i] * (1 - np.exp(-1 * decay_const[0][i] * stand_time_year[i])) for i in
|
|
245
242
|
range(len(stand_time_year))]
|
|
246
|
-
|
|
243
|
+
sDecay = [pow((cl36_cl38_p[1][i] * (1 - np.exp(-1 * decay_const[0][i] * stand_time_year[i]))) ** 2 +
|
|
247
244
|
(cl36_cl38_p[0][i] * stand_time_year[i] * (np.exp(-1 * decay_const[0][i] * stand_time_year[i])) *
|
|
248
245
|
decay_const[1][i]) ** 2, 0.5) for i in range(len(stand_time_year))]
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
sDecay = [calc.err.div((1, 0), (vDecay[i], sDecay[i])) for i in range(len(sDecay))]
|
|
247
|
+
vDecay = [1 / vDecay[i] for i in range(len(vDecay))]
|
|
248
|
+
|
|
251
249
|
# 36ArCl
|
|
252
250
|
ar36cl = [[], []]
|
|
253
|
-
ar36cl[0] = [(ar36acl[0][i] * ar38ar36[0][i] - ar38acl[0][i]) / (ar38ar36[0][i] - v3[i])
|
|
254
|
-
for i in range(len(ar36acl[0]))]
|
|
255
|
-
s1 = [(ar36acl[1][i] * ar38ar36[0][i] / (ar38ar36[0][i] - v3[i])) ** 2 for i in range(len(ar36cl[0]))]
|
|
256
|
-
s2 = [(ar38acl[1][i] / (ar38ar36[0][i] - v3[i])) ** 2 for i in range(len(ar36cl[0]))]
|
|
257
|
-
s3 = [(s3[i] * (ar36acl[0][i] * ar38ar36[0][i] - ar38acl[0][i]) / (ar38ar36[0][i] - v3[i]) ** 2) ** 2
|
|
258
|
-
for i in range(len(ar36cl[0]))]
|
|
259
|
-
s4 = [(ar36acl[0][i] / (ar38ar36[0][i] - v3[i]) -
|
|
260
|
-
(ar36acl[0][i] * ar38ar36[0][i] - ar38acl[0][i]) / (ar38ar36[0][i] - v3[i]) ** 2) ** 2 *
|
|
261
|
-
(ar38ar36[1][i]) ** 2 for i in range(len(ar36cl[0]))]
|
|
262
|
-
ar36cl[1] = [pow(s1[i] + s2[i] + s3[i] + s4[i], 0.5) for i in range(len(ar36cl[0]))]
|
|
263
|
-
|
|
264
251
|
# 38ArCl
|
|
265
252
|
ar38cl = [[], []]
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
253
|
+
for i in range(len(vDecay)):
|
|
254
|
+
a1 = sample.CorrectedValues[0][i]; s1 = sample.CorrectedValues[1][i]
|
|
255
|
+
a2 = sample.DegasValues[4][i]; s2 = sample.DegasValues[5][i];
|
|
256
|
+
a3 = sample.DegasValues[16][i]; s3 = sample.DegasValues[17][i]
|
|
257
|
+
a4 = sample.DegasValues[18][i]; s4 = sample.DegasValues[19][i]
|
|
258
|
+
a5 = sample.CorrectedValues[4][i]; s5 = sample.CorrectedValues[5][i]
|
|
259
|
+
a6 = vDecay[i]; s6 = sDecay[i]
|
|
260
|
+
a7 = ar38ar36[0][i]; s7 = ar38ar36[1][i]
|
|
261
|
+
|
|
262
|
+
d1 = 1 / (1 - a6 / a7)
|
|
263
|
+
d2 = - 1 / (1 - a6 / a7)
|
|
264
|
+
d3 = 1 / (a7 - a6)
|
|
265
|
+
d4 = 1 / (a7 - a6)
|
|
266
|
+
d5 = - 1 / (a7 - a6)
|
|
267
|
+
d6 = (a1 - a2 + (a3 + a4) / a7 - a5 / a7) / a7 / (1 - a6 / a7) ** 2
|
|
268
|
+
d7 = -(a1 - a2) * (a6) / (a7 - a6) ** 2 - (a3 + a4 - a5) / (a7 - a6) ** 2
|
|
269
|
+
|
|
270
|
+
v1 = (a1 - a2 + (a3 + a4) / a7 - a5 / a7) / (1 - a6 / a7)
|
|
271
|
+
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
|
|
272
|
+
s2 = calc.err.mul((v1, s1), (vDecay[i], sDecay[i]))
|
|
273
|
+
v1 = 0 if (ar36acl[0][i] - v1 < 0 or v1 < 0) and set_negative_zero[i] else v1
|
|
274
|
+
v2 = v1 * vDecay[i]
|
|
275
|
+
|
|
276
|
+
# Note: Ar36Cl uncertainty is differen with ArArCALC. All calculation was conducted separately considering they are independent
|
|
277
|
+
# s1 = calc.err.div((a1 - a2 + (a3 + a4) / a7 - a5 / a7, calc.err.add(s1, s2, calc.err.div((a3 + a4, calc.err.add(s3, s4)), (a7, s7)), calc.err.div((a5, s5), (a7, s7)))), (1 - a6 / a7, calc.err.div((a6, s6), (a7, s7))))
|
|
278
|
+
|
|
279
|
+
ar36cl[0].append(v1); ar36cl[1].append(s1)
|
|
280
|
+
ar38cl[0].append(v2); ar38cl[1].append(s2)
|
|
275
281
|
|
|
276
282
|
except Exception as e:
|
|
277
283
|
print('Error in corr Cl: {}, lines: {}'.format(e, e.__traceback__.tb_lineno))
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
ar38cl = np.zeros([2, n])
|
|
284
|
+
ar36cl = np.zeros([2, len(ar36acl[0])])
|
|
285
|
+
ar38cl = np.zeros([2, len(ar36acl[0])])
|
|
281
286
|
|
|
282
287
|
# sample.DegasValues[6:8] = ar36cl
|
|
283
288
|
# sample.DegasValues[10:12] = ar38cl
|
|
@@ -360,11 +365,16 @@ def calc_degas_r(sample: Sample):
|
|
|
360
365
|
def calc_nor_inv_isochrons(sample: Sample):
|
|
361
366
|
n = len(sample.SequenceName)
|
|
362
367
|
try:
|
|
363
|
-
isochron_1 = calc.isochron.get_data(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
sample.
|
|
367
|
-
|
|
368
|
+
isochron_1 = calc.isochron.get_data(
|
|
369
|
+
*calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
|
|
370
|
+
*calc.arr.sub(sample.CorrectedValues[8:10], sample.DegasValues[30:32]),
|
|
371
|
+
*sample.DegasValues[0:2]
|
|
372
|
+
)
|
|
373
|
+
isochron_2 = calc.isochron.get_data(
|
|
374
|
+
*calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
|
|
375
|
+
*sample.DegasValues[0:2],
|
|
376
|
+
*calc.arr.sub(sample.CorrectedValues[8:10], sample.DegasValues[30:32]))
|
|
377
|
+
except (BaseException, Exception):
|
|
368
378
|
return np.zeros([5, n]), np.zeros([5, n])
|
|
369
379
|
else:
|
|
370
380
|
return isochron_1, isochron_2
|
|
@@ -374,12 +384,18 @@ def calc_cl_isochrons(sample: Sample):
|
|
|
374
384
|
n = len(sample.SequenceName)
|
|
375
385
|
try:
|
|
376
386
|
isochron_3 = calc.isochron.get_data(
|
|
377
|
-
*sample.DegasValues[20:22],
|
|
387
|
+
*calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
|
|
388
|
+
*sample.DegasValues[24:26],
|
|
389
|
+
*calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor))
|
|
378
390
|
isochron_4 = calc.isochron.get_data(
|
|
379
|
-
*sample.DegasValues[20:22],
|
|
391
|
+
*calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
|
|
392
|
+
*calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor),
|
|
393
|
+
*sample.DegasValues[24:26])
|
|
380
394
|
isochron_5 = calc.isochron.get_data(
|
|
381
|
-
*sample.DegasValues[10:12],
|
|
382
|
-
|
|
395
|
+
*calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor),
|
|
396
|
+
*sample.DegasValues[24:26],
|
|
397
|
+
*calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor))
|
|
398
|
+
except (BaseException, Exception):
|
|
383
399
|
return np.zeros([5, n]), np.zeros([5, n]), np.zeros([5, n])
|
|
384
400
|
else:
|
|
385
401
|
return isochron_3, isochron_4, isochron_5
|
|
@@ -422,7 +438,6 @@ def calc_ratio(sample: Sample, monte_carlo: bool = False):
|
|
|
422
438
|
"""
|
|
423
439
|
ar40r_percent = [item / sample.CorrectedValues[8][index] * 100 if sample.CorrectedValues[8][index] != 0 else 0
|
|
424
440
|
for index, item in enumerate(sample.DegasValues[24])]
|
|
425
|
-
sum_ar39k = sum(sample.DegasValues[20])
|
|
426
441
|
sum_ar36a = sum(sample.DegasValues[ 0])
|
|
427
442
|
CaK = calc.arr.mul_factor(calc.arr.mul_factor(
|
|
428
443
|
sample.DegasValues[8:10], calc.arr.rec_factor(sample.DegasValues[20:22], isRelative=False)),
|
|
@@ -437,10 +452,12 @@ def calc_ratio(sample: Sample, monte_carlo: bool = False):
|
|
|
437
452
|
sample.ApparentAgeValues[0:2] = ar40aar36a
|
|
438
453
|
sample.ApparentAgeValues[7] = ar36a_percent
|
|
439
454
|
else:
|
|
455
|
+
ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor)
|
|
456
|
+
sum_ar39k = sum(ar39k)
|
|
457
|
+
ar39k_percent = [item / sum_ar39k * 100 if sum_ar39k != 0 else 0 for item in ar39k]
|
|
440
458
|
ar40rar39k = calc.arr.mul_factor(
|
|
441
459
|
sample.DegasValues[24:26], calc.arr.rec_factor(sample.DegasValues[20:22], isRelative=False),
|
|
442
460
|
isRelative=False)
|
|
443
|
-
ar39k_percent = [item / sum_ar39k * 100 if sum_ar39k != 0 else 0 for item in sample.DegasValues[20]]
|
|
444
461
|
sample.ApparentAgeValues[0:2] = ar40rar39k
|
|
445
462
|
sample.ApparentAgeValues[7] = ar39k_percent
|
|
446
463
|
|
|
@@ -528,6 +545,8 @@ def monte_carlo_f(sample: Sample):
|
|
|
528
545
|
R38v36a = np.transpose(sample.TotalParam[4:6])
|
|
529
546
|
R36v38clp = np.transpose(sample.TotalParam[56:58])
|
|
530
547
|
|
|
548
|
+
JNFactor = np.transpose(sample.NormalizeFactor)
|
|
549
|
+
|
|
531
550
|
stand_time_year = np.transpose(sample.TotalParam[32])
|
|
532
551
|
|
|
533
552
|
irradiation_cycles = [list(filter(None, re.split(r'[DS]', each_step))) for each_step in sample.TotalParam[27]]
|
|
@@ -562,6 +581,7 @@ def monte_carlo_f(sample: Sample):
|
|
|
562
581
|
L37ar=L37ar[i], L39ar=L39ar[i], L36cl=L36cl[i],
|
|
563
582
|
MDFunc=None,
|
|
564
583
|
MDF=MDF[i], stand_time_year=stand_time_year[i],
|
|
584
|
+
JNFactor=JNFactor,
|
|
565
585
|
blank_gain_corr=sample.TotalParam[111][i]
|
|
566
586
|
)
|
|
567
587
|
|
ararpy/smp/initial.py
CHANGED
|
@@ -16,7 +16,7 @@ import pandas as pd
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
import copy
|
|
18
18
|
from typing import List, Union, Optional
|
|
19
|
-
from ..calc import arr
|
|
19
|
+
from ..calc import arr, err
|
|
20
20
|
from ..files import calc_file
|
|
21
21
|
from . import (sample as samples, basic, table, raw as smp_raw)
|
|
22
22
|
|
|
@@ -288,9 +288,26 @@ def check_version(smp: Sample):
|
|
|
288
288
|
if smp.version != samples.VERSION:
|
|
289
289
|
std = initial(Sample())
|
|
290
290
|
basic.get_merged_smp(smp, std)
|
|
291
|
-
|
|
291
|
+
|
|
292
|
+
# 20250328: # Experiment info
|
|
292
293
|
smp.Info.experiment.name = smp.name()
|
|
293
294
|
smp.Info.experiment.step_num = smp.sequence().size
|
|
295
|
+
|
|
296
|
+
# 20250404
|
|
297
|
+
doNormalize = True
|
|
298
|
+
v, sv = [], []
|
|
299
|
+
if smp.Info.sample.type.lower() == "unknown":
|
|
300
|
+
v, sv = smp.TotalParam[67:69]
|
|
301
|
+
sv = np.multiply(v, sv) / 100
|
|
302
|
+
elif smp.Info.sample.type.lower() == "air":
|
|
303
|
+
v, sv = smp.TotalParam[93:95]
|
|
304
|
+
sv = np.multiply(v, sv) / 100
|
|
305
|
+
elif smp.Info.sample.type.lower() == "standard":
|
|
306
|
+
v, sv = smp.TotalParam[59:61]
|
|
307
|
+
smp.NormalizeFactor = [
|
|
308
|
+
[1 if v[0] == each or not doNormalize else v[0] / each for each in v],
|
|
309
|
+
[0 if v[0] == v[i] or not doNormalize else err.div((v[0], sv[0]), (v[i], sv[i])) for i in range(len(v))]
|
|
310
|
+
]
|
|
294
311
|
return smp
|
|
295
312
|
|
|
296
313
|
|
ararpy/smp/plots.py
CHANGED
|
@@ -405,6 +405,9 @@ def recalc_age_plateaus(sample: Sample, **kwargs):
|
|
|
405
405
|
-------
|
|
406
406
|
None
|
|
407
407
|
"""
|
|
408
|
+
ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor)
|
|
409
|
+
ar40r, sar40r = sample.DegasValues[24:26]
|
|
410
|
+
ar40rar39k = calc.arr.div([ar40r, sar40r], [ar39k, sar39k])
|
|
408
411
|
params_initial_ratio = calc.arr.partial(sample.TotalParam, cols=list(range(115, 120)))
|
|
409
412
|
ratio_set1 = [[], []]
|
|
410
413
|
ratio_set2 = [[], []]
|
|
@@ -430,10 +433,12 @@ def recalc_age_plateaus(sample: Sample, **kwargs):
|
|
|
430
433
|
ratio_set2[0].append(298.56)
|
|
431
434
|
ratio_set2[1].append(0.31)
|
|
432
435
|
|
|
433
|
-
#
|
|
436
|
+
# Weighted mean ages of two sets with the given initial ratios
|
|
434
437
|
try:
|
|
435
|
-
set1_res, set1_age, set1_data =
|
|
436
|
-
|
|
438
|
+
set1_res, set1_age, set1_data = get_plateau_results(
|
|
439
|
+
sample, sample.SelectedSequence1, calc_ar40ar39(*ratio_set1, smp=sample),
|
|
440
|
+
ar39k_percentage=np.cumsum(ar39k) / np.sum(ar39k),
|
|
441
|
+
**kwargs)
|
|
437
442
|
except ValueError:
|
|
438
443
|
# print(traceback.format_exc())
|
|
439
444
|
pass
|
|
@@ -443,8 +448,10 @@ def recalc_age_plateaus(sample: Sample, **kwargs):
|
|
|
443
448
|
sample.AgeSpectraPlot.set1.data = calc.arr.transpose(set1_data)
|
|
444
449
|
sample.AgeSpectraPlot.text1.text = "" # 注意和js的配合,js那边根据text是否为空判断是否重新生成文字
|
|
445
450
|
try:
|
|
446
|
-
set2_res, set2_age, set2_data =
|
|
447
|
-
|
|
451
|
+
set2_res, set2_age, set2_data = get_plateau_results(
|
|
452
|
+
sample, sample.SelectedSequence2, calc_ar40ar39(*ratio_set2, smp=sample),
|
|
453
|
+
ar39k_percentage=np.cumsum(ar39k) / np.sum(ar39k),
|
|
454
|
+
**kwargs)
|
|
448
455
|
except ValueError:
|
|
449
456
|
# print(traceback.format_exc())
|
|
450
457
|
pass
|
|
@@ -454,16 +461,18 @@ def recalc_age_plateaus(sample: Sample, **kwargs):
|
|
|
454
461
|
sample.AgeSpectraPlot.set2.data = calc.arr.transpose(set2_data)
|
|
455
462
|
sample.AgeSpectraPlot.text2.text = "" # 注意和js的配合,js那边根据text是否为空判断是否重新生成文字
|
|
456
463
|
|
|
457
|
-
#
|
|
464
|
+
# Weighted mean ages of two sets with 298.56 (defoult air ratio)
|
|
458
465
|
try:
|
|
459
|
-
set1_res = get_wma_results(
|
|
466
|
+
set1_res = get_wma_results(
|
|
467
|
+
sample, sample.SelectedSequence1, ar40rar39k=ar40rar39k, ar39k_percentage=np.cumsum(ar39k) / np.sum(ar39k))
|
|
460
468
|
except ValueError:
|
|
461
469
|
pass
|
|
462
470
|
# raise ValueError(f"Set 1 WMA calculation error.")
|
|
463
471
|
else:
|
|
464
472
|
sample.Info.results.age_spectra.update({0: set1_res})
|
|
465
473
|
try:
|
|
466
|
-
set2_res = get_wma_results(
|
|
474
|
+
set2_res = get_wma_results(
|
|
475
|
+
sample, sample.SelectedSequence2, ar40rar39k=ar40rar39k, ar39k_percentage=np.cumsum(ar39k) / np.sum(ar39k))
|
|
467
476
|
except ValueError:
|
|
468
477
|
pass
|
|
469
478
|
# raise ValueError(f"Set 2 WMA calculation error.")
|
|
@@ -558,7 +567,7 @@ def calc_ar40ar39(r, sr, smp):
|
|
|
558
567
|
"""
|
|
559
568
|
try:
|
|
560
569
|
ar36a = np.array(smp.DegasValues[0:2])
|
|
561
|
-
ar39k = smp.DegasValues[20:22]
|
|
570
|
+
ar39k = calc.arr.mul(smp.DegasValues[20:22], smp.NormalizeFactor)
|
|
562
571
|
ar40 = smp.CorrectedValues[8:10]
|
|
563
572
|
ar40k = smp.DegasValues[30:32]
|
|
564
573
|
size = ar36a.shape[-1]
|
|
@@ -568,8 +577,6 @@ def calc_ar40ar39(r, sr, smp):
|
|
|
568
577
|
ratio = np.array([r, sr])
|
|
569
578
|
else:
|
|
570
579
|
raise ValueError(f"Initial ratio is unsupported.")
|
|
571
|
-
# print(f"{ratio = }")
|
|
572
|
-
# print(f"{ar36a = }")
|
|
573
580
|
ar40a = calc.arr.mul(ar36a, ratio)
|
|
574
581
|
ar40r = calc.arr.sub(ar40, ar40k, ar40a)
|
|
575
582
|
ar40rar39k: list = calc.arr.div(ar40r, ar39k)
|
|
@@ -627,13 +634,15 @@ def get_plateau_results(sample: Sample, sequence: list, ar40rar39k: list = None,
|
|
|
627
634
|
return plateau_res, age, plot_data
|
|
628
635
|
|
|
629
636
|
|
|
630
|
-
def get_wma_results(sample: Sample, sequence: list):
|
|
637
|
+
def get_wma_results(sample: Sample, sequence: list, ar40rar39k: list = None, ar39k_percentage: list = None):
|
|
631
638
|
"""
|
|
632
639
|
Get initial ratio re-corrected plateau results
|
|
633
640
|
Parameters
|
|
634
641
|
----------
|
|
635
642
|
sample : sample instance
|
|
636
643
|
sequence : data slice index
|
|
644
|
+
ar40rar39k :
|
|
645
|
+
ar39k_percentage :
|
|
637
646
|
|
|
638
647
|
Returns
|
|
639
648
|
-------
|
|
@@ -642,6 +651,11 @@ def get_wma_results(sample: Sample, sequence: list):
|
|
|
642
651
|
'age', 's1', 's2', 's3', 'Ar39', 'rs'
|
|
643
652
|
]
|
|
644
653
|
"""
|
|
654
|
+
if ar40rar39k is None:
|
|
655
|
+
ar40rar39k = sample.ApparentAgeValues[0:2]
|
|
656
|
+
if ar39k_percentage is None:
|
|
657
|
+
ar39k_percentage = sample.ApparentAgeValues[7]
|
|
658
|
+
|
|
645
659
|
spectra_res = initial.SPECTRA_RES.copy()
|
|
646
660
|
# spectra_res = initial.SPECTRA_RES
|
|
647
661
|
|
|
@@ -649,9 +663,9 @@ def get_wma_results(sample: Sample, sequence: list):
|
|
|
649
663
|
return [arg[min(points): max(points) + 1] for arg in args]
|
|
650
664
|
|
|
651
665
|
if len(sequence) > 0:
|
|
652
|
-
sum_ar39k = sum(_get_partial(sequence,
|
|
653
|
-
fs = _get_partial(sequence,
|
|
654
|
-
sfs = _get_partial(sequence,
|
|
666
|
+
sum_ar39k = sum(_get_partial(sequence, ar39k_percentage)[0])
|
|
667
|
+
fs = _get_partial(sequence, ar40rar39k[0])[0]
|
|
668
|
+
sfs = _get_partial(sequence, ar40rar39k[1])[0]
|
|
655
669
|
|
|
656
670
|
wmf, swmf, num, mswd, chisq, p = calc.arr.wtd_mean(fs, sfs)
|
|
657
671
|
age, s1, s2, s3 = basic.calc_age([wmf, swmf], smp=sample)
|
ararpy/smp/sample.py
CHANGED
|
@@ -108,16 +108,16 @@ TOTAL_PARAMS_HEADERS = [
|
|
|
108
108
|
'Decay Activity \u2074\u2070K(\u03B2<sup>-</sup>)', '%1\u03C3', # 54-55
|
|
109
109
|
'Decay Activity \u2074\u2070K(\u03B2<sup>+</sup>)', '%1\u03C3', # 56-57
|
|
110
110
|
'\u00B3\u2076Cl/\u00B3\u2078Cl Productivity', '%1\u03C3', # 58-59
|
|
111
|
-
'Std Name', 'Std Age', '1\u03C3', '\u2074\u2070Ar%', '1\u03C3', 'K%', '1\u03C3',
|
|
112
|
-
'\u2074\u2070Ar<sup>*</sup>/K', '1\u03C3', #
|
|
111
|
+
'Std Name', 'Std Age', '1\u03C3', '\u2074\u2070Ar%', '1\u03C3', 'K%', '1\u03C3', # 60-66
|
|
112
|
+
'\u2074\u2070Ar<sup>*</sup>/K', '1\u03C3', # 67-68
|
|
113
113
|
'J', '%1\u03C3', 'MDF', '%1\u03C3', # 69-72
|
|
114
|
-
'Mass \u00B3\u2076Ar', '%1\u03C3', 'Mass \u00B3\u2077Ar', '%1\u03C3',
|
|
115
|
-
'Mass \u00B3\u2078Ar', '%1\u03C3', 'Mass \u00B3\u2079Ar', '%1\u03C3',
|
|
116
|
-
'Mass \u2074\u2070', '%1\u03C3', 'K Mass', '%1\u03C3', #
|
|
114
|
+
'Mass \u00B3\u2076Ar', '%1\u03C3', 'Mass \u00B3\u2077Ar', '%1\u03C3', # 73-76
|
|
115
|
+
'Mass \u00B3\u2078Ar', '%1\u03C3', 'Mass \u00B3\u2079Ar', '%1\u03C3', # 77-80
|
|
116
|
+
'Mass \u2074\u2070', '%1\u03C3', 'K Mass', '%1\u03C3', # 81-84
|
|
117
117
|
'No', '%1\u03C3', 'Year', '%1\u03C3', '\u2074\u2070K/K', '%1\u03C3',
|
|
118
|
-
'\u00B3\
|
|
119
|
-
'\u2074\u2070Ar/\u00B3\u2076Ar air', '%1\u03C3',
|
|
120
|
-
'\u00B3\u2078Ar/\u00B3\u2076Ar air', '%1\u03C3', #
|
|
118
|
+
'\u00B3\u2075Cl/\u00B3\u2077Cl', '%1\u03C3', 'HCl/Cl', '%1\u03C3', # 85-94
|
|
119
|
+
'\u2074\u2070Ar/\u00B3\u2076Ar air', '%1\u03C3', # 95-96
|
|
120
|
+
'\u00B3\u2078Ar/\u00B3\u2076Ar air', '%1\u03C3', # 97-98
|
|
121
121
|
'Isochron Fitting', 'Convergence', 'Iteration', 'Discrimination', # 99-102
|
|
122
122
|
'Not Zero', 'Corr Blank', 'Corr Discr', 'Corr \u00B3\u2077Ar Decay', # 103-106
|
|
123
123
|
'Corr \u00B3\u2079Ar Decay', # 107
|
|
@@ -743,7 +743,7 @@ DEFAULT_PLOT_STYLES = {
|
|
|
743
743
|
},
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
VERSION = '
|
|
746
|
+
VERSION = '20250404'
|
|
747
747
|
|
|
748
748
|
NAMED_DICT = {
|
|
749
749
|
"unknown": {"header": SAMPLE_INTERCEPT_HEADERS.copy()},
|
|
@@ -812,6 +812,7 @@ class Sample:
|
|
|
812
812
|
self.SelectedSequence2 = []
|
|
813
813
|
self.UnselectedSequence = []
|
|
814
814
|
self.IsochronMark = []
|
|
815
|
+
self.NormalizeFactor = [[], []]
|
|
815
816
|
|
|
816
817
|
# Tables and Plots
|
|
817
818
|
self.UnknownTable = Table()
|
|
@@ -849,7 +850,8 @@ class Sample:
|
|
|
849
850
|
# self.__version = '20250102' # gain correction to blanks
|
|
850
851
|
# self.__version = '20250301' # update sample info
|
|
851
852
|
# self.__version = '20250321' # error sigma adjustment
|
|
852
|
-
self.__version = '20250328' # Experiment info
|
|
853
|
+
# self.__version = '20250328' # Experiment info
|
|
854
|
+
self.__version = '20250404' # J normalization factor
|
|
853
855
|
|
|
854
856
|
@property
|
|
855
857
|
def version(self):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
ararpy/__init__.py,sha256=
|
|
1
|
+
ararpy/__init__.py,sha256=KuOq5AHFop6-vXAxzRPNdbs-J0E6SewFZQsVVh9ICtM,6858
|
|
2
2
|
ararpy/test.py,sha256=4F46-JJ1Ge12HGae0qO44Qc6kiEMHBgn2MsY_5LlHDo,3973
|
|
3
3
|
ararpy/calc/__init__.py,sha256=kUjRuLE8TLuKOv3i976RnGJoEMj23QBZDu37LWs81U4,322
|
|
4
|
-
ararpy/calc/age.py,sha256=
|
|
5
|
-
ararpy/calc/arr.py,sha256=
|
|
4
|
+
ararpy/calc/age.py,sha256=OcStt55LoYW1brs7a5_Ovv1NUSR5uZVQHDVGGmA_Pqg,5784
|
|
5
|
+
ararpy/calc/arr.py,sha256=fe_nCo5zjD8HK9jNIsKXmsRKZ73GMipKK7dogVk5Ubk,15152
|
|
6
6
|
ararpy/calc/basic.py,sha256=uJCCUFaPd9zvfkggrdbFYSGLl2pt7UJ7ENgXanzHy68,4036
|
|
7
|
-
ararpy/calc/corr.py,sha256=
|
|
7
|
+
ararpy/calc/corr.py,sha256=Ps_AYgHSYjJNfb1PgPoYBa5eGc6eT9KLIiIiP0Q81as,18725
|
|
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
|
|
@@ -44,23 +44,23 @@ ararpy/smp/__init__.py,sha256=k6_fa27UJsQK7K7oC5GYlwMo6l0Xd8af3QtOrZz2XJk,478
|
|
|
44
44
|
ararpy/smp/basic.py,sha256=k9Vk_LP6P9HO68gMvPQ-adkvaVXEobg1FY-rF5YG7HQ,22588
|
|
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=ZS9hlRkBYhtuyT7HovEYIjBWBTLkHqJuQzT0vN4GNwg,26503
|
|
48
48
|
ararpy/smp/diffusion_funcs.py,sha256=4-PMMIZWzjk2HOYYWNgSp4GmApygp1MmOxJ2g3xrqWc,175049
|
|
49
49
|
ararpy/smp/export.py,sha256=s89L5B1aHoCeJIjcw6nXA6NtV0j_5XXaWnOETWnomCs,115043
|
|
50
50
|
ararpy/smp/info.py,sha256=iKUELm-BuUduDlJKC1d8tKKNHbwwbNmhUg2pi6bcBvA,489
|
|
51
|
-
ararpy/smp/initial.py,sha256=
|
|
51
|
+
ararpy/smp/initial.py,sha256=M1B5ytLAMzdU1IZ5mQMHFi1t4tx7FNj7fVhqM1AKntc,16929
|
|
52
52
|
ararpy/smp/json.py,sha256=BTZCjVN0aj9epc700nwkYEYMKN2lHBYo-pLmtnz5oHY,2300
|
|
53
|
-
ararpy/smp/plots.py,sha256=
|
|
53
|
+
ararpy/smp/plots.py,sha256=mF2ORen2KcPMkWkq-98-2QocmCeA2oJrwT6V_-4cAlE,32495
|
|
54
54
|
ararpy/smp/raw.py,sha256=51n-rrbW2FqeZHQyevuG7iObPLGvIBzTe414QDVM1FE,6523
|
|
55
|
-
ararpy/smp/sample.py,sha256=
|
|
55
|
+
ararpy/smp/sample.py,sha256=rDaTPHnd0-jMZ1YA-stjc9ghi9OrNyDCULjivKTPMew,55997
|
|
56
56
|
ararpy/smp/style.py,sha256=Z4exOAdtvw5xwDf6nyIjPxuvww2U5JK6H_Ql02DBSyM,7030
|
|
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.
|
|
63
|
-
ararpy-0.1.
|
|
64
|
-
ararpy-0.1.
|
|
65
|
-
ararpy-0.1.
|
|
66
|
-
ararpy-0.1.
|
|
62
|
+
ararpy-0.1.198.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
|
|
63
|
+
ararpy-0.1.198.dist-info/METADATA,sha256=qPS0ttNBqLL1fwXj0pBm6xgUWwf_liMLIuw5Y_25zQE,24517
|
|
64
|
+
ararpy-0.1.198.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
65
|
+
ararpy-0.1.198.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
|
|
66
|
+
ararpy-0.1.198.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|