ararpy 0.1.30__py3-none-any.whl → 0.1.33__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/Example - Check arr.py +52 -0
- ararpy/Example - Granite Cooling History.py +411 -0
- ararpy/Example - Plot temperature calibration.py +291 -0
- ararpy/Example - Show MDD results.py +561 -0
- ararpy/Example - Show all Kfs age spectra.py +344 -0
- ararpy/Example - Show random walk results.py +363 -0
- ararpy/Example - Tc calculation.py +437 -0
- ararpy/__init__.py +2 -2
- ararpy/calc/raw_funcs.py +2 -2
- ararpy/calc/regression.py +3 -3
- ararpy/files/arr_file.py +2 -1
- ararpy/files/basic.py +1 -1
- ararpy/files/raw_file.py +16 -13
- ararpy/smp/corr.py +10 -10
- ararpy/smp/diffusion_funcs.py +344 -35
- ararpy/smp/export.py +140 -61
- ararpy/smp/initial.py +18 -15
- ararpy/smp/plots.py +4 -4
- ararpy/smp/sample.py +41 -26
- ararpy/smp/style.py +2 -0
- ararpy/smp/table.py +26 -24
- ararpy/thermo/atomic_level_random_walk.py +56 -48
- ararpy/thermo/basic.py +2 -2
- {ararpy-0.1.30.dist-info → ararpy-0.1.33.dist-info}/METADATA +1 -1
- {ararpy-0.1.30.dist-info → ararpy-0.1.33.dist-info}/RECORD +28 -21
- {ararpy-0.1.30.dist-info → ararpy-0.1.33.dist-info}/WHEEL +0 -0
- {ararpy-0.1.30.dist-info → ararpy-0.1.33.dist-info}/licenses/LICENSE +0 -0
- {ararpy-0.1.30.dist-info → ararpy-0.1.33.dist-info}/top_level.txt +0 -0
ararpy/smp/export.py
CHANGED
|
@@ -23,15 +23,22 @@ from math import log
|
|
|
23
23
|
from decimal import Decimal
|
|
24
24
|
|
|
25
25
|
from ..calc import arr, isochron, spectra, err
|
|
26
|
-
from ..calc.basic import get_random_digits
|
|
26
|
+
from ..calc.basic import get_random_digits, merge_dicts
|
|
27
27
|
from ..calc.plot import get_axis_scale
|
|
28
28
|
from . import basic, sample, consts
|
|
29
29
|
|
|
30
30
|
Sample = sample.Sample
|
|
31
31
|
Plot = sample.Plot
|
|
32
32
|
|
|
33
|
-
title_size =
|
|
34
|
-
label_size =
|
|
33
|
+
title_size = 8
|
|
34
|
+
label_size = 8
|
|
35
|
+
|
|
36
|
+
colors_map = {
|
|
37
|
+
'red': "#EF661B",
|
|
38
|
+
'blue': "#189CCA",
|
|
39
|
+
'red80': "#FFB593",
|
|
40
|
+
'blue80': "#6BD2FF",
|
|
41
|
+
}
|
|
35
42
|
|
|
36
43
|
try:
|
|
37
44
|
from webarar.settings import SETTINGS_ROOT
|
|
@@ -54,8 +61,12 @@ def get_cv_from_dict(data: dict, **kwargs):
|
|
|
54
61
|
cv = pm.Canvas(width=kwargs.get("width", 17), height=kwargs.get("height", 12),
|
|
55
62
|
unit="cm", show_frame=False, clip_outside_plot_areas=False)
|
|
56
63
|
# change frame outline style
|
|
57
|
-
if kwargs.get("show_frame",
|
|
64
|
+
if kwargs.get("show_frame", False):
|
|
58
65
|
cv.show_frame(color="grey", line_width=0.5)
|
|
66
|
+
# stick length
|
|
67
|
+
stick_length = kwargs.get("stick_length", 3)
|
|
68
|
+
ylabel_offset = kwargs.get("ylabel_offset", 2)
|
|
69
|
+
xlabel_offset = kwargs.get("xlabel_offset", 8)
|
|
59
70
|
axis_num = min([len(data['xAxis']), len(data['yAxis'])])
|
|
60
71
|
# draw axis
|
|
61
72
|
plots = []
|
|
@@ -68,24 +79,24 @@ def get_cv_from_dict(data: dict, **kwargs):
|
|
|
68
79
|
for stick in data['xAxis'][i]['interval']:
|
|
69
80
|
start = pt.scale_to_points(float(stick), scale[2])
|
|
70
81
|
end = pt.scale_to_points(float(stick), scale[2])
|
|
71
|
-
end = (end[0], end[1] -
|
|
72
|
-
if pt.line(start=start, end=end, width=data['xAxis'][i]
|
|
73
|
-
pt.text(x=start[0], y=end[1] -
|
|
82
|
+
end = (end[0], end[1] - stick_length)
|
|
83
|
+
if pt.line(start=start, end=end, width=data['xAxis'][i].get('line_width', 1), line_style="solid", y_clip=False, coordinate="pt", z_index=100):
|
|
84
|
+
pt.text(x=start[0], y=end[1] - xlabel_offset, text=f"{stick}", clip=False, size=int(data['xAxis'][i].get('label_size', 8)),
|
|
74
85
|
coordinate="pt", h_align="middle", z_index=150)
|
|
75
86
|
for stick in data['yAxis'][i]['interval']:
|
|
76
87
|
start = pt.scale_to_points(scale[0], float(stick))
|
|
77
88
|
end = pt.scale_to_points(scale[0], float(stick))
|
|
78
|
-
end = (end[0] -
|
|
79
|
-
if pt.line(start=start, end=end, width=data['xAxis'][i]
|
|
80
|
-
pt.text(x=end[0] -
|
|
89
|
+
end = (end[0] - stick_length, end[1])
|
|
90
|
+
if pt.line(start=start, end=end, width=data['xAxis'][i].get('line_width', 1), line_style="solid", x_clip=False, coordinate="pt", z_index=100):
|
|
91
|
+
pt.text(x=end[0] - ylabel_offset, y=end[1], text=f"{stick}", clip=False, size=int(data['yAxis'][i].get('label_size', 8)),
|
|
81
92
|
coordinate="pt", h_align="right", v_align="center", z_index=150)
|
|
82
93
|
# axis titles
|
|
83
94
|
nloc = pt.scale_to_points(sum(scale[:2]) / 2, scale[2])
|
|
84
|
-
pt.text(x=nloc[0], y=nloc[1] - kwargs.get("offset_bottom", 30), text=data['xAxis'][i]
|
|
85
|
-
h_align="middle", v_align="center", z_index=150, size=int(data['xAxis'][i]
|
|
95
|
+
pt.text(x=nloc[0], y=nloc[1] - kwargs.get("offset_bottom", 30), text=data['xAxis'][i].get('title', 'title'), clip=False, coordinate="pt",
|
|
96
|
+
h_align="middle", v_align="center", z_index=150, size=int(data['xAxis'][i].get('title_size', 8)))
|
|
86
97
|
nloc = pt.scale_to_points(scale[0], sum(scale[2:4]) / 2)
|
|
87
|
-
pt.text(x=nloc[0] - kwargs.get("offset_left", 50), y=nloc[1], text=data['yAxis'][i]
|
|
88
|
-
h_align="middle", v_align="center", rotate=90, z_index=150, size=int(data['yAxis'][i]
|
|
98
|
+
pt.text(x=nloc[0] - kwargs.get("offset_left", 50), y=nloc[1], text=data['yAxis'][i].get('title', 'title'), clip=False, coordinate="pt",
|
|
99
|
+
h_align="middle", v_align="center", rotate=90, z_index=150, size=int(data['yAxis'][i].get('title_size', 8)))
|
|
89
100
|
plots.append(pt)
|
|
90
101
|
# draw series
|
|
91
102
|
for se in data['series']:
|
|
@@ -103,20 +114,23 @@ def get_cv_from_dict(data: dict, **kwargs):
|
|
|
103
114
|
except IndexError:
|
|
104
115
|
continue
|
|
105
116
|
if 'line' in se['type']:
|
|
117
|
+
se['width'] = se.get('line_width', 1)
|
|
118
|
+
se['line_style'] = se.get('line_style', 'solid')
|
|
119
|
+
se['color'] = se.get('color', 'black')
|
|
120
|
+
se['line_caps'] = se.get('line_caps', 'none')
|
|
121
|
+
se['z_index'] = int(se.get('z_index', 9))
|
|
106
122
|
for index in range(1, len(data)):
|
|
107
|
-
pt.line(
|
|
108
|
-
start=data[index - 1], end=data[index], width=se.get('line_width', 1),
|
|
109
|
-
line_style=se.get('line_style', 'solid'), name=se['name'],
|
|
110
|
-
color=se.get('color', 'black'), clip=True, line_caps=se.get('line_caps', 'none'),
|
|
111
|
-
z_index=int(se.get('z_index', 9)))
|
|
123
|
+
pt.line(start=data[index - 1], end=data[index], **se)
|
|
112
124
|
if 'scatter' in se['type'] and se['name'] != 'Text':
|
|
125
|
+
se['fill_color'] = se.get('fill_color', 'black')
|
|
126
|
+
se['size'] = se.get('size', 5)
|
|
127
|
+
se['stroke_color'] = se.get('stroke_color', se.get('color', 'black'))
|
|
128
|
+
se['z_index'] = int(se.get('z_index', 9))
|
|
129
|
+
se['marker'] = se.get('marker', 'rec')
|
|
113
130
|
for each in data:
|
|
114
|
-
pt.scatter(
|
|
115
|
-
each[0], each[1], fill_color=se.get('fill_color', 'black'), size=se.get('size', 5),
|
|
116
|
-
stroke_color=se.get('stroke_color', se.get('color', 'black')),
|
|
117
|
-
z_index=int(se.get('z_index', 9))
|
|
118
|
-
)
|
|
131
|
+
pt.scatter(each[0], each[1], **se)
|
|
119
132
|
if 'scatter' in se['type'] and se['name'] == 'Text' or 'text' in se['type']:
|
|
133
|
+
se.update({'size': 10})
|
|
120
134
|
for each in data:
|
|
121
135
|
pt.text(*each[:2], **se)
|
|
122
136
|
if 'rect' in se['type']:
|
|
@@ -207,7 +221,7 @@ def export_chart_to_pdf(cvs, file_name: str = "", file_path: str = "", **kwargs)
|
|
|
207
221
|
top = 20 + cv_index // num_cols * cv.height()
|
|
208
222
|
if show_label:
|
|
209
223
|
cv._plot_areas[1].text(
|
|
210
|
-
x=5, y=95, text=f"({get_label(num=cv_index)})",
|
|
224
|
+
x=5, y=95, text=f"({str(get_label(num=cv_index)).lower()})",
|
|
211
225
|
id=f'text-label-{page_index}-{cv_index}',
|
|
212
226
|
name=f'text-label-{page_index}-{cv_index}',
|
|
213
227
|
color='black', size=title_size, axis_index=1, h_align='middle', v_align='center'
|
|
@@ -330,24 +344,18 @@ def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
|
330
344
|
xAxis = options.get('xAxis', [{}])
|
|
331
345
|
yAxis = options.get('yAxis', [{}])
|
|
332
346
|
line_width = options.get('line_width', 1)
|
|
333
|
-
line_caps = options.get('line_caps', '
|
|
347
|
+
line_caps = options.get('line_caps', 'none')
|
|
334
348
|
series = []
|
|
335
349
|
# apparent spectra lines
|
|
336
350
|
age = smp.ApparentAgeValues[2:4]
|
|
337
351
|
ar = smp.DegasValues[20]
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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',
|
|
345
|
-
'axis_index': 0,
|
|
346
|
-
})
|
|
352
|
+
x, y1, y2 = spectra.get_data(*age, ar, cumulative=False, sigma=sigma)
|
|
353
|
+
X = x + list(reversed(x))
|
|
354
|
+
Y = y1 + list(reversed(y2))
|
|
347
355
|
series.append({
|
|
348
356
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}', 'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
349
357
|
'color': color, 'fill_color': color, 'line_width': line_width, 'line_style': 'solid', 'z_index': 19,
|
|
350
|
-
'data': np.transpose([
|
|
358
|
+
'data': np.transpose([X, Y]).tolist(),
|
|
351
359
|
'line_caps': line_caps,
|
|
352
360
|
# 'line_caps': 'none',
|
|
353
361
|
'axis_index': 0,
|
|
@@ -366,34 +374,38 @@ def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
|
366
374
|
spectra_fill_data = getRectFromSpectra(plateau_data)
|
|
367
375
|
series.append({
|
|
368
376
|
'type': 'series.rect', 'id': f'rect-{smp.name()}-{get_random_digits()}', 'name': f'rect-{smp.name()}-{get_random_digits()}',
|
|
369
|
-
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index],
|
|
377
|
+
'color': [colors_map['red'], colors_map['blue']][index], 'fill_color': [colors_map['red'], colors_map['blue']][index], 'line_style': 'none', 'z_index': 9,
|
|
370
378
|
'data': spectra_fill_data, 'line_caps': 'none', 'fill': True,
|
|
371
379
|
'axis_index': 0,
|
|
372
380
|
})
|
|
381
|
+
x, y1, y2 = np.transpose(plateau_data).tolist()[:3]
|
|
382
|
+
X = x + list(reversed(x))
|
|
383
|
+
Y = y1 + list(reversed(y2))
|
|
373
384
|
series.append({
|
|
374
385
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
375
386
|
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
376
|
-
'color': ['red', 'blue'][index], 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
377
|
-
'data':
|
|
387
|
+
'color': [colors_map['red'], colors_map['blue']][index], 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
388
|
+
'data': np.transpose([X, Y]).tolist(),
|
|
378
389
|
'line_caps': line_caps,
|
|
379
390
|
# 'line_caps': 'none',
|
|
380
391
|
'axis_index': 0,
|
|
381
392
|
})
|
|
393
|
+
# plateau line
|
|
382
394
|
series.append({
|
|
383
395
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
384
396
|
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
385
|
-
'color':
|
|
386
|
-
'data':
|
|
397
|
+
'color': '#A9A9A9', 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
398
|
+
'data': [[0, res['age']], [100, res['age']]],
|
|
387
399
|
'line_caps': line_caps,
|
|
388
400
|
# 'line_caps': 'none',
|
|
389
401
|
'axis_index': 0,
|
|
390
402
|
})
|
|
391
403
|
series.append({
|
|
392
404
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
393
|
-
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index],
|
|
394
|
-
'text': f"
|
|
405
|
+
'color': [colors_map['red'], colors_map['blue']][index], 'fill_color': [colors_map['red'], colors_map['blue']][index],
|
|
406
|
+
'text': f"Corrected = {res['age']:.2f} ± {(sigma * res['s2']):.2f} {unit} ({sigma}s)<r>"
|
|
395
407
|
f"MSWD = {res['MSWD']:.2f}, n = {res['Num']:.0f}<r>"
|
|
396
|
-
f"<sup>39</sup>Ar = {res['Ar39']
|
|
408
|
+
f"<sup>39</sup>Ar = {res['Ar39']:.2f}%",
|
|
397
409
|
'size': title_size,
|
|
398
410
|
# 'data': [text.pos],
|
|
399
411
|
'data': [[50, 50]],
|
|
@@ -401,19 +413,87 @@ def _get_plot_data_age_spectra_series(smp: sample, **options):
|
|
|
401
413
|
'h_align': "middle",
|
|
402
414
|
'v_align': "center",
|
|
403
415
|
})
|
|
416
|
+
spe = smp.Info.results.age_spectra[index]
|
|
417
|
+
if not np.isnan(res['age']):
|
|
418
|
+
series.append({
|
|
419
|
+
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}',
|
|
420
|
+
'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
421
|
+
'color': color, 'fill_color': color,
|
|
422
|
+
'text': f"WMPA = {spe['age']:.2f} ± {(sigma * spe['s2']):.2f} {unit} ({sigma}s)",
|
|
423
|
+
'size': title_size,
|
|
424
|
+
'data': [[50, 10+10*index]],
|
|
425
|
+
'axis_index': 1,
|
|
426
|
+
'h_align': "middle",
|
|
427
|
+
'v_align': "bottom",
|
|
428
|
+
})
|
|
429
|
+
|
|
404
430
|
# TGA
|
|
405
431
|
tga = smp.Info.results.age_spectra['TGA']
|
|
406
432
|
if not np.isnan(tga['age']):
|
|
407
433
|
series.append({
|
|
408
434
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
409
435
|
'color': color, 'fill_color': color,
|
|
410
|
-
'text': f"TGA = {tga['age']:.2f} ± {(sigma * tga['
|
|
436
|
+
'text': f"TGA = {tga['age']:.2f} ± {(sigma * tga['s2']):.2f} {unit} ({sigma}s)",
|
|
411
437
|
'size': title_size,
|
|
412
438
|
'data': [[50, 3]],
|
|
413
439
|
'axis_index': 1,
|
|
414
440
|
'h_align': "middle",
|
|
415
441
|
'v_align': "bottom",
|
|
416
442
|
})
|
|
443
|
+
# Max
|
|
444
|
+
age = np.array(smp.ApparentAgeValues[2:8]).transpose()
|
|
445
|
+
age = np.where(age is None, np.nan, age)
|
|
446
|
+
valid_mask = np.isfinite(age[:, 0])
|
|
447
|
+
age = age[valid_mask]
|
|
448
|
+
age = age[age[:, 5] >= 0.1]
|
|
449
|
+
try:
|
|
450
|
+
max_index = np.argmax(age[20:, 0]) + 20
|
|
451
|
+
except ValueError:
|
|
452
|
+
max_index = np.argmax(age[10:, 0]) + 10
|
|
453
|
+
min_index = np.argmin(age[:20, 0])
|
|
454
|
+
# print(f"{max_index = }")
|
|
455
|
+
# print(f"{min_index = }")
|
|
456
|
+
|
|
457
|
+
series.append({
|
|
458
|
+
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
459
|
+
'color': color, 'fill_color': color,
|
|
460
|
+
'text': f"Max. = {age[max_index, 0]:.2f} ± {(sigma * age[max_index, 2]):.2f} {unit}",
|
|
461
|
+
'size': title_size,
|
|
462
|
+
'data': [[50, 70]],
|
|
463
|
+
'axis_index': 1,
|
|
464
|
+
'h_align': "middle",
|
|
465
|
+
'v_align': "bottom",
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
series.append({
|
|
469
|
+
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
470
|
+
'color': color, 'fill_color': color,
|
|
471
|
+
'text': f"Min. = {age[min_index, 0]:.2f} ± {(sigma * age[min_index, 2]):.2f} {unit}",
|
|
472
|
+
'size': title_size,
|
|
473
|
+
'data': [[50, 75]],
|
|
474
|
+
'axis_index': 1,
|
|
475
|
+
'h_align': "middle",
|
|
476
|
+
'v_align': "bottom",
|
|
477
|
+
})
|
|
478
|
+
|
|
479
|
+
series.append({
|
|
480
|
+
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
481
|
+
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
482
|
+
'color': '#A9A9A9', 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
483
|
+
'data': [[0, age[max_index, 0]], [100, age[max_index, 0]]],
|
|
484
|
+
'line_caps': line_caps,
|
|
485
|
+
# 'line_caps': 'none',
|
|
486
|
+
'axis_index': 0,
|
|
487
|
+
})
|
|
488
|
+
series.append({
|
|
489
|
+
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}',
|
|
490
|
+
'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
491
|
+
'color': '#A9A9A9', 'line_width': line_width, 'line_style': 'solid', 'z_index': 9,
|
|
492
|
+
'data': [[0, age[min_index, 0]], [100, age[min_index, 0]]],
|
|
493
|
+
'line_caps': line_caps,
|
|
494
|
+
# 'line_caps': 'none',
|
|
495
|
+
'axis_index': 0,
|
|
496
|
+
})
|
|
417
497
|
# title
|
|
418
498
|
series.append({
|
|
419
499
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}',
|
|
@@ -531,9 +611,10 @@ def _get_plot_data_inv_isochron_axis(smp: sample, **options):
|
|
|
531
611
|
|
|
532
612
|
def _get_plot_data_inv_isochron_series(smp: sample, **options):
|
|
533
613
|
color = options.get('color', 'black')
|
|
614
|
+
marker_size = options.get('marker_szie', 2)
|
|
534
615
|
xAxis = options.get('xAxis', [{}])
|
|
535
616
|
yAxis = options.get('yAxis', [{}])
|
|
536
|
-
sigma = options.get('sigma',
|
|
617
|
+
sigma = options.get('sigma', 2)
|
|
537
618
|
series = []
|
|
538
619
|
age = smp.ApparentAgeValues[2:4]
|
|
539
620
|
ar = smp.DegasValues[20]
|
|
@@ -544,21 +625,21 @@ def _get_plot_data_inv_isochron_series(smp: sample, **options):
|
|
|
544
625
|
# set 1
|
|
545
626
|
series.append({
|
|
546
627
|
'type': 'series.scatter', 'id': f'scatter-{smp.name()}-{get_random_digits()}', 'name': f'scatter-{smp.name()}-{get_random_digits()}',
|
|
547
|
-
'stroke_color': 'red', 'fill_color': '
|
|
628
|
+
'stroke_color': colors_map['red'], 'fill_color': colors_map['red80'], 'myType': 'scatter', 'size': marker_size, 'line_width': 0,
|
|
548
629
|
'data': (data[[0, 2], :][:, set1]).transpose().tolist(),
|
|
549
630
|
'axis_index': 0, 'z_index': 99
|
|
550
631
|
})
|
|
551
632
|
# set 2
|
|
552
633
|
series.append({
|
|
553
634
|
'type': 'series.scatter', 'id': f'scatter-{smp.name()}-{get_random_digits()}', 'name': f'scatter-{smp.name()}-{get_random_digits()}',
|
|
554
|
-
'stroke_color': 'blue', 'fill_color': '
|
|
635
|
+
'stroke_color': colors_map['blue'], 'fill_color': colors_map['blue80'], 'myType': 'scatter', 'size': marker_size, 'line_width': 0,
|
|
555
636
|
'data': (data[[0, 2], :][:, set2]).transpose().tolist(),
|
|
556
637
|
'axis_index': 0, 'z_index': 99
|
|
557
638
|
})
|
|
558
639
|
# set 3
|
|
559
640
|
series.append({
|
|
560
641
|
'type': 'series.scatter', 'id': f'scatter-{smp.name()}-{get_random_digits()}', 'name': f'scatter-{smp.name()}-{get_random_digits()}',
|
|
561
|
-
'stroke_color': 'black', 'fill_color': 'white', 'myType': 'scatter', 'size':
|
|
642
|
+
'stroke_color': 'black', 'fill_color': 'white', 'myType': 'scatter', 'size': marker_size, 'line_width': 0,
|
|
562
643
|
'data': (data[[0, 2], :][:, set3]).transpose().tolist(),
|
|
563
644
|
'axis_index': 0, 'z_index': 0
|
|
564
645
|
})
|
|
@@ -573,17 +654,17 @@ def _get_plot_data_inv_isochron_series(smp: sample, **options):
|
|
|
573
654
|
]
|
|
574
655
|
series.append({
|
|
575
656
|
'type': 'series.line', 'id': f'line-{smp.name()}-{get_random_digits()}', 'name': f'line-{smp.name()}-{get_random_digits()}',
|
|
576
|
-
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index],
|
|
577
|
-
'line_width': 1
|
|
657
|
+
'color': [colors_map['red'], colors_map['blue']][index], 'fill_color': [colors_map['red'], colors_map['blue']][index],
|
|
658
|
+
'line_width': 1, 'line_style': 'solid',
|
|
578
659
|
'data': isochron_data,
|
|
579
660
|
'axis_index': 0,
|
|
580
661
|
})
|
|
581
662
|
series.append({
|
|
582
663
|
'type': 'text', 'id': f'text-{smp.name()}-{get_random_digits()}', 'name': f'text-{smp.name()}-{get_random_digits()}',
|
|
583
|
-
'color': ['red', 'blue'][index], 'fill_color': ['red', 'blue'][index],
|
|
584
|
-
'text': f"IIA = {smp.Info.results.isochron['figure_3'][index]['age']:.2f} ± {(sigma * smp.Info.results.isochron['figure_3'][index]['
|
|
585
|
-
f"
|
|
586
|
-
f"MSWD = {smp.Info.results.isochron['figure_3'][index]['MSWD']:.2f}
|
|
664
|
+
'color': [colors_map['red'], colors_map['blue']][index], 'fill_color': [colors_map['red'], colors_map['blue']][index],
|
|
665
|
+
'text': f"IIA = {smp.Info.results.isochron['figure_3'][index]['age']:.2f} ± {(sigma * smp.Info.results.isochron['figure_3'][index]['s2']):.2f} Ma ({sigma}s)<r>"
|
|
666
|
+
f"(40Ar/36Ar)0 = {smp.Info.results.isochron['figure_3'][index]['initial']:.2f} ± {(sigma * smp.Info.results.isochron['figure_3'][index]['sinitial']):.2f}<r>"
|
|
667
|
+
f"MSWD = {smp.Info.results.isochron['figure_3'][index]['MSWD']:.2f}<r>",
|
|
587
668
|
'size': title_size,
|
|
588
669
|
'data': [text.pos],
|
|
589
670
|
'axis_index': 1,
|
|
@@ -1168,7 +1249,7 @@ class WritingWorkbook:
|
|
|
1168
1249
|
tga_res = self.sample.Info.results.age_spectra['TGA']
|
|
1169
1250
|
content.extend([
|
|
1170
1251
|
[(9 + num_step, 1, 10 + num_step, 1), tga_res['F'], {'num_format': '0.00000'}],
|
|
1171
|
-
[(9 + num_step, 2, 10 + num_step, 2), tga_res['sF'], {'num_format': '0.00000'}],
|
|
1252
|
+
[(9 + num_step, 2, 10 + num_step, 2), tga_res['sF'] * sigma, {'num_format': '0.00000'}],
|
|
1172
1253
|
[(9 + num_step, 3, 10 + num_step, 3), tga_res['age'], {'num_format': '0.00'}],
|
|
1173
1254
|
[(9 + num_step, 4), tga_res['s1'] * sigma, {'num_format': '± 0.00', 'align': 'left'}],
|
|
1174
1255
|
[(9 + num_step, 5), tga_res['s2'] * sigma, {'num_format': '± 0.00', 'align': 'left'}],
|
|
@@ -1878,7 +1959,7 @@ class CreatePDF:
|
|
|
1878
1959
|
yaxis_max = float(yaxis.max)
|
|
1879
1960
|
|
|
1880
1961
|
plot_scale = (xaxis_min, xaxis_max, yaxis_min, yaxis_max)
|
|
1881
|
-
colors = ['red', 'color']
|
|
1962
|
+
colors = [colors_map['red'], 'color']
|
|
1882
1963
|
|
|
1883
1964
|
# create a canvas
|
|
1884
1965
|
cv = pm.Canvas(width=17, height=12, unit="cm", show_frame=True, clip_outside_plot_areas=False)
|
|
@@ -2017,10 +2098,10 @@ class CreatePDF:
|
|
|
2017
2098
|
for index in range(len(data) - 1):
|
|
2018
2099
|
pt.line(start=(data[index][0], data[index][1]), end=(data[index + 1][0], data[index + 1][1]),
|
|
2019
2100
|
width=widths[0], line_style=styles[0], color=colors[0],
|
|
2020
|
-
clip=True, line_caps="
|
|
2101
|
+
clip=True, line_caps="none", z_index=9)
|
|
2021
2102
|
pt.line(start=(data[index][0], data[index][2]), end=(data[index + 1][0], data[index + 1][2]),
|
|
2022
2103
|
width=widths[1], line_style=styles[1], color=colors[1],
|
|
2023
|
-
clip=True, line_caps="
|
|
2104
|
+
clip=True, line_caps="none", z_index=9)
|
|
2024
2105
|
|
|
2025
2106
|
colors = [
|
|
2026
2107
|
[self.color_rgb_normalized(self.color_hex_to_rgb(plot.line3.color)),
|
|
@@ -2114,8 +2195,6 @@ class CreatePDF:
|
|
|
2114
2195
|
yaxis_max = float(yaxis.max)
|
|
2115
2196
|
plot_scale = (xaxis_min, xaxis_max, yaxis_min, yaxis_max)
|
|
2116
2197
|
|
|
2117
|
-
colors = ['red', 'color']
|
|
2118
|
-
|
|
2119
2198
|
# data
|
|
2120
2199
|
data = plot.data # 36a, 37ca, 38cl, 39k, 40r, 36, 37, 38, 39, 40
|
|
2121
2200
|
|
ararpy/smp/initial.py
CHANGED
|
@@ -123,14 +123,14 @@ def create_sample_from_dict(content: dict, smp_info: dict):
|
|
|
123
123
|
|
|
124
124
|
def initial(smp: Sample):
|
|
125
125
|
# 已更新 2023/7/4
|
|
126
|
-
smp.TotalParam = arr.create_arr((len(samples.TOTAL_PARAMS_HEADERS) -
|
|
127
|
-
smp.BlankIntercept = arr.create_arr((len(samples.BLANK_INTERCEPT_HEADERS) -
|
|
128
|
-
smp.SampleIntercept = arr.create_arr((len(samples.SAMPLE_INTERCEPT_HEADERS) -
|
|
129
|
-
smp.PublishValues = arr.create_arr((len(samples.PUBLISH_TABLE_HEADERS) -
|
|
126
|
+
smp.TotalParam = arr.create_arr((len(samples.TOTAL_PARAMS_HEADERS) - 3, 0))
|
|
127
|
+
smp.BlankIntercept = arr.create_arr((len(samples.BLANK_INTERCEPT_HEADERS) - 3, 0))
|
|
128
|
+
smp.SampleIntercept = arr.create_arr((len(samples.SAMPLE_INTERCEPT_HEADERS) - 3, 0))
|
|
129
|
+
smp.PublishValues = arr.create_arr((len(samples.PUBLISH_TABLE_HEADERS) - 3, 0))
|
|
130
130
|
smp.DecayCorrected = arr.create_arr((10, 0))
|
|
131
|
-
smp.CorrectedValues = arr.create_arr((len(samples.CORRECTED_HEADERS) -
|
|
132
|
-
smp.DegasValues = arr.create_arr((len(samples.DEGAS_HEADERS) -
|
|
133
|
-
smp.ApparentAgeValues = arr.create_arr((len(samples.SPECTRUM_TABLE_HEADERS) -
|
|
131
|
+
smp.CorrectedValues = arr.create_arr((len(samples.CORRECTED_HEADERS) - 3, 0))
|
|
132
|
+
smp.DegasValues = arr.create_arr((len(samples.DEGAS_HEADERS) - 3, 0))
|
|
133
|
+
smp.ApparentAgeValues = arr.create_arr((len(samples.SPECTRUM_TABLE_HEADERS) - 3, 0))
|
|
134
134
|
smp.IsochronValues = arr.create_arr((len(samples.ISOCHRON_TABLE_HEADERS) - 3, 0))
|
|
135
135
|
|
|
136
136
|
# Doi
|
|
@@ -193,32 +193,32 @@ def initial(smp: Sample):
|
|
|
193
193
|
# Plots and Tables
|
|
194
194
|
setattr(smp, 'UnknownTable', Table(
|
|
195
195
|
id='1', name='Unknown', header=samples.SAMPLE_INTERCEPT_HEADERS, decimal_places=decimal_places,
|
|
196
|
-
text_indexes=[0, 1],
|
|
196
|
+
text_indexes=[0, 1, 2],
|
|
197
197
|
# numeric_indexes=list(range(1, 20))
|
|
198
198
|
))
|
|
199
199
|
setattr(smp, 'BlankTable', Table(
|
|
200
200
|
id='2', name='Blank', header=samples.BLANK_INTERCEPT_HEADERS, decimal_places=decimal_places,
|
|
201
|
-
text_indexes=[0, 1],
|
|
201
|
+
text_indexes=[0, 1, 2],
|
|
202
202
|
# numeric_indexes=list(range(1, 20))
|
|
203
203
|
))
|
|
204
204
|
setattr(smp, 'CorrectedTable', Table(
|
|
205
205
|
id='3', name='Corrected', header=samples.CORRECTED_HEADERS, decimal_places=decimal_places,
|
|
206
|
-
text_indexes=[0, 1],
|
|
206
|
+
text_indexes=[0, 1, 2],
|
|
207
207
|
# numeric_indexes=list(range(1, 35))
|
|
208
208
|
))
|
|
209
209
|
setattr(smp, 'DegasPatternTable', Table(
|
|
210
210
|
id='4', name='Degas Pattern', header=samples.DEGAS_HEADERS, decimal_places=decimal_places,
|
|
211
|
-
text_indexes=[0, 1],
|
|
211
|
+
text_indexes=[0, 1, 2],
|
|
212
212
|
# numeric_indexes=list(range(1, 35))
|
|
213
213
|
))
|
|
214
214
|
setattr(smp, 'PublishTable', Table(
|
|
215
215
|
id='5', name='Publish', header=samples.PUBLISH_TABLE_HEADERS, decimal_places=decimal_places,
|
|
216
|
-
text_indexes=[0, 1],
|
|
216
|
+
text_indexes=[0, 1, 2],
|
|
217
217
|
# numeric_indexes=list(range(1, 20))
|
|
218
218
|
))
|
|
219
219
|
setattr(smp, 'AgeSpectraTable', Table(
|
|
220
220
|
id='6', name='Age Spectra', header=samples.SPECTRUM_TABLE_HEADERS, decimal_places=decimal_places,
|
|
221
|
-
text_indexes=[0, 1],
|
|
221
|
+
text_indexes=[0, 1, 2],
|
|
222
222
|
# numeric_indexes=list(range(1, 26))
|
|
223
223
|
))
|
|
224
224
|
setattr(smp, 'IsochronsTable', Table(
|
|
@@ -228,7 +228,7 @@ def initial(smp: Sample):
|
|
|
228
228
|
))
|
|
229
229
|
setattr(smp, 'TotalParamsTable', Table(
|
|
230
230
|
id='8', name='Total Params', header=samples.TOTAL_PARAMS_HEADERS, decimal_places=decimal_places,
|
|
231
|
-
text_indexes=[0, 1, 29, 30, 32, 33, 60, 99, *list(range(100, 115))],
|
|
231
|
+
text_indexes=[0, 1, 2, 29, 30, 32, 33, 60, 99, *list(range(100, 115))],
|
|
232
232
|
# numeric_indexes=list(range(1, 120)),
|
|
233
233
|
))
|
|
234
234
|
|
|
@@ -334,10 +334,13 @@ def check_version(smp: Sample):
|
|
|
334
334
|
v, sv = smp.TotalParam[59:61]
|
|
335
335
|
except:
|
|
336
336
|
doNormalize = False
|
|
337
|
-
smp.
|
|
337
|
+
smp.TotalParam[136:138] = [
|
|
338
338
|
[1 if v[0] == each or not doNormalize else v[0] / each for each in v],
|
|
339
339
|
[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))]
|
|
340
340
|
]
|
|
341
|
+
|
|
342
|
+
# 20251001: # add marks for every table
|
|
343
|
+
smp = smp.recalculate(re_set_table=True, re_table_style=True)
|
|
341
344
|
return smp
|
|
342
345
|
|
|
343
346
|
|
ararpy/smp/plots.py
CHANGED
|
@@ -416,7 +416,7 @@ def recalc_age_plateaus(sample: Sample, **kwargs):
|
|
|
416
416
|
-------
|
|
417
417
|
None
|
|
418
418
|
"""
|
|
419
|
-
ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.
|
|
419
|
+
ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138])
|
|
420
420
|
ar40r, sar40r = sample.DegasValues[24:26]
|
|
421
421
|
ar40rar39k = calc.arr.div([ar40r, sar40r], [ar39k, sar39k])
|
|
422
422
|
params_initial_ratio = calc.arr.partial(sample.TotalParam, cols=list(range(115, 120)))
|
|
@@ -575,7 +575,7 @@ def recalc_mdf_plateaus(sample: Sample, **kwargs):
|
|
|
575
575
|
-------
|
|
576
576
|
None
|
|
577
577
|
"""
|
|
578
|
-
ar36a, sar36a = calc.arr.mul(sample.DegasValues[0:2], sample.
|
|
578
|
+
ar36a, sar36a = calc.arr.mul(sample.DegasValues[0:2], sample.TotalParam[136:138])
|
|
579
579
|
ar40aar36a = sample.ApparentAgeValues[0:2]
|
|
580
580
|
mdf = sample.ApparentAgeValues[2:4]
|
|
581
581
|
|
|
@@ -613,7 +613,7 @@ def calc_ar40ar39(r, sr, smp):
|
|
|
613
613
|
"""
|
|
614
614
|
try:
|
|
615
615
|
ar36a = np.array(smp.DegasValues[0:2])
|
|
616
|
-
ar39k = calc.arr.mul(smp.DegasValues[20:22], smp.
|
|
616
|
+
ar39k = calc.arr.mul(smp.DegasValues[20:22], smp.TotalParam[136:138])
|
|
617
617
|
ar40 = smp.CorrectedValues[8:10]
|
|
618
618
|
ar40k = smp.DegasValues[30:32]
|
|
619
619
|
size = ar36a.shape[-1]
|
|
@@ -675,7 +675,7 @@ def get_plateau_results(smp: Sample, sequence: list, ar40rar39k: list = None,
|
|
|
675
675
|
else:
|
|
676
676
|
raise TypeError(f"Sample type is not supported: {smp.Info.sample.type}")
|
|
677
677
|
|
|
678
|
-
age = handle(
|
|
678
|
+
age = handle(ar40rar39k, smp=smp)[0:2]
|
|
679
679
|
plot_data = calc.spectra.get_data(*age, ar39k_percentage, indices=sequence, **kwargs)
|
|
680
680
|
f_values = _get_partial(sequence, *ar40rar39k)
|
|
681
681
|
age = _get_partial(sequence, *age)
|