ararpy 0.1.198__py3-none-any.whl → 0.2.1__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.
Files changed (41) hide show
  1. ararpy/Example - Check arr.py +52 -0
  2. ararpy/Example - Granite Cooling History.py +411 -0
  3. ararpy/Example - Plot temperature calibration.py +291 -0
  4. ararpy/Example - Show MDD results.py +561 -0
  5. ararpy/Example - Show all Kfs age spectra.py +344 -0
  6. ararpy/Example - Show random walk results.py +363 -0
  7. ararpy/Example - Tc calculation.py +437 -0
  8. ararpy/__init__.py +3 -4
  9. ararpy/calc/age.py +34 -36
  10. ararpy/calc/arr.py +5 -24
  11. ararpy/calc/basic.py +26 -3
  12. ararpy/calc/corr.py +135 -89
  13. ararpy/calc/jvalue.py +1 -1
  14. ararpy/calc/plot.py +6 -4
  15. ararpy/calc/raw_funcs.py +41 -2
  16. ararpy/calc/regression.py +224 -132
  17. ararpy/files/arr_file.py +2 -1
  18. ararpy/files/basic.py +0 -22
  19. ararpy/files/calc_file.py +107 -84
  20. ararpy/files/raw_file.py +242 -229
  21. ararpy/smp/basic.py +202 -46
  22. ararpy/smp/calculation.py +6 -6
  23. ararpy/smp/corr.py +339 -154
  24. ararpy/smp/diffusion_funcs.py +345 -36
  25. ararpy/smp/export.py +247 -129
  26. ararpy/smp/info.py +2 -2
  27. ararpy/smp/initial.py +105 -48
  28. ararpy/smp/json.py +2 -2
  29. ararpy/smp/plots.py +225 -218
  30. ararpy/smp/raw.py +11 -15
  31. ararpy/smp/sample.py +257 -183
  32. ararpy/smp/style.py +48 -22
  33. ararpy/smp/table.py +42 -33
  34. ararpy/thermo/atomic_level_random_walk.py +56 -48
  35. ararpy/thermo/basic.py +2 -2
  36. {ararpy-0.1.198.dist-info → ararpy-0.2.1.dist-info}/METADATA +1 -1
  37. ararpy-0.2.1.dist-info/RECORD +73 -0
  38. {ararpy-0.1.198.dist-info → ararpy-0.2.1.dist-info}/WHEEL +1 -1
  39. ararpy-0.1.198.dist-info/RECORD +0 -66
  40. {ararpy-0.1.198.dist-info → ararpy-0.2.1.dist-info}/licenses/LICENSE +0 -0
  41. {ararpy-0.1.198.dist-info → ararpy-0.2.1.dist-info}/top_level.txt +0 -0
ararpy/smp/raw.py CHANGED
@@ -22,7 +22,7 @@ RawData = samples.RawData
22
22
  Sequence = samples.Sequence
23
23
 
24
24
 
25
- def to_raw(file_path: Union[str, List[str]], input_filter_path: Union[str, List[str]], **kwargs):
25
+ def to_raw(file_path: Union[str, List[str]], input_filter_path: Union[str, List[str]], file_name=None, **kwargs):
26
26
  """ Read raw data from files, can create raw data instance based on the given files
27
27
  Raw data will have the structure like:
28
28
  [
@@ -35,6 +35,7 @@ def to_raw(file_path: Union[str, List[str]], input_filter_path: Union[str, List[
35
35
  ----------
36
36
  file_path
37
37
  input_filter_path
38
+ file_name
38
39
  kwargs
39
40
 
40
41
  Returns
@@ -42,22 +43,18 @@ def to_raw(file_path: Union[str, List[str]], input_filter_path: Union[str, List[
42
43
 
43
44
  """
44
45
  if isinstance(file_path, list) and isinstance(input_filter_path, list):
45
- raw = concatenate([to_raw(file, input_filter_path[index]) for index, file in enumerate(file_path)])
46
+ raw = concatenate([to_raw(file, input_filter_path[index],
47
+ file_name[index] if isinstance(file_name, list) else file_name) for index, file in enumerate(file_path)])
46
48
  elif isinstance(file_path, str) and isinstance(input_filter_path, str):
47
49
  input_filter = read_params(input_filter_path)
48
- file_name = str(os.path.split(file_path)[-1]).split('.')[0]
49
- res = raw_file.open_file(file_path, input_filter)
50
+ file_name = str(os.path.split(file_path)[-1]).split('.')[0] if file_name is None else file_name
51
+ res = raw_file.open_file(file_path, input_filter, file_name)
50
52
  data = res.get('data', None)
51
53
  sequences = res.get('sequences', None)
52
54
  sequence_num = len(data) if data is not None else len(sequences)
53
- # default fitting method, all exponential
54
- # <option value=0>Linear</option>
55
- # <option value=1>Quadratic</option>
56
- # <option value=2>Exponential</option>
57
- # <option value=3>Power</option>
58
- # <option value=4>Average</option>
59
- fitting_method = [2, 0, 2, 2, 2]
60
- raw = RawData(name=file_name, data=data, isotopic_num=10, sequence_num=sequence_num, source=[file_path],
55
+ experiment_name = data[0][0][2]['ExpName'] if data is not None else file_name
56
+ fitting_method = [2, 0, 2, 2, 2] # 0 - linear, 1 - quadratic, 2 - exponential, 3 - power, 4 - average
57
+ raw = RawData(name=experiment_name, data=data, isotopic_num=10, sequence_num=sequence_num, source=[file_path],
61
58
  sequence=sequences, unit=str(input_filter[30]), fitting_method=[*fitting_method])
62
59
  else:
63
60
  raise ValueError("File path and input filter should be both string or list with a same length.")
@@ -156,11 +153,10 @@ def do_regression(raw: RawData, sequence_index: Optional[List] = None, isotopic_
156
153
  # unselected: list = [unselected[[isotopic_index*2 + 1, 2 * (isotopic_index + 1)]].dropna().values.tolist()
157
154
  # for isotopic_index in list(range(5))]
158
155
 
159
- for index, isotope in enumerate(selected):
156
+ for index, isotopic_data in enumerate(selected):
160
157
  if hasattr(isotopic_index, '__getitem__') and index not in isotopic_index:
161
158
  continue
162
- # print(f"regression for {sequence.name = }, isotope {index = }")
163
- res = raw_funcs.get_raw_data_regression_results(isotope)
159
+ res = raw_funcs.get_raw_data_regression_results(isotopic_data)
164
160
  try:
165
161
  sequence.results[index] = res[1]
166
162
  sequence.coefficients[index] = res[2]