ararpy 0.1.11__tar.gz → 0.1.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ararpy-0.1.11 → ararpy-0.1.13}/PKG-INFO +1 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/arr.py +4 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/basic.py +36 -14
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/corr.py +15 -30
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/isochron.py +4 -2
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/raw_funcs.py +2 -2
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/regression.py +3 -1
- ararpy-0.1.13/ararpy/examples/WHA.pdf +2863 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/calc_file.py +1 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/raw_file.py +84 -82
- ararpy-0.1.13/ararpy/smp/EXPORT_TO_PDF_DATA_PROPERTIES.py +95 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/basic.py +9 -7
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/calculation.py +4 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/corr.py +104 -56
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/diffusion_funcs.py +285 -124
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/export.py +464 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/json.py +12 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/plots.py +10 -6
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/raw.py +9 -2
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/sample.py +28 -12
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/table.py +8 -0
- ararpy-0.1.13/ararpy/test.py +100 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy.egg-info/PKG-INFO +1 -1
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy.egg-info/SOURCES.txt +2 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/setup.py +1 -1
- ararpy-0.1.11/ararpy/test.py +0 -37
- {ararpy-0.1.11 → ararpy-0.1.13}/LICENSE +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/README.md +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/__init__.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/__init__.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/age.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/err.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/histogram.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/jvalue.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/plot.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/calc/spectra.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/022_VU124-M11a.ahd +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/20WHA0103.age +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/22WHA0078.xls +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/22WHA0433.age +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/22WHA0433.arr +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/22WHA0433.full.xls +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/24WHN0001-51-592.XLS +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/AHD.input-filter +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/ArAr.calc +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/ArArCALC.age +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/NGX-600 - Copy.TXT +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/NGX-600.TXT +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/NGX-XLS.input-filter +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/Qtegra-exported-xls.input-filter +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/S01-239.csv +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/WH01.irra +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/raw_example.xls +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/examples/sample-default.smp +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/__init__.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/arr_file.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/basic.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/new_file.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/files/xls.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/__init__.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/consts.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/info.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/initial.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy/smp/style.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy.egg-info/dependency_links.txt +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/ararpy.egg-info/top_level.txt +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/setup.cfg +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/tests/test.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/tests/test2.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/tests/test_error_correlation.py +0 -0
- {ararpy-0.1.11 → ararpy-0.1.13}/tests/test_regression_methods.py +0 -0
|
@@ -499,6 +499,8 @@ def transpose(obj, ignore: bool = True):
|
|
|
499
499
|
|
|
500
500
|
"""
|
|
501
501
|
try:
|
|
502
|
+
if len(obj) == 0:
|
|
503
|
+
return obj
|
|
502
504
|
if not is_twoD(obj):
|
|
503
505
|
raise ValueError("The requested object is not two dimensional.")
|
|
504
506
|
obj = obj if is_homo(obj) else homo(obj)
|
|
@@ -539,7 +541,8 @@ def get_item(obj: list, loc: (list, tuple, int), default: Union[str, int, float,
|
|
|
539
541
|
return get_item(obj[loc[0] - base[0]], loc[1:], base=base[1:], default=default)
|
|
540
542
|
except (IndexError, TypeError, ValueError):
|
|
541
543
|
return default
|
|
542
|
-
|
|
544
|
+
except:
|
|
545
|
+
raise ValueError(f"Cannot get a item from {obj = }, {loc = }")
|
|
543
546
|
|
|
544
547
|
|
|
545
548
|
# =======================
|
|
@@ -10,9 +10,30 @@
|
|
|
10
10
|
#
|
|
11
11
|
"""
|
|
12
12
|
import copy
|
|
13
|
+
import random
|
|
14
|
+
import string
|
|
15
|
+
from datetime import datetime, timezone, timedelta
|
|
16
|
+
import pytz
|
|
13
17
|
|
|
14
18
|
|
|
15
|
-
def
|
|
19
|
+
def utc_dt(dt: datetime, tz: str = "utc", is_dst: bool = False) -> datetime:
|
|
20
|
+
"""
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
dt
|
|
24
|
+
tz
|
|
25
|
+
is_dst: only valid when an ambiguous time inputted
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
tz = pytz.timezone(tz)
|
|
32
|
+
return tz.localize(dt, is_dst).astimezone(pytz.utc)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_datetime(t_year: int, t_month: int, t_day: int, t_hour: int, t_min: int, t_seconds: int = 0,
|
|
36
|
+
tz_hour: int = 0, tz_min: int = 0, base=None):
|
|
16
37
|
"""
|
|
17
38
|
:param t_year: int
|
|
18
39
|
:param t_month: int
|
|
@@ -20,22 +41,19 @@ def get_datetime(t_year: int, t_month: int, t_day: int, t_hour: int, t_min: int,
|
|
|
20
41
|
:param t_hour: int
|
|
21
42
|
:param t_min: int
|
|
22
43
|
:param t_seconds: int, default == 0
|
|
44
|
+
:param tz_hour: int, default == 0
|
|
45
|
+
:param tz_min: int, default == 0
|
|
23
46
|
:param base: base time [y, m, d, h, m]
|
|
24
|
-
:return: seconds since 1970-1-1
|
|
47
|
+
:return: seconds since 1970-1-1 0:00
|
|
25
48
|
"""
|
|
26
|
-
t_year, t_month, t_day, t_hour, t_min, t_seconds = \
|
|
27
|
-
int(t_year), int(t_month), int(t_day), int(t_hour), int(t_min), int(t_seconds)
|
|
49
|
+
t_year, t_month, t_day, t_hour, t_min, t_seconds, tz_hour, tz_min = \
|
|
50
|
+
int(t_year), int(t_month), int(t_day), int(t_hour), int(t_min), int(t_seconds), int(tz_hour), int(tz_min)
|
|
28
51
|
if base is None:
|
|
29
|
-
base = [1970, 1, 1,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
|
35
|
-
delta_seconds = ((((t_year - base_year) * 365 + ((t_year + 1 - base_year) - (t_year + 1 - base_year) % 4) / 4 +
|
|
36
|
-
sum(days[base_mouth - 1:t_month - 1]) + t_day - base_day) * 24 + t_hour - base_hour) * 60 +
|
|
37
|
-
t_min - base_min) * 60 + t_seconds
|
|
38
|
-
return delta_seconds
|
|
52
|
+
base = [1970, 1, 1, 0, 0]
|
|
53
|
+
base = datetime(*base, tzinfo=timezone.utc).timestamp()
|
|
54
|
+
ts = datetime(t_year, t_month, t_day, t_hour, t_min, t_seconds,
|
|
55
|
+
tzinfo=timezone(offset=timedelta(hours=tz_hour, minutes=tz_min))).timestamp()
|
|
56
|
+
return ts - base
|
|
39
57
|
|
|
40
58
|
|
|
41
59
|
def merge_dicts(a: dict, b: dict):
|
|
@@ -78,3 +96,7 @@ def update_dicts(a: dict, b: dict):
|
|
|
78
96
|
else:
|
|
79
97
|
res[key] = val
|
|
80
98
|
return res
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def get_random_digits(length: int = 7) -> str:
|
|
102
|
+
return ''.join(random.choices(string.digits, k=length))
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"""
|
|
12
12
|
import traceback
|
|
13
13
|
|
|
14
|
-
from . import arr, err
|
|
14
|
+
from . import arr, err, basic
|
|
15
15
|
import numpy as np
|
|
16
16
|
from typing import Tuple, List, Optional, Union
|
|
17
17
|
from types import MethodType
|
|
@@ -30,6 +30,18 @@ def blank(a0: list, e0: list, a1: list, e1: list):
|
|
|
30
30
|
return arr.sub((a0, e0), (a1, e1))
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
def gain(a0: list, e0: list, a1: list, e1: list):
|
|
34
|
+
"""
|
|
35
|
+
:param a0: a list of tested isotope value
|
|
36
|
+
:param e0: 1 sigma error of a0, list type
|
|
37
|
+
:param a1: a list of blank isotope value
|
|
38
|
+
:param e1: 1 sigma error of a1, list type
|
|
39
|
+
:return: list of corrected data | error list
|
|
40
|
+
"""
|
|
41
|
+
# Do not force negative value to zero in correcting blank...
|
|
42
|
+
return arr.div((a0, e0), (a1, e1))
|
|
43
|
+
|
|
44
|
+
|
|
33
45
|
def mdf(rm: float, srm: float, m1: float, m2: float, ra: float = 298.56,
|
|
34
46
|
sra: float = 0):
|
|
35
47
|
"""
|
|
@@ -157,8 +169,8 @@ def get_decay_factor(t1: list, t2: list, t3: list, f: float, sf: float,
|
|
|
157
169
|
v2 = []
|
|
158
170
|
e1 = []
|
|
159
171
|
# t_year, t_month, t_day, t_hour, t_min = t1
|
|
160
|
-
t_test_start = get_datetime(*t1) # the time when analysis began
|
|
161
|
-
t2 = [get_datetime(*i) for i in t2] # the time when irradiation ended for all cycles, in second
|
|
172
|
+
t_test_start = basic.get_datetime(*t1) # the time when analysis began
|
|
173
|
+
t2 = [basic.get_datetime(*i) for i in t2] # the time when irradiation ended for all cycles, in second
|
|
162
174
|
k2 = [t_test_start - i for i in t2] # standing time in second between irradiation and analysing
|
|
163
175
|
|
|
164
176
|
try:
|
|
@@ -191,33 +203,6 @@ def get_decay_factor(t1: list, t2: list, t3: list, f: float, sf: float,
|
|
|
191
203
|
return k0, k1
|
|
192
204
|
|
|
193
205
|
|
|
194
|
-
def get_datetime(t_year: int, t_month: int, t_day: int, t_hour: int, t_min: int,
|
|
195
|
-
t_seconds: int = 0, base=None):
|
|
196
|
-
"""
|
|
197
|
-
:param t_year: int
|
|
198
|
-
:param t_month: int
|
|
199
|
-
:param t_day: int
|
|
200
|
-
:param t_hour: int
|
|
201
|
-
:param t_min: int
|
|
202
|
-
:param t_seconds: int, default == 0
|
|
203
|
-
:param base: base time [y, m, d, h, m]
|
|
204
|
-
:return: seconds since 1970-1-1 8:00
|
|
205
|
-
"""
|
|
206
|
-
t_year, t_month, t_day, t_hour, t_min, t_seconds = \
|
|
207
|
-
int(t_year), int(t_month), int(t_day), int(t_hour), int(t_min), int(t_seconds)
|
|
208
|
-
if base is None:
|
|
209
|
-
base = [1970, 1, 1, 8, 0]
|
|
210
|
-
base_year, base_mouth, base_day, base_hour, base_min = base
|
|
211
|
-
if t_year % 4 == 0 and t_year % 100 != 0 or t_year % 400 == 0:
|
|
212
|
-
days = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
|
213
|
-
else:
|
|
214
|
-
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
|
215
|
-
delta_seconds = ((((t_year - base_year) * 365 + ((t_year + 1 - base_year) - (t_year + 1 - base_year) % 4) / 4 +
|
|
216
|
-
sum(days[base_mouth - 1:t_month - 1]) + t_day - base_day) * 24 + t_hour - base_hour) * 60 +
|
|
217
|
-
t_min - base_min) * 60 + t_seconds
|
|
218
|
-
return delta_seconds
|
|
219
|
-
|
|
220
|
-
|
|
221
206
|
def get_irradiation_datetime_by_string(datetime_str: str):
|
|
222
207
|
"""
|
|
223
208
|
Parameters
|
|
@@ -134,7 +134,7 @@ def get_ellipse(x: float, sx: float, y: float, sy: float, r: float, plt_sfactor:
|
|
|
134
134
|
return ellipse_points
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
def get_line_points(xscale, yscale, coeffs
|
|
137
|
+
def get_line_points(xscale, yscale, coeffs):
|
|
138
138
|
"""
|
|
139
139
|
|
|
140
140
|
Parameters
|
|
@@ -147,7 +147,9 @@ def get_line_points(xscale, yscale, coeffs=None):
|
|
|
147
147
|
-------
|
|
148
148
|
List of data points
|
|
149
149
|
"""
|
|
150
|
-
|
|
150
|
+
xscale = [float(i) for i in xscale]
|
|
151
|
+
yscale = [float(i) for i in yscale]
|
|
152
|
+
coeffs = [float(i) for i in coeffs]
|
|
151
153
|
if not isinstance(coeffs, list) or len(coeffs) < 2:
|
|
152
154
|
raise ValueError(f"Coeffs should be a list with length with 2.")
|
|
153
155
|
get_y = lambda x: coeffs[0] + coeffs[1] * x
|
|
@@ -57,11 +57,11 @@ def get_raw_data_regression_results(points_data, unselected: list = None):
|
|
|
57
57
|
except TypeError or IndexError:
|
|
58
58
|
line_data, line_results, reg_coeffs = [], ['NotEnoughPoints', np.nan, np.nan, np.nan, ], []
|
|
59
59
|
except ZeroDivisionError:
|
|
60
|
-
line_data, line_results, reg_coeffs = [], [
|
|
60
|
+
line_data, line_results, reg_coeffs = [], ['ZeroDivisionError', np.nan, np.nan, np.nan, ], []
|
|
61
61
|
except ValueError:
|
|
62
62
|
line_data, line_results, reg_coeffs = [], ['BadFitting', np.nan, np.nan, np.nan, ], []
|
|
63
63
|
except:
|
|
64
|
-
line_data, line_results, reg_coeffs = [], [
|
|
64
|
+
line_data, line_results, reg_coeffs = [], ['UncaughtError', np.nan, np.nan, np.nan, ], []
|
|
65
65
|
# linesData.append(line_data)
|
|
66
66
|
linesResults.append(line_results)
|
|
67
67
|
regCoeffs.append(reg_coeffs)
|
|
@@ -937,7 +937,9 @@ def exponential(a0: list, a1: list):
|
|
|
937
937
|
raise RuntimeError
|
|
938
938
|
except np.linalg.LinAlgError:
|
|
939
939
|
raise np.linalg.LinAlgError
|
|
940
|
-
except TypeError
|
|
940
|
+
except TypeError:
|
|
941
|
+
raise TypeError
|
|
942
|
+
except IndexError:
|
|
941
943
|
raise IndexError
|
|
942
944
|
|
|
943
945
|
f = linest(a0, [b ** _x for _x in a1])
|