Note
Go to the end to download the full example code
Process a square wave reflection¶
Processes a square wave reflection in order to calculate the Q of a NMR probe. Optional to show the phasing and real on top of the fitted square wave reflection.
---------- logging output to /home/jmfranck/pyspecdata.0.log ----------
--> proc_square_refl.py(25):pyspecdata.core <module> 2024-10-26 15:42:07,466
INFO: processing dataset hairpin probe
You didn't set units for ch before saving the data!!!
You didn't set units for t before saving the data!!!
logarithmic
--> analyze_square_refl.py(123):pyspecdata.core analyze_square_refl 2024-10-26 15:42:08,068
INFO: frq: 14889966.915265452
--> analyze_square_refl.py(153):pyspecdata.core analyze_square_refl 2024-10-26 15:42:08,257
INFO: the amplitude is 0.5041899787959184
{R, A}
{\bf Warning:} You have no error associated with your plot, and I want to flag this for now
/home/jmfranck/git_repos/pyspecdata/pyspecdata/core.py:8646: Warning: You have no error associated with your plot, and I want to flag this for now
warnings.warn(
--> analyze_square_refl.py(225):pyspecdata.core analyze_square_refl 2024-10-26 15:42:08,581
INFO: output: {'A': 0.6191578695480574, 'C': 0.0007775310076085551, 'R': 8731153.71929354}
--> analyze_square_refl.py(226):pyspecdata.core analyze_square_refl 2024-10-26 15:42:08,584
INFO: latex: $f(t)=0.62 e^{- 8.73\times 10^{6} t} + 0.00$
/home/jmfranck/git_repos/pyspecdata/pyspecdata/core.py:9192: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(arg)
--> analyze_square_refl.py(240):pyspecdata.core analyze_square_refl 2024-10-26 15:42:08,595
INFO: -11728.316475972004
--> proc_square_refl.py(25):pyspecdata.core <module> 2024-10-26 15:42:08,810
INFO: processing dataset solenoid probe
You didn't set units for ch before saving the data!!!
You didn't set units for t before saving the data!!!
logarithmic
--> analyze_square_refl.py(123):pyspecdata.core analyze_square_refl 2024-10-26 15:42:09,201
INFO: frq: 14889553.824459042
--> analyze_square_refl.py(153):pyspecdata.core analyze_square_refl 2024-10-26 15:42:09,295
INFO: the amplitude is 0.5013108588730282
{R, A}
{\bf Warning:} You have no error associated with your plot, and I want to flag this for now
--> analyze_square_refl.py(225):pyspecdata.core analyze_square_refl 2024-10-26 15:42:09,614
INFO: output: {'A': 0.5118213811859424, 'C': 0.0021007698742564924, 'R': 3969130.4825602476}
--> analyze_square_refl.py(226):pyspecdata.core analyze_square_refl 2024-10-26 15:42:09,617
INFO: latex: $f(t)=0.51 e^{- 3.97\times 10^{6} t} + 0.00$
--> analyze_square_refl.py(240):pyspecdata.core analyze_square_refl 2024-10-26 15:42:09,636
INFO: 22313.576370994408
1: hairpin probe show the frequency distribution |||MHz
2: hairpin probe after slice and mix down freq domain |||('MHz', None)
3: analytic signal |||μs
4: blips |||ns
5: solenoid probe show the frequency distribution |||MHz
6: solenoid probe after slice and mix down freq domain |||('MHz', None)
from pylab import *
from pyspecdata import *
from pyspecProcScripts.third_level.analyze_square_refl import (
analyze_square_refl,
)
from pyspecProcScripts import *
init_logging(level="debug")
rcParams["image.aspect"] = "auto"
# sphinx_gallery_thumbnail_number = 3
with fl_mod() as fl:
for filename, expno, dataset_name in [
("210125_sqwv_cap_probe_1", "capture1", "hairpin probe"),
("210111_sqwv_sol_probe_1", "capture1", "solenoid probe"),
]:
logger.info(strm("processing dataset", dataset_name))
d = find_file(
filename, exp_type="ODNP_NMR_comp/test_equipment", expno=expno
)
d.set_units("t", "s").name("Amplitude").set_units("V")
d.setaxis("ch", r_[1, 2])
d.set_units("t", "s")
analyze_square_refl(
d,
label=dataset_name,
fl=fl,
show_analytic_signal_phase=False,
show_analytic_signal_real=False,
)
Total running time of the script: (0 minutes 12.261 seconds)





