screamlab 0.3.1__py3-none-any.whl → 0.3.2__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.
Binary file
Binary file
screamlab/dataset.py CHANGED
@@ -182,9 +182,11 @@ class Dataset:
182
182
  "biexponential_with_offset": utils.BiexpFitterWithOffset,
183
183
  "exponential": utils.ExpFitter,
184
184
  "exponential_with_offset": utils.ExpFitterWithOffset,
185
- "stretched_exponential": utils.StrechedExponentialFitter,
185
+ "stretched_exponential": utils.StretchedExponentialFitter,
186
186
  "exponential_decay": utils.ExpDecayFitter,
187
187
  "exponential_decay_with_offset": utils.ExpDecayFitterWithOffset,
188
+ "stretched_exponential_decay": utils.StretchedExponentialDecayFitter,
189
+ "biexponential_decay": utils.BiexponentialDecayFitter,
188
190
  }
189
191
 
190
192
  for b_type in self.props.buildup_types:
screamlab/functions.py CHANGED
@@ -169,6 +169,53 @@ def calc_stretched_exponential(time_vals, param):
169
169
  )
170
170
 
171
171
 
172
+ def calc_stretchedexpdecay(time_vals, param):
173
+ """
174
+ Compute values of a stretched exponential decay function over time.
175
+
176
+ The function models the equation:
177
+ I(t) = Af * exp((-t / tf)^beta)
178
+
179
+ where:
180
+ - I(t) : The output value at time t
181
+ - A : Amplitude (maximum value the function approaches)
182
+ - tf : Time constant (controls the rate of growth)
183
+ - beta : stretching exponent
184
+
185
+ Returns
186
+ -------
187
+ list: Stretched exponential profile evaluated at t.
188
+
189
+ """
190
+ return list(
191
+ param[0] * np.exp(-((np.asarray(time_vals) / param[1]) ** param[2]))
192
+ )
193
+
194
+
195
+ def calc_biexpdecay(time_vals, param):
196
+ """
197
+ Compute values of a biexponential decay function over time.
198
+
199
+ The function models the equation:
200
+ I(t) = Af * exp(-t / tf)) + As * exp(-t / ts))
201
+
202
+ where:
203
+ - I(t) : The output value at time t
204
+ - Af, As: Amplitudes (maximum value the function approaches)
205
+ - tf, ts: Time constants (controls the rate of growth)
206
+
207
+
208
+ Returns
209
+ -------
210
+ list: Biexponential profile evaluated at t.
211
+
212
+ """
213
+ return list(
214
+ param[0] * np.exp(-np.asarray(time_vals) / param[2])
215
+ + param[1] * np.exp(-np.asarray(time_vals) / param[3])
216
+ )
217
+
218
+
172
219
  def calc_expdecay(time_vals, param):
