ararpy 0.1.30__py3-none-any.whl → 0.1.31__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 CHANGED
@@ -16,7 +16,7 @@ from . import calc, smp, files, thermo, test
16
16
  """ Information """
17
17
 
18
18
  name = 'ararpy'
19
- version = '0.1.26'
19
+ version = '0.1.31'
20
20
  __version__ = version
21
21
  full_version = version
22
22
  last_update = '2024-05-22'
ararpy/smp/corr.py CHANGED
@@ -365,12 +365,12 @@ def calc_nor_inv_isochrons(sample: Sample):
365
365
  n = len(sample.SequenceName)
366
366
  try:
367
367
  isochron_1 = calc.isochron.get_data(
368
- *calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
368
+ *calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138]),
369
369
  *calc.arr.sub(sample.CorrectedValues[8:10], sample.DegasValues[30:32]),
370
370
  *sample.DegasValues[0:2]
371
371
  )
372
372
  isochron_2 = calc.isochron.get_data(
373
- *calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
373
+ *calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138]),
374
374
  *sample.DegasValues[0:2],
375
375
  *calc.arr.sub(sample.CorrectedValues[8:10], sample.DegasValues[30:32]))
376
376
  except (BaseException, Exception):
@@ -383,17 +383,17 @@ def calc_cl_isochrons(sample: Sample):
383
383
  n = len(sample.SequenceName)
384
384
  try:
385
385
  isochron_3 = calc.isochron.get_data(
386
- *calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
386
+ *calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138]),
387
387
  *sample.DegasValues[24:26],
388
- *calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor))
388
+ *calc.arr.mul(sample.DegasValues[10:12], sample.TotalParam[136:138]))
389
389
  isochron_4 = calc.isochron.get_data(
390
- *calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor),
391
- *calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor),
390
+ *calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138]),
391
+ *calc.arr.mul(sample.DegasValues[10:12], sample.TotalParam[136:138]),
392
392
  *sample.DegasValues[24:26])
393
393
  isochron_5 = calc.isochron.get_data(
394
- *calc.arr.mul(sample.DegasValues[10:12], sample.NormalizeFactor),
394
+ *calc.arr.mul(sample.DegasValues[10:12], sample.TotalParam[136:138]),
395
395
  *sample.DegasValues[24:26],
396
- *calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor))
396
+ *calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138]))
397
397
  except (BaseException, Exception):
398
398
  return np.zeros([5, n]), np.zeros([5, n]), np.zeros([5, n])
399
399
  else:
@@ -451,7 +451,7 @@ def calc_ratio(sample: Sample, monte_carlo: bool = False):
451
451
  sample.ApparentAgeValues[0:2] = ar40aar36a
452
452
  sample.ApparentAgeValues[7] = ar36a_percent
453
453
  else:
454
- ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.NormalizeFactor)
454
+ ar39k, sar39k = calc.arr.mul(sample.DegasValues[20:22], sample.TotalParam[136:138])
455
455
  sum_ar39k = sum(ar39k)
456
456
  ar39k_percent = [item / sum_ar39k * 100 if sum_ar39k != 0 else 0 for item in ar39k]
