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/smp/sample.py CHANGED
@@ -22,25 +22,25 @@ from types import MethodType
22
22
  import pandas as pd
23
23
 
24
24
  SAMPLE_INTERCEPT_HEADERS = [
25
- 'Sequence', '', # 0-1
25
+ 'Sequence', '', 'Mark', # 0-2
26
26
  '\u00B3\u2076Ar', '1\u03C3', '\u00B3\u2077Ar', '1\u03C3', # 2-5
27
27
  '\u00B3\u2078Ar', '1\u03C3', '\u00B3\u2079Ar', '1\u03C3', # 6-9
28
28
  '\u2074\u2070Ar', '1\u03C3', # 10-11
29
29
  ]
30
30
  BLANK_INTERCEPT_HEADERS = [
31
- 'Sequence', '', # 0-1
31
+ 'Sequence', '', 'Mark', # 0-2
32
32
  '\u00B3\u2076Ar', '1\u03C3', '\u00B3\u2077Ar', '1\u03C3', # 2-5
33
33
  '\u00B3\u2078Ar', '1\u03C3', '\u00B3\u2079Ar', '1\u03C3', # 6-9
34
34
  '\u2074\u2070Ar', '1\u03C3', # 10-11
35
35
  ]
36
36
  CORRECTED_HEADERS = [
37
- 'Sequence', '', # 0-1
37
+ 'Sequence', '', 'Mark', # 0-2
38
38
  '\u00B3\u2076Ar', '1\u03C3', '\u00B3\u2077Ar', '1\u03C3', # 2-5
39
39
  '\u00B3\u2078Ar', '1\u03C3', '\u00B3\u2079Ar', '1\u03C3', # 6-9
40
40
  '\u2074\u2070Ar', '1\u03C3', # 10-11
41
41
  ]