173
220
  """
174
221
  Compute values of an exponential growth function over time.
@@ -459,6 +506,32 @@ def format_mapping():
459
506
  "---",
460
507
  "I0",
461
508
  ],
509
+ "stretched_exponential_decay": [
510
+ "Af",
511
+ "tf",
512
+ "---",
513
+ "---",
514
+ "---",
515
+ "Rf",
516
+ "---",
517
+ "Sf",
518
+ "---",
519
+ "beta",
520
+ "---",
521
+ ],
522
+ "biexponential_decay": [
523
+ "Af",
524
+ "tf",
525
+ "As",
526
+ "ts",
527
+ "---",
528
+ "Rf",
529
+ "Rs",
530
+ "Sf",
531
+ "Ss",
532
+ "---",
533
+ "---",
534
+ ],
462
535
  }
463
536
 
464
537
 
@@ -506,6 +579,8 @@ def return_func_map():
506
579
  "stretched_exponential": calc_stretched_exponential,
507
580
  "exponential_decay": calc_expdecay,
508
581
  "exponential_decay_with_offset": calc_expdecaywithoffset,
582
+ "stretched_exponential_decay": calc_stretchedexpdecay,
583
+ "biexponential_decay": calc_biexpdecay,
509
584
  }
510
585
 
511
586
 
screamlab/io.py CHANGED
@@ -320,7 +320,7 @@ class Exporter:
320
320
  self._plot_buildup(buildup_type)
321
321
  if self.dataset.props.spectrum_fit_type != "numint":
322
322
  self._write_global_fit_results_to_semicolon_separated_file()
323
- self._write_buildup_fit_to_semicolon_separated_file()
323
+ self._write_buildup_fit_to_semicolon_separated_file()
324
324
  self._csv_output()
325
325
 
326
326
  def _plot_topspin_data(self):
screamlab/settings.py CHANGED
@@ -217,7 +217,8 @@ class Properties:
217
217
  List of str, optional: A list of buildup function types
218
218
 
219
219
  Options supporded: "exponential","biexponential", "exponential_with_offset",
220
- "biexponential_with_offset", "stretched_exponential".
220
+ "biexponential_with_offset", "stretched_exponential",
221
+ "stretched_exponential_decay", "biexponential_decay".
221
222
 
222
223
  Default is ["exponential"].
223
224
 
@@ -235,6 +236,8 @@ class Properties:
235
236
  "stretched_exponential",
236
237
  "exponential_decay",
237
238
  "exponential_decay_with_offset",
239
+ "stretched_exponential_decay",
240
+ "biexponential_decay",
238
241
  }
239
242
  if not isinstance(value, list):
240
243
  raise TypeError(
screamlab/utils.py CHANGED
@@ -20,6 +20,9 @@ Classes:
20
20
  - BiexpFitterWithOffset: A variant of `BiexpFitter`
21
21
  with an additional offset parameter.
22
22
  - StretchedExponentialFitter: A fitter for stretched exponential buildup behavior.
23
+ - ExponentialDecayFitter: A fitter for exponential decay behaviour.
24
+ - StretchedExponentialDecayFitter: A fitter for stretched exponential decay behaviour.
25
+ - BiexponentialDecayFitter: A fitter for biexponential decay behaviour
23
26
  """
24
27
 
25
28
  import copy
@@ -718,6 +721,92 @@ class BiexpFitter(BuildupFitter):
718
721
  return functions.calc_biexponential(tdel, param)
719
722
 
720
723
 
724
+ class StretchedExponentialDecayFitter(BuildupFitter):
725
+ """
726
+ Class for fitting streched exponential decay data.
727
+
728
+ This fits buildup curves using an streched exponential term
729
+ characterized by amplitude (Af), time constant (tf), and stretching factor (beta)..
730
+
731
+ The model function is defined as:
732
+ I(t) = Af * exp(-(t_pol / tf)^beta))
733
+
734
+ where:
735
+ - Af : amplitudes of the exponential components
736
+ - tf : time constants of the exponential components (tf > 0)
737
+ - beta : stretching factor (beta > 0, controls deviation from a simple exponential)
738
+ - t_pol : polarization time (independent variable)
739
+ - I(t_pol): peak intensity at polarization time t_pol
740
+
741
+
742
+ """
743
+
744
+ def _get_default_param_dict(self, peak):
745
+ """
746
+ Define default parameters for strechted exponential fitting.
747
+
748
+ :param peak: Peak object containing peak_sign and buildup values.
749
+ :return: Dictionary of default parameters with keys: Af, tf, beta.
750
+ """
751
+ return {
752
+ "Af": self._get_intensity_dict(peak),
753
+ "tf": self._get_time_dict(peak),
754
+ "beta": self._get_beta_dict(),
755
+ }
756
+
757
+ def _calc_intensity(self, tdel, param):
758
+ """
759
+ Calculate exponential decay intensity.
760
+
761
+ :param tdel: Time delays.
762
+ :param param: List of parameters.
763
+ :return: Calculated intensity values.
764
+ """
765
+ return functions.calc_stretchedexpdecay(tdel, param)
766
+
767
+
768
+ class BiexponentialDecayFitter(BuildupFitter):
769
+ """
770
+ Class for fitting biexponential decay data.
771
+
772
+ The biexponential model fits buildup curves using two exponential terms
773
+ characterized by amplitudes (Af, As) and time constants (tf, ts).
774
+
775
+ The model function is defined as:
776
+ I(t) = Af * exp(-t_pol / tf)) + As * exp(-t_pol / ts))
777
+
778
+ where:
779
+ - Af, As : amplitudes of the exponential components
780
+ - tf, ts : time constants of the exponential components (tf, ts > 0)
781
+ - t_pol : polarization time (independent variable)
782
+ - I(t_pol) : peak intensity at polarization time t_pol
783
+ """
784
+
785
+ def _get_default_param_dict(self, peak):
786
+ """
787
+ Define default parameters for biexponential fitting.
788
+
789
+ :param peak: Peak object containing peak_sign and buildup values.
790
+ :return: Dictionary of default parameters with keys: Af, As, tf, ts.
791
+ """
792
+ return {
793
+ "Af": self._get_intensity_dict(peak),
794
+ "As": self._get_intensity_dict(peak),
795
+ "tf": self._get_time_dict(peak),
796
+ "ts": self._get_time_dict(peak),
797
+ }
798
+
799
+ def _calc_intensity(self, tdel, param):
800
+ """
801
+ Calculate exponential decay intensity.
802
+
803
+ :param tdel: Time delays.
804
+ :param param: List of parameters.
805
+ :return: Calculated intensity values.
806
+ """
807
+ return functions.calc_biexpdecay(tdel, param)
808
+
809
+
721
810
  class ExpDecayFitter(BuildupFitter):