457
457
  ar40rar39k = calc.arr.mul_factor(
@@ -545,7 +545,7 @@ def monte_carlo_f(sample: Sample):
545
545
  R36v38clp = np.transpose(sample.TotalParam[56:58])
546
546
 
547
547
  stand_time_year = np.transpose(sample.TotalParam[32])
548
- JNFactor = np.transpose(sample.NormalizeFactor)
548
+ JNFactor = np.transpose(sample.TotalParam[136:138])
549
549
 
550
550
  irradiation_cycles = [list(filter(None, re.split(r'[DS]', each_step))) for each_step in sample.TotalParam[27]]
551
551
  t1 = [re.findall(r"\d+", i) for i in sample.TotalParam[31]] # t1: experimental times
ararpy/smp/initial.py CHANGED
@@ -334,7 +334,7 @@ def check_version(smp: Sample):
334
334
  v, sv = smp.TotalParam[59:61]
335
335
  except:
336
336
  doNormalize = False
337
- smp.NormalizeFactor = [
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
  ]
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.NormalizeFactor)
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.NormalizeFactor)
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.NormalizeFactor)
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]
ararpy/smp/sample.py CHANGED
@@ -169,6 +169,7 @@ 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 = [
@@ -283,6 +284,7 @@ TOTAL_PARAMS_SHORT_HEADERS = [
283
284
  '38Gain', '%1s', # 132-133
284
285
  '39Gain', '%1s', # 134-135
285
286
  '40Gain', '%1s', # 136-137
287
+ 'NormalizeFactor', '1\u03C3', # 138-139
286
288
  ]
287
289
 
288
290
  DEFAULT_PLOT_STYLES = lambda sample_type, age_unit: {
@@ -776,7 +778,7 @@ DEFAULT_PLOT_STYLES = lambda sample_type, age_unit: {
776
778
  },
777
779
  }
778
780
 
779
- VERSION = '20250622'
781
+ VERSION = '20250806'
780
782
 
781
783
  NAMED_DICT = {
782
784
  "unknown": {"header": SAMPLE_INTERCEPT_HEADERS.copy()},
@@ -845,7 +847,6 @@ class Sample:
845
847
  self.SelectedSequence2 = []
846
848
  self.UnselectedSequence = []
847
849
  self.IsochronMark = []
848
- self.NormalizeFactor = [[], []]
849
850
 
850
851
  # Tables and Plots
851
852
  self.UnknownTable = Table()
@@ -373,7 +373,7 @@ class DiffSimulation:
373
373
  boundary_factor = 0.1 ** (k * math.log10(1 + (max(conditions[:, -1]) // 1000)))
374
374
  step_length = self.step_length / np.sqrt(pos.shape[1] if len(pos.shape) > 1 else 1)
375
375
  scale = int(total_steps)
376
- # print(f"调整后: {nsteps_factor = }, gamma = {conditions[0][-1]}, {total_steps = }, {compensation = }, {boundary_factor = }")
376
+ print(f"调整后: {nsteps_factor = }, gamma = {conditions[0][-1]}, {total_steps = }, {compensation = }, {boundary_factor = }")
377
377
 
378
378
  _pos = walker(
379
379
  copy.deepcopy(pos), step_length=step_length, total_nsteps=total_steps,
@@ -437,7 +437,7 @@ class DiffSimulation:
437
437
  self.remained_per_step.append(len(pos))
438
438
  self.released_per_step.append(self.natoms - len(pos))
439
439
 
440
- print(f"{index = } {duration} - {heating_duration = } - {temperature = } - {total_steps = } - conc = {len(pos) / self.natoms * 100:.2f}% - {time.time() - _start:.5f}s")
440
+ 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
441
 
442
442
  self.positions = copy.deepcopy(pos)
443
443
 
@@ -452,6 +452,49 @@ class DiffSimulation:
452
452
  return self.run_sequence(*seq, domains=domains, nsteps_factor=scale, simulating=simulation,
453
453
  epsilon=epsilon, start_time=start_time)
454
454
 
455
+ def demo_init(n, es, fs, di, gs, ds, fr, ss=1):
456
+ demo = DiffSimulation()
457
+ # fs 应从大到小,父空间在前,子空间在后
458
+
459
+ # demo.grain_size = 300
460
+ # demo.size_scale = 0.05
461
+ # demo.atom_density = 1e14 # 原子密度 个/立方厘米
462
+
463
+ demo.dimension = di # dimension, 1 or 3
464
+ demo.size_scale = 1 # size_scale
465
+ demo.grain_size = gs # grain_szie
466
+ demo.frequency = fr # frequency
467
+
468
+ # domains应该从外到内
469
+ domains = []
470
+ for i in range(n-1, 0-1, -1):
471
+ size = int(demo.grain_size * fs[i]) * demo.size_scale
472
+ center = np.zeros(demo.dimension)
473
+ if isinstance(ds, (int, float)) or len(ds) == 1:
474
+ demo.atom_density = ds # atom_density # 原子密度 个/立方厘米
475
+ if i == 2:
476
+ ad = ds * 5 / 4
477
+ else:
478
+ ad = ds
479
+ else:
480
+ ad = ds[i]
481
+ dom = Domain(
482
+ dimension=demo.dimension, atom_density=ad, min_bound=center - size / 2, max_bound=center + size / 2,
483
+ energy=es[i], fraction=fs[i], inclusions=[domains[-1]] if len(domains) >= 1 else []
484
+ )
485
+ domains.append(dom)
486
+ # domains应该从外到内, 上面为了inclusion以及方便不同扩散域设置不同的密度,要按照从小到大的顺序生成,但是后面行走的时候要根据不同条件设置系数,要从外到内
487
+ demo.domains = sorted(domains, key=lambda dom: dom.fraction, reverse=True)
488
+
489
+ demo.setup()
490
+
491
+ a = [f"{dom.fraction = }, {dom.energy = }, {dom.natoms = }, {dom.atom_density = }" for dom in demo.domains]
492
+
493
+ print(
494
+ f"Total Atoms: {demo.natoms}\n" + "\n".join(a)
495
+ )
496
+
497
+ return demo
455
498
 
456
499
  def run(times, temps, statuses, energies, fractions, ndoms: int = 1, grain_szie=275, atom_density=1e10, frequency=1e13,
457
500
  dimension: int = 3, targets: list = None, epsilon: float = 0.001, simulation: bool = False,
@@ -472,57 +515,19 @@ def run(times, temps, statuses, energies, fractions, ndoms: int = 1, grain_szie=
472
515
  :return:
473
516
  """
474
517
 
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
-
518
+ try:
519
+ # demo.run_persecond(times=times, temperatures=temps, domains=demo.domains, targets=target,
520
+ # epsilon=epsilon, simulation=simulation)
521
+ demo = demo_init(ndoms, energies, fractions, dimension, grain_szie, atom_density, frequency, ss=1)
509
522
  demo.name = f"{file_name}"
510
523
 
511
- print(f"Total Atoms: {demo.natoms}, atoms in each dom: {[dom.natoms for dom in demo.domains]} filename: {demo.name}")
512
-
513
524
  if positions is not None:
514
525
  demo.positions = positions
515
526
  demo.natoms = len(positions)
516
527
 
517
528
  demo.run_sequence(times=times, temperatures=temps, statuses=statuses, targets=targets, domains=demo.domains,
518
529
  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
530
+ return demo, True
526
531
  except OverEpsilonError as e:
527
532
  if ignore_error:
528
533
  return demo, False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ararpy
3
- Version: 0.1.30
3
+ Version: 0.1.31
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,4 @@
1
- ararpy/__init__.py,sha256=vsCWb5yzto-kGLLNpOzAb74KvfITyybMQ5RgEJJkmlU,6857
1
+ ararpy/__init__.py,sha256=4NVQopyzptK_z2c7IrMwGSekzQ2reMbk0O2dSq9Maxw,6857
2
2
  ararpy/test.py,sha256=4F46-JJ1Ge12HGae0qO44Qc6kiEMHBgn2MsY_5LlHDo,3973
3
3
  ararpy/calc/__init__.py,sha256=kUjRuLE8TLuKOv3i976RnGJoEMj23QBZDu37LWs81U4,322
4
4
  ararpy/calc/age.py,sha256=WOZs70zXiBWDIEhXJLIaNiYTOFJNk0NDbH5e5zCbCks,5435
@@ -44,23 +44,23 @@ ararpy/smp/__init__.py,sha256=k6_fa27UJsQK7K7oC5GYlwMo6l0Xd8af3QtOrZz2XJk,478
44
44
  ararpy/smp/basic.py,sha256=PMvlSoToY8CJEORRrhEo4rYM2-VfSmjg0IuDpGFOGUM,24899
45
45
  ararpy/smp/calculation.py,sha256=LCFJWjLVLEKEQ5b7RFUIxsMahEzgLdodW4kCYXV5Z34,2919
46
46
  ararpy/smp/consts.py,sha256=XIdjdz8cYxspG2jMnoItdlUsxr3hKbNFJjMZJh1bpzw,393
47
- ararpy/smp/corr.py,sha256=TzH7rymToJP0RCI0pQm-SrqnwAZ58HJbxahE8chv2wQ,26511
47
+ ararpy/smp/corr.py,sha256=U5K1Vld55IHea_fZ7EEY_8dkvjp0f6OhpdSxf7b9WGY,26551
48
48
  ararpy/smp/diffusion_funcs.py,sha256=4-PMMIZWzjk2HOYYWNgSp4GmApygp1MmOxJ2g3xrqWc,175049
49
49
  ararpy/smp/export.py,sha256=eBUGx9eUHQ7EoibT-PC1HK7Zw_V1LUfuKJv56_XccUQ,117284
50
50
  ararpy/smp/info.py,sha256=iKUELm-BuUduDlJKC1d8tKKNHbwwbNmhUg2pi6bcBvA,489
51
- ararpy/smp/initial.py,sha256=GFLEYxes-_PT_qgZj0Dagy_blg9JmzjO7uh3vQHbS78,17891
51
+ ararpy/smp/initial.py,sha256=YjHpdzlMxRQXyBOMe9Kd3-nNsjPjCWCub5mUcnprhAw,17895
52
52
  ararpy/smp/json.py,sha256=BTZCjVN0aj9epc700nwkYEYMKN2lHBYo-pLmtnz5oHY,2300
53
- ararpy/smp/plots.py,sha256=rF0vrFu9dMt2Eu1EHiDfDRC9232M6dH0Unc_3qNDxLY,33579
53
+ ararpy/smp/plots.py,sha256=9w20cne704jmJl4btWk0LWcrHRqV5-DQmgG3Cq_GeEk,33591
54
54
  ararpy/smp/raw.py,sha256=51n-rrbW2FqeZHQyevuG7iObPLGvIBzTe414QDVM1FE,6523
55
- ararpy/smp/sample.py,sha256=slKiGUobEG7ZfJW6byBgc9jlWN1-zLg27iEdm-No5dw,58228
55
+ ararpy/smp/sample.py,sha256=JVHCYOxZm_So1UXWcWIsMWz0pbPayR0gSrolxOGuUu4,58280
56
56
  ararpy/smp/style.py,sha256=wCygwtpCflhzwmI7u08X-feYGPytOyfR98YcgJx813c,7678
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
- ararpy/thermo/atomic_level_random_walk.py,sha256=Q97zfe2h2RaxADkoBAqd0uEiP16BFOajrTmXHMkL2EQ,25502
60
+ ararpy/thermo/atomic_level_random_walk.py,sha256=kmP1Fu3wZhIJqxvOJIWbO8rFsSBMKE-6lrBA8oJtuP8,25772
61
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,,
62
+ ararpy-0.1.31.dist-info/licenses/LICENSE,sha256=cvG5t_C1qY_zUyJI7sNOa7gCArdngNPaOrfujl2LYuc,1085
63
+ ararpy-0.1.31.dist-info/METADATA,sha256=zhXfAk7Vx34WjBVUE_jSw4rM27BuSom462BCxssWvvU,24516
64
+ ararpy-0.1.31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
+ ararpy-0.1.31.dist-info/top_level.txt,sha256=9iTpsPCYuRYq09yQTk9d2lqB8JtTEOmbN-IcGB-K3vY,7
66
+ ararpy-0.1.31.dist-info/RECORD,,