42
42
  DEGAS_HEADERS = [
43
- 'Sequence', '', # 0-1
43
+ 'Sequence', '', 'Mark', # 0-2
44
44
  '\u00B3\u2076Ar[a]', '1\u03C3', '\u00B3\u2076Ar[c]', '1\u03C3', # 2-5
45
45
  '\u00B3\u2076Ar[Ca]', '1\u03C3', '\u00B3\u2076Ar[Cl]', '1\u03C3', # 6-9
46
46
  '\u00B3\u2077Ar[Ca]', '1\u03C3', '\u00B3\u2078Ar[Cl]', '1\u03C3', # 10-13
@@ -51,40 +51,40 @@ DEGAS_HEADERS = [
51
51
  '\u2074\u2070Ar[c]', '1\u03C3', '\u2074\u2070Ar[K]', '1\u03C3' # 30-33
52
52
  ]
53
53
  PUBLISH_TABLE_HEADERS = [
54
- 'Sequence', '', # 0-1
54
+ 'Sequence', '', 'Mark', # 0-2
55
55
  '\u00B3\u2076Ar[a]', '\u00B3\u2077Ar[Ca]', '\u00B3\u2078Ar[Cl]', # 2-4
56
56
  '\u00B3\u2079Ar[K]', '\u2074\u2070Ar[r]', # 5-6
57
57
  'Apparent Age', '1\u03C3', '\u2074\u2070Ar[r]%', '\u00B3\u2079Ar[K]%', # 7-10
58
58
  'Ca/K', '1\u03C3', # 11-12
59
59
  ]
60
60
  PUBLISH_TABLE_HEADERS_AIR = [
61
- 'Sequence', '', # 0-1
61
+ 'Sequence', '', 'Mark', # 0-2
62
62
  '\u00B3\u2076Ar[a]', '\u00B3\u2077Ar[Ca]', '\u00B3\u2078Ar[Cl]', # 2-4
63
63
  '\u00B3\u2079Ar[K]', '\u2074\u2070Ar[r]', # 5-6
64
64
  'MDF', '1\u03C3', '\u2074\u2070Ar[r]%', '\u00B3\u2076Ar%', # 7-10
65
65
  'Ca/K', '1\u03C3', # 11-12
66
66
  ]
67
67
  PUBLISH_TABLE_HEADERS_STD = [
68
- 'Sequence', '', # 0-1
68
+ 'Sequence', '', 'Mark', # 0-2
69
69
  '\u00B3\u2076Ar[a]', '\u00B3\u2077Ar[Ca]', '\u00B3\u2078Ar[Cl]', # 2-4
70
70
  '\u00B3\u2079Ar[K]', '\u2074\u2070Ar[r]', # 5-6
71
71
  'J', '1\u03C3', '\u2074\u2070Ar[r]%', '\u00B3\u2076Ar%', # 7-10
72
72
  'Ca/K', '1\u03C3', # 11-12
73
73
  ]
74
74
  SPECTRUM_TABLE_HEADERS = [
75
- 'Sequence', '', # 0-1
75
+ 'Sequence', '', 'Mark', # 0-2
76
76
  '\u2074\u2070Ar/\u00B3\u2079Ar', '1\u03C3', # 2-3
77
77
  'Apparent Age', '1\u03C3', '1\u03C3', '1\u03C3', # 4-7
78
78
  '\u2074\u2070Ar[r]%', '\u00B3\u2079Ar[K]%', # 8-9
79
79
  ]
80
80
  SPECTRUM_TABLE_HEADERS_AIR = [
81
- 'Sequence', '', # 0-1
81
+ 'Sequence', '', 'Mark', # 0-2
82
82
  '\u2074\u2070Ar/\u00B3\u2076Ar', '1\u03C3', # 2-3
83
83
  'MDF', '1\u03C3', '1\u03C3', '1\u03C3', # 4-7
84
84
  '\u2074\u2070Ar[r]%', '\u00B3\u2076Ar%', # 8-9
85
85
  ]
86
86
  SPECTRUM_TABLE_HEADERS_STD = [
87
- 'Sequence', '', # 0-1
87
+ 'Sequence', '', 'Mark', # 0-2
88
88
  '\u2074\u2070Ar/\u00B3\u2076Ar', '1\u03C3', # 2-3
89
89
  'J', '1\u03C3', '1\u03C3', '1\u03C3', # 4-7
90
90
  '\u2074\u2070Ar[r]%', '\u00B3\u2076Ar%', # 8-9
@@ -107,7 +107,7 @@ ISOCHRON_TABLE_HEADERS = [
107
107
  'r1', 'r2', 'r3', # 39-41
108
108
  ]
109
109
  TOTAL_PARAMS_HEADERS = [
110
- 'Sequence', '', # 0-1
110
+ 'Sequence', '', 'Mark', # 0-2
111
111
  '(\u2074\u2070Ar/\u00B3\u2076Ar)t', '%1\u03C3',
112
112
  '(\u2074\u2070Ar/\u00B3\u2076Ar)c', '%1\u03C3', # 2-5
113
113
  '(\u00B3\u2078Ar/\u00B3\u2076Ar)t', '%1\u03C3',
@@ -169,22 +169,26 @@ TOTAL_PARAMS_HEADERS = [
169
169
  '38Ar Gain', '%1\u03C3', # 132-133
170
170
  '39Ar Gain', '%1\u03C3', # 134-135
171
171
  '40Ar Gain', '%1\u03C3', # 136-137
172
+ 'Normalize Factor', '1\u03C3', # 138-139
172
173
  ]
173
174
 
174
175
  SAMPLE_INTERCEPT_SHORT_HEADERS = [
175
- 'Seq', 'Label', 'Ar36', '1s', 'Ar37', '1s',
176
+ 'Seq', 'Label', 'Mark', # 0-2
177
+ 'Ar36', '1s', 'Ar37', '1s',
176
178
  'Ar38', '1s', 'Ar39', '1s', 'Ar40', '1s'
177
179
  ]
178
180
  BLANK_INTERCEPT_SHORT_HEADERS = [
179
- 'Seq', 'Label', 'Ar36', '1s', 'Ar37', '1s',
181
+ 'Seq', 'Label', 'Mark', # 0-2
182
+ 'Ar36', '1s', 'Ar37', '1s',
180
183
  'Ar38', '1s', 'Ar39', '1s', 'Ar40', '1s'
181
184
  ]
182
185
  CORRECTED_SHORT_HEADERS = [
183
- 'Seq', 'Label', 'Ar36', '1s', 'Ar37', '1s',
186
+ 'Seq', 'Label', 'Mark', # 0-2
187
+ 'Ar36', '1s', 'Ar37', '1s',
184
188
  'Ar38', '1s', 'Ar39', '1s', 'Ar40', '1s'
185
189
  ]
186
190
  DEGAS_SHORT_HEADERS = [
187
- 'Seq', 'Label', # 0-1
191
+ 'Seq', 'Label', 'Mark', # 0-2
188
192
  'Ar36[a]', '1s', 'Ar36[c]', '1s', # 2-5
189
193
  'Ar36[Ca]', '1s', 'Ar36[Cl]', '1s', # 6-9
190
194
  'Ar37[Ca]', '1s', 'Ar38[Cl]', '1s', # 10-13
@@ -195,12 +199,14 @@ DEGAS_SHORT_HEADERS = [
195
199
  'Ar40[c]', '1s', 'Ar40[K]', '1s' # 29-32
196
200
  ]
197
201
  PUBLISH_TABLE_SHORT_HEADERS = [
198
- 'Seq', 'Label', 'Ar36[a]', 'Ar37[Ca]', 'Ar38[Cl]',
202
+ 'Seq', 'Label', 'Mark', # 0-2
203
+ 'Ar36[a]', 'Ar37[Ca]', 'Ar38[Cl]',
199
204
  'Ar39[K]', 'Ar40[r]', 'Apparent Age', '1s', 'Ar40r%',
200
205
  'Ar39K%', 'Ca/K', '1s'
201
206
  ]
202
207
  SPECTRUM_TABLE_SHORT_HEADERS = [
203
- 'Seq', 'Label', 'Ar40/Ar39', '1s', 'Apparent Age',
208
+ 'Seq', 'Label', 'Mark', # 0-2
209
+ 'Ar40/Ar39', '1s', 'Apparent Age',
204
210
  '1s', '1s', '1s', 'Ar40[r]%', 'Ar39[K]%'
205
211
  ]
206
212
  ISOCHRON_TABLE_SHORT_HEADERS = [
@@ -221,7 +227,7 @@ ISOCHRON_TABLE_SHORT_HEADERS = [
221
227
  'r1', 'r2', 'r3', # 39-41
222
228
  ]
223
229
  TOTAL_PARAMS_SHORT_HEADERS = [
224
- 'Seq', 'Label', # 0-1
230
+ 'Seq', 'Label', 'Mark', # 0-2
225
231
  'T_40v36', '%1s',
226
232
  'C_40v36', '%1s', # 2-5
227
233
  'T_38v36', '%1s',
@@ -283,6 +289,7 @@ TOTAL_PARAMS_SHORT_HEADERS = [
283
289
  '38Gain', '%1s', # 132-133
284
290
  '39Gain', '%1s', # 134-135
285
291
  '40Gain', '%1s', # 136-137
292
+ 'NormalizeFactor', '1\u03C3', # 138-139
286
293
  ]
287
294
 
288
295
  DEFAULT_PLOT_STYLES = lambda sample_type, age_unit: {
@@ -776,7 +783,7 @@ DEFAULT_PLOT_STYLES = lambda sample_type, age_unit: {
776
783
  },
777
784
  }
778
785
 
779
- VERSION = '20250622'
786
+ VERSION = '20251001'
780
787
 
781
788
  NAMED_DICT = {
782
789
  "unknown": {"header": SAMPLE_INTERCEPT_HEADERS.copy()},
@@ -845,7 +852,6 @@ class Sample:
845
852
  self.SelectedSequence2 = []
846
853
  self.UnselectedSequence = []
847
854
  self.IsochronMark = []
848
- self.NormalizeFactor = [[], []]
849
855
 
850
856
  # Tables and Plots
851
857
  self.UnknownTable = Table()
@@ -885,7 +891,8 @@ class Sample:
885
891
  # self.__version = '20250321' # error sigma adjustment
886
892
  # self.__version = '20250328' # Experiment info
887
893
  # self.__version = '20250404' # J normalization factor
888
- self.__version = '20250622' # version setter
894
+ # self.__version = '20251001' # add marker col for all tables
895
+ self.__version = '20251001' # version setter
889
896
 
890
897
  @property
891
898
  def version(self):
@@ -1014,17 +1021,25 @@ class Table:
1014
1021
  setattr(self, k, v)
1015
1022
  self.set_coltypes()
1016
1023
 
1017
- def set_coltypes(self):
1018
- for i in self.text_indexes:
1019
- if i < self.colcount:
1024
+ def set_coltypes(self, text_indexes=None):
1025
+ if text_indexes is not None:
1026
+ self.text_indexes = text_indexes
1027
+ if not isinstance(self.text_indexes, list):
1028
+ raise TypeError(f"Text_indexes is not allowed: {self.text_indexes}")
1029
+ for i in range(self.colcount):
1030
+ if i in self.text_indexes:
1020
1031
  self.coltypes[i].update({'type': 'text'})
1021
- for i in self.numeric_indexes:
1022
- if i < self.colcount:
1032
+ else:
1023
1033
  self.coltypes[i].update({
1024
1034
  'type': 'numeric',
1025
1035
  'numericFormat': {'pattern': {'mantissa': self.decimal_places}},
1026
1036
  })
1027
1037
 
1038
+ def set_colcount(self, c: int):
1039
+ self.colcount = c
1040
+ while len(self.coltypes) < c:
1041
+ self.coltypes.append({'type': 'text'})
1042
+
1028
1043
 
1029
1044
  class Plot:
1030
1045
  def __init__(self, id='', type='', name='', data=None, info=None, **kwargs):
ararpy/smp/style.py CHANGED
@@ -195,9 +195,11 @@ def set_table_style(sample: Sample):
195
195
  -------
196
196
 
197
197
  """
198
+ std = initial.initial(Sample())
198
199
  for key, comp in basic.get_components(sample).items():
199
200
  if isinstance(comp, Table):
200
201
  comp.header = TABLEHEADER(sample_type=sample.Info.sample.type, index=int(comp.id))
202
+ comp.text_indexes = basic.get_component_byid(std, comp.id).text_indexes
201
203
  comp.set_coltypes()
202
204
  # comp.colcount = len(comp.header)
203
205
  # comp.coltypes = [{'type': 'numeric'}] * (comp.colcount)
ararpy/smp/table.py CHANGED
@@ -39,16 +39,16 @@ def update_table_data(smp: Sample, only_table: str = None):
39
39
  continue
40
40
  if key == '1':
41
41
  data = calc.arr.merge(
42
- smp.SequenceName, smp.SequenceValue, *smp.SampleIntercept)
42
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.SampleIntercept)
43
43
  elif key == '2':
44
44
  data = calc.arr.merge(
45
- smp.SequenceName, smp.SequenceValue, *smp.BlankIntercept)
45
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.BlankIntercept)
46
46
  elif key == '3':
47
47
  data = calc.arr.merge(
48
- smp.SequenceName, smp.SequenceValue, *smp.CorrectedValues)
48
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.CorrectedValues)
49
49
  elif key == '4':
50
50
  data = calc.arr.merge(
51
- smp.SequenceName, smp.SequenceValue, *smp.DegasValues)
51
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.DegasValues)
52
52
  elif key == '5':
53
53
  smp.PublishValues[0] = copy.deepcopy(smp.DegasValues[ 0])
54
54
  smp.PublishValues[1] = copy.deepcopy(smp.DegasValues[ 8])
@@ -58,19 +58,20 @@ def update_table_data(smp: Sample, only_table: str = None):
58
58
  smp.PublishValues[5:7] = copy.deepcopy(smp.ApparentAgeValues[2:4])
59
59
  smp.PublishValues[7:9] = copy.deepcopy(smp.ApparentAgeValues[6:8])
60
60
  data = calc.arr.merge(
61
- smp.SequenceName, smp.SequenceValue, *smp.PublishValues)
61
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.PublishValues)
62
62
  elif key == '6':
63
63
  data = calc.arr.merge(
64
- smp.SequenceName, smp.SequenceValue, *smp.ApparentAgeValues)
64
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.ApparentAgeValues)
65
65
  elif key == '7':
66
66
  data = calc.arr.merge(
67
67
  smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.IsochronValues)
68
68
  elif key == '8':
69
69
  data = calc.arr.merge(
70
- smp.SequenceName, smp.SequenceValue, *smp.TotalParam)
70
+ smp.SequenceName, smp.SequenceValue, smp.IsochronMark, *smp.TotalParam)
71
71
  else:
72
72
  data = [['']]
73
73
  # calc.arr.replace(data, pd.isnull, None)
74
+ comp.set_colcount(len(data))
74
75
  setattr(comp, 'data', calc.arr.transpose(data))
75
76
 
76
77
 
@@ -111,42 +112,43 @@ def update_handsontable(smp: Sample, data: list, id: str):
111
112
 
112
113
  update_all_table = False
113
114
  try:
114
- if data[1] != smp.SequenceValue:
115
+ if data[1] != smp.SequenceValue or data[2] != smp.IsochronMark:
115
116
  update_all_table = True
116
117
  smp.SequenceValue = data[1]
118
+ smp.IsochronMark = data[2]
117
119
  except IndexError:
120
+ print(f"Check sequence value / isochron mark failed")
118
121
  pass
119
122
 
120
123
  if id == '1': # 样品值
121
- data = _normalize_data(data, len(samples.SAMPLE_INTERCEPT_HEADERS), 2)
124
+ data = _normalize_data(data, len(samples.SAMPLE_INTERCEPT_HEADERS), 3)
122
125
  smp.SampleIntercept = _digitize_data(data)
123
126
  elif id == '2': # 本底值
124
- data = _normalize_data(data, len(samples.BLANK_INTERCEPT_HEADERS), 2)
127
+ data = _normalize_data(data, len(samples.BLANK_INTERCEPT_HEADERS), 3)
125
128
  smp.BlankIntercept = _digitize_data(data)
126
129
  elif id == '3': # 校正值
127
- data = _normalize_data(data, len(samples.CORRECTED_HEADERS), 2)
130
+ data = _normalize_data(data, len(samples.CORRECTED_HEADERS), 3)
128
131
  smp.CorrectedValues = _digitize_data(data)
129
132
  elif id == '4': # Degas table
130
- data = _normalize_data(data, len(samples.DEGAS_HEADERS), 2)
133
+ data = _normalize_data(data, len(samples.DEGAS_HEADERS), 3)
131
134
  smp.DegasValues = _digitize_data(data)
132
135
  elif id == '5': # 发行表
133
- data = _normalize_data(data, len(samples.PUBLISH_TABLE_HEADERS), 2)
136
+ data = _normalize_data(data, len(samples.PUBLISH_TABLE_HEADERS), 3)
134
137
  smp.PublishValues = _digitize_data(data)
135
138
  elif id == '6': # 年龄谱
136
- data = _normalize_data(data, len(samples.SPECTRUM_TABLE_HEADERS), 2)
139
+ data = _normalize_data(data, len(samples.SPECTRUM_TABLE_HEADERS), 3)
137
140
  smp.ApparentAgeValues = _digitize_data(data)
138
141
  elif id == '7': # 等时线
139
- smp.IsochronMark = _digitize_data(data)[2]
140
142
  data = _normalize_data(data, len(samples.ISOCHRON_TABLE_HEADERS), 3)
141
143
  smp.IsochronValues = _digitize_data(data)
142
- smp.sequence()
143
144
  elif id == '8': # 总参数
144
- data = _normalize_data(data, len(samples.TOTAL_PARAMS_HEADERS), 2)
145
+ data = _normalize_data(data, len(samples.TOTAL_PARAMS_HEADERS), 3)
145
146
  data = _digitize_data(data)
146
147
  data[101: 112] = [_strToBool(i) for i in data[101: 112]]
147
148
  smp.TotalParam = data
148
149
  else:
149
150
  raise ValueError(f"{id = }, The table id is not supported.")
151
+ smp.sequence()
150
152
  if update_all_table:
151
153
  update_table_data(smp)
152
154
  else:
@@ -171,21 +173,21 @@ def update_data_from_table(smp: Sample, only_table: str = None):
171
173
  if only_table is not None and key != only_table:
172
174
  continue
173
175
  if key == '1':
174
- smp.SampleIntercept = calc.arr.transpose(comp.data)[2:]
176
+ smp.SampleIntercept = calc.arr.transpose(comp.data)[3:]
175
177
  elif key == '2':
176
- smp.BlankIntercept = calc.arr.transpose(comp.data)[2:]
178
+ smp.BlankIntercept = calc.arr.transpose(comp.data)[3:]
177
179
  elif key == '3':
178
- smp.CorrectedValues = calc.arr.transpose(comp.data)[2:]
180
+ smp.CorrectedValues = calc.arr.transpose(comp.data)[3:]
179
181
  elif key == '4':
180
- smp.DegasValues = calc.arr.transpose(comp.data)[2:]
182
+ smp.DegasValues = calc.arr.transpose(comp.data)[3:]
181
183
  elif key == '5':
182
- smp.PublishValues = calc.arr.transpose(comp.data)[2:]
184
+ smp.PublishValues = calc.arr.transpose(comp.data)[3:]
183
185
  elif key == '6':
184
- smp.ApparentAgeValues = calc.arr.transpose(comp.data)[2:]
186
+ smp.ApparentAgeValues = calc.arr.transpose(comp.data)[3:]
185
187
  elif key == '7':
186
188
  smp.IsochronValues = calc.arr.transpose(comp.data)[3:]
187
189
  elif key == '8':
188
- smp.TotalParam = calc.arr.transpose(comp.data)[2:]
190
+ smp.TotalParam = calc.arr.transpose(comp.data)[3:]
189
191
  else:
190
192
  pass
191
193
 
@@ -127,8 +127,9 @@ def walker2(pos: np.ndarray, duration, step_length, min_bound, max_bound, time_s
127
127
  :return:
128
128
  """
129
129
 
130
- if len(pos) == 0:
131
- return pos
130
+ # Ar40模拟时不能判断,因为会增加
131
+ # if len(pos) == 0:
132
+ # return pos
132
133
 
133
134
  dimension = pos.shape[-1] if len(pos.shape) > 1 else 1
134
135
 
@@ -141,7 +142,6 @@ def walker2(pos: np.ndarray, duration, step_length, min_bound, max_bound, time_s
141
142
  conditions = np.array([[-50, -50, 50, 50, 1]])
142
143
 
143
144
  for step in range(int(1e16)):
144
-
145
145
  n = parent - int(parent * math.exp(-1 * decay * dt / (3600 * 24 * 365.2425)))
146
146
  # print(f"number of new pos = {n}")
147
147
  parent = parent - n
@@ -288,6 +288,8 @@ class DiffSimulation:
288
288
  self.end_at = 0
289
289
  self.dimension = 3
290
290
 
291
+ self.thermal_log = []
292
+
291
293
  self.size_scale = 1
292
294
  self.length_scale = 1
293
295
 
@@ -373,7 +375,7 @@ class DiffSimulation:
373
375
  boundary_factor = 0.1 ** (k * math.log10(1 + (max(conditions[:, -1]) // 1000)))
374
376
  step_length = self.step_length / np.sqrt(pos.shape[1] if len(pos.shape) > 1 else 1)
375
377
  scale = int(total_steps)
376
- # print(f"调整后: {nsteps_factor = }, gamma = {conditions[0][-1]}, {total_steps = }, {compensation = }, {boundary_factor = }")
378
+ print(f"调整后: {nsteps_factor = }, gamma = {conditions[0][-1]}, {total_steps = }, {compensation = }, {boundary_factor = }")
377
379
 
378
380
  _pos = walker(
379
381
  copy.deepcopy(pos), step_length=step_length, total_nsteps=total_steps,
@@ -437,7 +439,7 @@ class DiffSimulation:
437
439
  self.remained_per_step.append(len(pos))
438
440
  self.released_per_step.append(self.natoms - len(pos))
439
441
 
440
- print(f"{index = } {duration} - {heating_duration = } - {temperature = } - {total_steps = } - conc = {len(pos) / self.natoms * 100:.2f}% - {time.time() - _start:.5f}s")
442
+ print(f"{index = } {duration = }s - {heating_duration = }s - {temperature = }K - {total_steps = } - conc = {len(pos) / self.natoms * 100:.2f}% - {time.time() - _start:.5f}s")
441
443
 
442
444
  self.positions = copy.deepcopy(pos)
443
445
 
@@ -452,6 +454,49 @@ class DiffSimulation:
452
454
  return self.run_sequence(*seq, domains=domains, nsteps_factor=scale, simulating=simulation,
453
455
  epsilon=epsilon, start_time=start_time)
454
456
 
457
+ def demo_init(n, es, fs, di, gs, ds, fr, ss=1):
458
+ demo = DiffSimulation()
459
+ # fs 应从大到小,父空间在前,子空间在后
460
+
461
+ # demo.grain_size = 300
462
+ # demo.size_scale = 0.05
463
+ # demo.atom_density = 1e14 # 原子密度 个/立方厘米
464
+
465
+ demo.dimension = di # dimension, 1 or 3
466
+ demo.size_scale = 1 # size_scale
467
+ demo.grain_size = gs # grain_szie
468
+ demo.frequency = fr # frequency
469
+
470
+ # domains应该从外到内
471
+ domains = []
472
+ for i in range(n-1, 0-1, -1):
473
+ size = int(demo.grain_size * fs[i]) * demo.size_scale
474
+ center = np.zeros(demo.dimension)
475
+ if isinstance(ds, (int, float)) or len(ds) == 1:
476
+ demo.atom_density = ds # atom_density # 原子密度 个/立方厘米
477
+ if i == 2:
478
+ ad = ds * 5 / 4
479
+ else:
480
+ ad = ds
481
+ else:
482
+ ad = ds[i]
483
+ dom = Domain(
484
+ dimension=demo.dimension, atom_density=ad, min_bound=center - size / 2, max_bound=center + size / 2,
485
+ energy=es[i], fraction=fs[i], inclusions=[domains[-1]] if len(domains) >= 1 else []
486
+ )
487
+ domains.append(dom)
488
+ # domains应该从外到内, 上面为了inclusion以及方便不同扩散域设置不同的密度,要按照从小到大的顺序生成,但是后面行走的时候要根据不同条件设置系数,要从外到内
489
+ demo.domains = sorted(domains, key=lambda dom: dom.fraction, reverse=True)
490
+
491
+ demo.setup()
492
+
493
+ a = [f"{dom.fraction = }, {dom.energy = }, {dom.natoms = }, {dom.atom_density = }" for dom in demo.domains]
494
+
495
+ print(
496
+ f"Total Atoms: {demo.natoms}\n" + "\n".join(a)
497
+ )
498
+
499
+ return demo
455
500
 
456
501
  def run(times, temps, statuses, energies, fractions, ndoms: int = 1, grain_szie=275, atom_density=1e10, frequency=1e13,
457
502
  dimension: int = 3, targets: list = None, epsilon: float = 0.001, simulation: bool = False,
@@ -472,43 +517,12 @@ def run(times, temps, statuses, energies, fractions, ndoms: int = 1, grain_szie=
472
517
  :return:
473
518
  """
474
519
 
475
- demo = DiffSimulation()
476
-
477
- def _(n, es, fs):
478
- # fs 应从大到小,父空间在前,子空间在后
479
-
480
- # demo.grain_size = 300
481
- # demo.size_scale = 0.05
482
- # demo.atom_density = 1e14 # 原子密度 个/立方厘米
483
- demo.dimension = dimension
484
-
485
- demo.size_scale = 1
486
- demo.grain_size = grain_szie
487
- demo.atom_density = atom_density # 原子密度 个/立方厘米
488
- demo.frequency = frequency
489
-
490
- # domains应该从外到内
491
- domains = []
492
- for i in range(n-1, 0-1, -1):
493
- size = int(demo.grain_size * fs[i]) * demo.size_scale
494
- center = np.zeros(demo.dimension)
495
- if i == 2:
496
- ad = demo.atom_density * 5 / 4
497
- else:
498
- ad = demo.atom_density
499
- dom = Domain(
500
- dimension=demo.dimension, atom_density=ad, min_bound=center - size / 2, max_bound=center + size / 2,
501
- energy=es[i], fraction=fs[i], inclusions=[domains[-1]] if len(domains) >= 1 else []
502
- )
503
- domains.append(dom)
504
- # domains应该从外到内, 上面为了inclusion以及方便不同扩散域设置不同的密度,要按照从小到大的顺序生成,但是后面行走的时候要根据不同条件设置系数,要从外到内
505
- demo.domains = sorted(domains, key=lambda dom: dom.fraction, reverse=True)
506
-
507
- demo.setup()
508
-
520
+ try:
521
+ # demo.run_persecond(times=times, temperatures=temps, domains=demo.domains, targets=target,
522
+ # epsilon=epsilon, simulation=simulation)
523
+ demo = demo_init(ndoms, energies, fractions, dimension, grain_szie, atom_density, frequency, ss=1)
509
524
  demo.name = f"{file_name}"
510
-
511
- print(f"Total Atoms: {demo.natoms}, atoms in each dom: {[dom.natoms for dom in demo.domains]} filename: {demo.name}")
525
+ demo.thermal_log = list(zip(times, temps))
512
526
 
513
527
  if positions is not None:
514
528
  demo.positions = positions
@@ -516,13 +530,7 @@ def run(times, temps, statuses, energies, fractions, ndoms: int = 1, grain_szie=
516
530
 
517
531
  demo.run_sequence(times=times, temperatures=temps, statuses=statuses, targets=targets, domains=demo.domains,
518
532
  epsilon=epsilon, simulating=simulation, **kwargs)
519
- # demo.run_persecond(times=times, temperatures=temps, domains=demo.domains, targets=target,
520
- # epsilon=epsilon, simulation=simulation)
521
-
522
- return demo
523
-
524
- try:
525
- return _(ndoms, energies, fractions), True
533
+ return demo, True
526
534
  except OverEpsilonError as e:
527
535
  if ignore_error:
528
536
  return demo, False
ararpy/thermo/basic.py CHANGED
@@ -235,7 +235,7 @@ def get_tc(da2, sda2, E, sE, cooling_rate=10, temp_in_celsius=True, temp=None, A
235
235
  R = 8.314 if R is None else R # in J/K mol
236
236
  Tc = 600
237
237
  sTc = 0
238
- Tm = 99999999 if temp is None else temp
238
+ Tm = 9999999999 if temp is None else temp
239
239
  Tm = Tm + 273.15 if temp_in_celsius else Tm
240
240
  cooling_rate = cooling_rate / 1000000
241
241
 
@@ -243,8 +243,8 @@ def get_tc(da2, sda2, E, sE, cooling_rate=10, temp_in_celsius=True, temp=None, A
243
243
  iter_diff = 100
244
244
  while abs(iter_diff) > 0.01 and iter_num < 100:
245
245
  tau = R * Tc ** 2 / (E * cooling_rate)
246
- # new_Tc = (E/R) / log(A * tau * da2)
247
246
  new_Tc = (R / E) * log(A * tau * da2) + 1 / Tm #
247
+ # new_Tc = (R / E) * log(A * tau * da2)
248
248
  d1 = cooling_rate / (A * da2 * Tc ** 2)
249
249
  s1 = d1 ** 2 * sda2 ** 2 # da2
250
250
  d2 = R / E ** 2 * (log(A * tau * da2) + 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ararpy
3
- Version: 0.1.30
3
+ Version: 0.1.33
4
4
  Summary: A project for Ar-Ar geochronology
5
5
  Home-page: https://github.com/wuyangchn/ararpy.git
6
6
  Author: Yang Wu
@@ -1,4 +1,11 @@
1
- ararpy/__init__.py,sha256=vsCWb5yzto-kGLLNpOzAb74KvfITyybMQ5RgEJJkmlU,6857
1
+ ararpy/Example - Check arr.py,sha256=c9HUUZySUXOYk4eCqiPSp124G2sYpFP5zoMl0FXdalE,1709
2
+ ararpy/Example - Granite Cooling History.py,sha256=V4V63RVp1gocOZX0T3OOGOiVhCA1DqrCyJnXgFvEcUs,14917
3
+ ararpy/Example - Plot temperature calibration.py,sha256=8pR-WKqdaIKQTuuSbfwXuxoEkCop4zhmZUMJSARWDOg,10879
4
+ ararpy/Example - Show MDD results.py,sha256=YFkiQual60lyCClsfvivr4REY6waSYuomf0uo5soUHE,22635
5
+ ararpy/Example - Show all Kfs age spectra.py,sha256=1edPtBpFfS0lC7vLnLu34mDHt_xjbc8ptk6rZ--pf-I,12304
6
+ ararpy/Example - Show random walk results.py,sha256=8WWvbAI7ySiMR-XwtFe5kTQihW3mcqzL3S7EUZdoxYo,15477
7
+ ararpy/Example - Tc calculation.py,sha256=sD9pu3IaZ8mBV95rV2wOEhlQUexFNqBUoBqnNMdUBis,19617
8
+ ararpy/__init__.py,sha256=gPUEjLwZfmGeG3RpVZntFrR9QpnFevpxiyACtYq_gtk,6857
2
9
  ararpy/test.py,sha256=4F46-JJ1Ge12HGae0qO44Qc6kiEMHBgn2MsY_5LlHDo,3973
3
10
  ararpy/calc/__init__.py,sha256=kUjRuLE8TLuKOv3i976RnGJoEMj23QBZDu37LWs81U4,322
4
11
  ararpy/calc/age.py,sha256=WOZs70zXiBWDIEhXJLIaNiYTOFJNk0NDbH5e5zCbCks,5435
@@ -10,8 +17,8 @@ ararpy/calc/histogram.py,sha256=0GVbDdsjd91KQ1sa2B7NtZ4KGo0XpRIJapgIrzAwQUo,5777
10
17
  ararpy/calc/isochron.py,sha256=ej9G2e68k6yszonWHsLcEubh3TA7eh1upTJP_X0ttAA,5726
11
18
  ararpy/calc/jvalue.py,sha256=OL5zPYU8Pac-wOxUWPCgu3onh2n01xDnhpi2mlUsjJM,1146
12
19
  ararpy/calc/plot.py,sha256=sUqjKBdAEjFarUoSCLqf8cbUM0rEAdZhmtyXB2K7LkA,2139
13
- ararpy/calc/raw_funcs.py,sha256=UPwXlYBwE1ugYRD9rsOs8JqJtm14FGcpWmUpUYJ4Roc,2744
14
- ararpy/calc/regression.py,sha256=mHUKobKx-Q9c7E49vPoQA2tA-MwO9BWvCp3VfnuUhUA,39776
20
+ ararpy/calc/raw_funcs.py,sha256=GJ0VW0sc2qPIVp5jSDmPP1ClOoYRa_cc35ye7QDYOiI,2744
21
+ ararpy/calc/regression.py,sha256=lWMoZkovtj5OEYM8eT0FcMsGrDIkKm9rsG45ru3IVuk,39798
15
22
  ararpy/calc/spectra.py,sha256=_Q23eP9necHlaCoHf3_UfW1N3JmVZj5rcWFro8GS-CA,1995
16
23
  ararpy/examples/022_VU124-M11a.ahd,sha256=3m0Gd-ZObou3KsnRNFMf77QwzT1Uz3nu3vA33Sqeyng,5414
17
24
  ararpy/examples/20WHA0103.age,sha256=cT-a4d7Wt77aotx6v0G47vulY_TZIcZUcaVHB3pqTPM,380416
@@ -33,34 +40,34 @@ ararpy/examples/WHA.pdf,sha256=iopbptHkWPmYdgihEVDDfv2nm2XE-Q-e7fFnkR44Xh0,17869
33
40
  ararpy/examples/raw_example.xls,sha256=ftcSiXRx_7nYnbqJVma1Yl3Yr_iuceAWlEjhJwlAvFM,1929895
34
41
  ararpy/examples/sample-default.smp,sha256=YNkoQGgPrsL_fXS7ZHxfRtLQWekCDqT9czS6vBScImk,432
35
42
  ararpy/files/__init__.py,sha256=l5B5ZQ01WdtvjjN0aMkyAFNgpwANdM_1I0tQbqnRuEY,69
36
- ararpy/files/arr_file.py,sha256=KqksGlEA6nmMQofTgi7v45flscQZVtefxaNCKrV3Am4,837
37
- ararpy/files/basic.py,sha256=nc7Hgo_qLSkdmtKzZmd5SQ8Jy0dhW46ly4gh-oisUDs,2095
43
+ ararpy/files/arr_file.py,sha256=pD5MxkAydL7cNq2wmKFUaOU4jHhc3MzTYrwbxZ3f46w,881
44
+ ararpy/files/basic.py,sha256=mGYP7QJBtyasVAYcwT0a9k6tPlcStxASddgzbaxYKkE,2105
38
45
  ararpy/files/calc_file.py,sha256=wbt-cQhPnFJ32QyofXvjCPPehmWSj4CHnidkrP7dFgk,28694
39
46
  ararpy/files/new_file.py,sha256=efblARIBROVLWS2w3-98BxLX5VZ8grRpiTkJFtf_rAk,214
40
- ararpy/files/raw_file.py,sha256=AUvx5Uh3aTQvGy7mXQ7771CeqFZ8u-KgdJvVOD-pU8k,21557
47
+ ararpy/files/raw_file.py,sha256=3vGinbUyTWyQ57jMFIuckrPkN0TrNe1hqKCOAWaj70A,21854
41
48
  ararpy/files/xls.py,sha256=DVcZ_yRnc19p-m4leGGjt-YPDpSa2udYKmGyrM0qub0,640
42
49
  ararpy/smp/EXPORT_TO_PDF_DATA_PROPERTIES.py,sha256=baDM437tu6hsPv0uYfod0TREXlPd6kvMBFT1S9ZZlkk,3024
43
50
  ararpy/smp/__init__.py,sha256=k6_fa27UJsQK7K7oC5GYlwMo6l0Xd8af3QtOrZz2XJk,478
44
51
  ararpy/smp/basic.py,sha256=PMvlSoToY8CJEORRrhEo4rYM2-VfSmjg0IuDpGFOGUM,24899
45
52
  ararpy/smp/calculation.py,sha256=LCFJWjLVLEKEQ5b7RFUIxsMahEzgLdodW4kCYXV5Z34,2919
46
53
  ararpy/smp/consts.py,sha256=XIdjdz8cYxspG2jMnoItdlUsxr3hKbNFJjMZJh1bpzw,393
47
- ararpy/smp/corr.py,sha256=TzH7rymToJP0RCI0pQm-SrqnwAZ58HJbxahE8chv2wQ,26511
48
- ararpy/smp/diffusion_funcs.py,sha256=4-PMMIZWzjk2HOYYWNgSp4GmApygp1MmOxJ2g3xrqWc,175049
49
- ararpy/smp/export.py,sha256=eBUGx9eUHQ7EoibT-PC1HK7Zw_V1LUfuKJv56_XccUQ,117284
54
+ ararpy/smp/corr.py,sha256=U5K1Vld55IHea_fZ7EEY_8dkvjp0f6OhpdSxf7b9WGY,26551
55
+ ararpy/smp/diffusion_funcs.py,sha256=q0kl-AYx7TYeWc1kruKLOl4U4JosIuf1uNmkps11eUs,186694
56
+ ararpy/smp/export.py,sha256=mWnnNg7DYIxcxyqeGXAWUS7faJmO7UHwnMVPX33_aLg,120638
50
57
  ararpy/smp/info.py,sha256=iKUELm-BuUduDlJKC1d8tKKNHbwwbNmhUg2pi6bcBvA,489
51
- ararpy/smp/initial.py,sha256=GFLEYxes-_PT_qgZj0Dagy_blg9JmzjO7uh3vQHbS78,17891
58
+ ararpy/smp/initial.py,sha256=QGk7vh7JyVqalwnpd9VudQoX2Z9tyWzfIIw_cL5Sok0,18031
52
59
  ararpy/smp/json.py,sha256=BTZCjVN0aj9epc700nwkYEYMKN2lHBYo-pLmtnz5oHY,2300
53
- ararpy/smp/plots.py,sha256=rF0vrFu9dMt2Eu1EHiDfDRC9232M6dH0Unc_3qNDxLY,33579
60
+ ararpy/smp/plots.py,sha256=S4TjYbR9BVxMh4pTSTYvhS-rdCz5zXg2wxdFgQlXT28,33582
54
61
  ararpy/smp/raw.py,sha256=51n-rrbW2FqeZHQyevuG7iObPLGvIBzTe414QDVM1FE,6523
55
- ararpy/smp/sample.py,sha256=slKiGUobEG7ZfJW6byBgc9jlWN1-zLg27iEdm-No5dw,58228
56
- ararpy/smp/style.py,sha256=wCygwtpCflhzwmI7u08X-feYGPytOyfR98YcgJx813c,7678
57
- ararpy/smp/table.py,sha256=9bNAOqAIOc0nSC3LNeqjJKUYSJSM28Ji3o9VimwMU8A,6645
62
+ ararpy/smp/sample.py,sha256=iaFjG0S0GuNwbLeUFpzEFIbqa0oX0KekRZuLJd2mSCQ,58903
63
+ ararpy/smp/style.py,sha256=Q8f6SsqnxmzocxpZUyGDiNanVW0ijCZpxHKh19UIeoM,7800
64
+ ararpy/smp/table.py,sha256=Vq3GK9aslEuBhmvlQoUHjcs71Q6raSFYqd5veB1L9mk,6887
58
65
  ararpy/thermo/__init__.py,sha256=6VBuqTRFl403PVqOuMkVrut0nKaQsAosBmfW91X1dMg,263
59
66
  ararpy/thermo/arrhenius.py,sha256=Ass1ichHfqIAtpv8eLlgrUc1UOb3Urh1qzr1E3gLB4U,233
60
- ararpy/thermo/atomic_level_random_walk.py,sha256=Q97zfe2h2RaxADkoBAqd0uEiP16BFOajrTmXHMkL2EQ,25502
61
- ararpy/thermo/basic.py,sha256=nBGHI9uK7VdJwThwBIOcKAzdnYqPyQseFoY6s4zKizk,11504
62
- ararpy-0.1.30.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
- ararpy-0.1.30.dist-info/METADATA,sha256=OkwCC5DEb-8Q_ZtpeNhcLuYsBvA6nzyVQ6ZMpRYjkko,24516
64
- ararpy-0.1.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
- ararpy-0.1.30.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
- ararpy-0.1.30.dist-info/RECORD,,
67
+ ararpy/thermo/atomic_level_random_walk.py,sha256=ncw9DtxRfS6zlQbLVLNX7WNoO9sX_nSomwAsTH0_O3k,25910
68
+ ararpy/thermo/basic.py,sha256=JJRZbYmvXlpRAV2FeFPwLhrig4ZhNQmJnWqgOjo-1YQ,11508
69
+ ararpy-0.1.33.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
70
+ ararpy-0.1.33.dist-info/METADATA,sha256=pr2__kQa2tcCCieNzCLX58QgKwXWD-ur1uKfM5N47JQ,24516
71
+ ararpy-0.1.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
72
+ ararpy-0.1.33.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
73
+ ararpy-0.1.33.dist-info/RECORD,,