722
811
  """
723
812
  Class for fitting exponential decay models to experimental data.
@@ -726,7 +815,7 @@ class ExpDecayFitter(BuildupFitter):
726
815
  characterized by an amplitude (A) and a time constants (t).
727
816
 
728
817
  The model function is defined as:
729
- I(t_pol) = A * exp(-t_pol / t))
818
+ I(t_pol) = A * exp(-t_pol / t)
730
819
 
731
820
  where:
732
821
  - A : amplitudes of the exponential components
@@ -766,7 +855,7 @@ class ExpDecayFitterWithOffset(BuildupFitter):
766
855
  characterized by an amplitude (A), an intensity offset (I0) and a time constants (t).
767
856
 
768
857
  The model function is defined as:
769
- I(t_pol) = I0 + A * exp(-t_pol / t))
858
+ I(t_pol) = I0 + A * exp(-t_pol / t)
770
859
 
771
860
  where:
772
861
  - A : amplitudes of the exponential components
@@ -926,7 +1015,7 @@ class ExpFitterWithOffset(BuildupFitter):
926
1015
  return functions.calc_exponential_with_offset(tdel, param)
927
1016
 
928
1017
 
929
- class StrechedExponentialFitter(BuildupFitter):
1018
+ class StretchedExponentialFitter(BuildupFitter):
930
1019
  """
931
1020
  Class for fitting streched exponential models to buildup data.
932
1021
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: screamlab
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Package for reproducible evaluation of SCREAM-DNP data.
5
5
  Home-page: https://github.com/FlorianTaube/screamlab
6
6
  Author: Florian Taube
@@ -0,0 +1,30 @@
1
+ screamlab/__init__.py,sha256=M2vfzk7vI3qvlxE2uIHyGYmPSrFYNUacFjkjiLX00wc,63
2
+ screamlab/dataset.py,sha256=LKwWYzimHDwA3_-YX6ycjEiSWqHUbHTUjXZMCASzEoQ,26989
3
+ screamlab/functions.py,sha256=vLfxzJhhtsfYI8-V2k__jZWhTIKlgqWi03tEmRmhf10,16583
4
+ screamlab/io.py,sha256=TwN4NDko228qboI_oV6pudHYTLuANeRI8BtUX-mVIKA,42964
5
+ screamlab/settings.py,sha256=7eZoxvwW_dJBuP82ID-3hWodel5RH-Ocme_dFYJY25I,9602
6
+ screamlab/utils.py,sha256=1pGyfKHpe-F5O9fuDhk2XRAnQAjv8lqAmTCMTSyLUpI,37541
7
+ screamlab/__pycache__/__init__.cpython-310.pyc,sha256=nGadfOt1WUjQxMQAWhkaJ8HQIBoFYgJOXOcou6xtrJ4,245
8
+ screamlab/__pycache__/__init__.cpython-312.pyc,sha256=Vo2caaR8VoJ8_NleXq-XOrPKFsFfwxsYJtyJjRxMaAQ,253
9
+ screamlab/__pycache__/__init__.cpython-313.pyc,sha256=yQf9pPv0AH2e55exkKjAhkP7dXZn17lnMgudh9XDnxo,249
10
+ screamlab/__pycache__/__init__.cpython-38.pyc,sha256=M5eZ95kmsA8r__ZH_prnNqi--MGl8WclL9g0yUXGTAo,176
11
+ screamlab/__pycache__/dataset.cpython-310.pyc,sha256=8g5sTDsbJyhSEIIlKkXWpiMPR9jiQsvMFnrL8-sgJRs,25083
12
+ screamlab/__pycache__/dataset.cpython-312.pyc,sha256=6I6pajXpcAGzgMMWz8Uz8RBFvHhamr8ldh4LYvgmVHY,29658
13
+ screamlab/__pycache__/dataset.cpython-313.pyc,sha256=d7OmTHMmM5b84ZnEJYZgxi_mkB6OM0brW-5-1VINzpA,34201
14
+ screamlab/__pycache__/functions.cpython-310.pyc,sha256=VKjrzFjO7PIFSJeS6TvZRt_7tbcXfA1S76uX0ij4FmI,13473
15
+ screamlab/__pycache__/functions.cpython-312.pyc,sha256=3XGaxzxxkM11879B0tD2igT9kx-_s3lk1fhABYwIPec,13136
16
+ screamlab/__pycache__/functions.cpython-313.pyc,sha256=ozCyYcTb6HU6BBgz0Byag3-EYVdqTTNHmU1VqAFnVNU,12631
17
+ screamlab/__pycache__/io.cpython-310.pyc,sha256=LVEyU6RLcNuO693x-S_uiPMCAEAliCm7Shr5U944tVQ,33595
18
+ screamlab/__pycache__/io.cpython-312.pyc,sha256=MMoeXwNuzsekbKxuU151oMMqJ_Hn-gQ-GmwSHULdVOA,53564
19
+ screamlab/__pycache__/io.cpython-313.pyc,sha256=FqolkwTPOY7ViOsfEGFzf5pYfif4ikfFPDlXoG-tdlA,51707
20
+ screamlab/__pycache__/settings.cpython-310.pyc,sha256=Jjl1uA34-dPTjD55VI9qb4cVFLnAg0UoAFT1Eu878SQ,8754
21
+ screamlab/__pycache__/settings.cpython-312.pyc,sha256=C_E_orj-EgVwor9s8eqF0hBs-vejOFEglWI7DN1U6Yo,11907
22
+ screamlab/__pycache__/settings.cpython-313.pyc,sha256=EMKY5Y5bz2lESrtWQrYKCkO84WjqiK9o8ybtkb5FemQ,12416
23
+ screamlab/__pycache__/utils.cpython-310.pyc,sha256=hzDmDWHm2PIMLYZxy71r2yzUEq81Yldpho2WYUqEP8o,34423
24
+ screamlab/__pycache__/utils.cpython-312.pyc,sha256=NkdFr8Yr-ywDfFqTJK3QUro_YMGyezhQ04YF5Va4yGo,30799
25
+ screamlab/__pycache__/utils.cpython-313.pyc,sha256=6nj3DrKpIb11HUDjo1ubnP4ymMBE8S2vuacY3zGjhNk,29120
26
+ screamlab-0.3.2.dist-info/licenses/LICENSE,sha256=Ic_N1IFIdReR7m-W6XtN_4k6B8IgJ33dQFLc6Xi5C2E,1291
27
+ screamlab-0.3.2.dist-info/METADATA,sha256=od3nqIu-LSwCYvF19XM_RMlm14UfzhsC_TXX20BgsE4,2942
28
+ screamlab-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ screamlab-0.3.2.dist-info/top_level.txt,sha256=XjErA4-PG_phESo1eWs-bMzdnBWu4gNxB-RX78zZqqw,10
30
+ screamlab-0.3.2.dist-info/RECORD,,
@@ -1,30 +0,0 @@
1
- screamlab/__init__.py,sha256=M2vfzk7vI3qvlxE2uIHyGYmPSrFYNUacFjkjiLX00wc,63
2
- screamlab/dataset.py,sha256=d4Ztrr-gAYiNA8nGi5zhkQeRvdBdI6FblYBst3XLnzQ,26837
3
- screamlab/functions.py,sha256=zujGG87iwcBfl8clg1JUG1SYYTIO4XutNmCVhlZME4M,14638
4
- screamlab/io.py,sha256=deZEbf9gFn3OIr3lCS_ZbklGni-YG3_DBuNMEt710EQ,42968
5
- screamlab/settings.py,sha256=4lUsrTj6Ne9RQPmjSy1EAM5M2I8EwaM4ZpVE8-GP-JM,9459
6
- screamlab/utils.py,sha256=Ca82YmSmKsZf-EX9dra0WEcZrJWYcWdsnzs3xQDtHoQ,34268
7
- screamlab/__pycache__/__init__.cpython-310.pyc,sha256=nGadfOt1WUjQxMQAWhkaJ8HQIBoFYgJOXOcou6xtrJ4,245
8
- screamlab/__pycache__/__init__.cpython-312.pyc,sha256=Vo2caaR8VoJ8_NleXq-XOrPKFsFfwxsYJtyJjRxMaAQ,253
9
- screamlab/__pycache__/__init__.cpython-313.pyc,sha256=yQf9pPv0AH2e55exkKjAhkP7dXZn17lnMgudh9XDnxo,249
10
- screamlab/__pycache__/__init__.cpython-38.pyc,sha256=M5eZ95kmsA8r__ZH_prnNqi--MGl8WclL9g0yUXGTAo,176
11
- screamlab/__pycache__/dataset.cpython-310.pyc,sha256=wIfwBQFdYvUbanp8okbVfyF4Txdx0DwPrID_AG054QM,24961
12
- screamlab/__pycache__/dataset.cpython-312.pyc,sha256=6I6pajXpcAGzgMMWz8Uz8RBFvHhamr8ldh4LYvgmVHY,29658
13
- screamlab/__pycache__/dataset.cpython-313.pyc,sha256=SZHG1m9zZ8iKTrETEkd1IyrZ0ts41wyONaug2zFYPNc,33499
14
- screamlab/__pycache__/functions.cpython-310.pyc,sha256=QFIT-SC3IypiT3FjxR4rdFaX3mBCuNmI7gwHj3IPIWI,12089
15
- screamlab/__pycache__/functions.cpython-312.pyc,sha256=3XGaxzxxkM11879B0tD2igT9kx-_s3lk1fhABYwIPec,13136
16
- screamlab/__pycache__/functions.cpython-313.pyc,sha256=ozCyYcTb6HU6BBgz0Byag3-EYVdqTTNHmU1VqAFnVNU,12631
17
- screamlab/__pycache__/io.cpython-310.pyc,sha256=qbi2IVwZfOTr8nZ1u4vxsgQtsqlxMAJxDUYUIZn3ZaM,33595
18
- screamlab/__pycache__/io.cpython-312.pyc,sha256=MMoeXwNuzsekbKxuU151oMMqJ_Hn-gQ-GmwSHULdVOA,53564
19
- screamlab/__pycache__/io.cpython-313.pyc,sha256=FqolkwTPOY7ViOsfEGFzf5pYfif4ikfFPDlXoG-tdlA,51707
20
- screamlab/__pycache__/settings.cpython-310.pyc,sha256=JDbCK7P7CAU_xoh3uwcKJhyge-7TXD59RKRG6RcV6Hs,8642
21
- screamlab/__pycache__/settings.cpython-312.pyc,sha256=C_E_orj-EgVwor9s8eqF0hBs-vejOFEglWI7DN1U6Yo,11907
22
- screamlab/__pycache__/settings.cpython-313.pyc,sha256=m1P8CXfLTds2c40e-pmtBuWTfKI6X3YaroXsZL-mV7Q,12019
23
- screamlab/__pycache__/utils.cpython-310.pyc,sha256=vG1o5HO3D_tTicOQJv1gYdkAg-9PhB2jnXxA5QVoSSU,32103
24
- screamlab/__pycache__/utils.cpython-312.pyc,sha256=NkdFr8Yr-ywDfFqTJK3QUro_YMGyezhQ04YF5Va4yGo,30799
25
- screamlab/__pycache__/utils.cpython-313.pyc,sha256=6nj3DrKpIb11HUDjo1ubnP4ymMBE8S2vuacY3zGjhNk,29120
26
- screamlab-0.3.1.dist-info/licenses/LICENSE,sha256=Ic_N1IFIdReR7m-W6XtN_4k6B8IgJ33dQFLc6Xi5C2E,1291
27
- screamlab-0.3.1.dist-info/METADATA,sha256=cPkvLs3GDzSemCu4hNU0Xnq4-C6RxaYBw2Et0VrLQYU,2942
28
- screamlab-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- screamlab-0.3.1.dist-info/top_level.txt,sha256=XjErA4-PG_phESo1eWs-bMzdnBWu4gNxB-RX78zZqqw,10
30
- screamlab-0.3.1.dist-info/RECORD,,