CoreMS 4.0.0__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.
- corems/__init__.py +63 -0
- corems/chroma_peak/__init__.py +0 -0
- corems/chroma_peak/calc/ChromaPeakCalc.py +480 -0
- corems/chroma_peak/calc/__init__.py +0 -0
- corems/chroma_peak/calc/subset.py +196 -0
- corems/chroma_peak/factory/__init__.py +0 -0
- corems/chroma_peak/factory/chroma_peak_classes.py +1178 -0
- corems/encapsulation/__init__.py +0 -0
- corems/encapsulation/constant.py +1283 -0
- corems/encapsulation/factory/__init__.py +0 -0
- corems/encapsulation/factory/parameters.py +392 -0
- corems/encapsulation/factory/processingSetting.py +1244 -0
- corems/encapsulation/input/__init__.py +0 -0
- corems/encapsulation/input/parameter_from_json.py +579 -0
- corems/encapsulation/output/__init__.py +0 -0
- corems/encapsulation/output/parameter_to_dict.py +142 -0
- corems/encapsulation/output/parameter_to_json.py +332 -0
- corems/mass_spectra/__init__.py +0 -0
- corems/mass_spectra/calc/GC_Calc.py +84 -0
- corems/mass_spectra/calc/GC_Deconvolution.py +558 -0
- corems/mass_spectra/calc/GC_RI_Calibration.py +44 -0
- corems/mass_spectra/calc/MZSearch.py +249 -0
- corems/mass_spectra/calc/SignalProcessing.py +656 -0
- corems/mass_spectra/calc/__init__.py +0 -0
- corems/mass_spectra/calc/lc_calc.py +5790 -0
- corems/mass_spectra/calc/lc_calc_operations.py +1127 -0
- corems/mass_spectra/factory/GC_Class.py +791 -0
- corems/mass_spectra/factory/__init__.py +0 -0
- corems/mass_spectra/factory/chromat_data.py +51 -0
- corems/mass_spectra/factory/lc_class.py +2721 -0
- corems/mass_spectra/input/__init__.py +0 -0
- corems/mass_spectra/input/andiNetCDF.py +200 -0
- corems/mass_spectra/input/boosterHDF5.py +216 -0
- corems/mass_spectra/input/brukerSolarix.py +153 -0
- corems/mass_spectra/input/brukerSolarix_utils.py +73 -0
- corems/mass_spectra/input/corems_hdf5.py +1710 -0
- corems/mass_spectra/input/massList.py +133 -0
- corems/mass_spectra/input/mzml.py +668 -0
- corems/mass_spectra/input/parserbase.py +239 -0
- corems/mass_spectra/input/rawFileReader.py +1839 -0
- corems/mass_spectra/output/__init__.py +0 -0
- corems/mass_spectra/output/export.py +2800 -0
- corems/mass_spectrum/__init__.py +0 -0
- corems/mass_spectrum/calc/AutoRecalibration.py +237 -0
- corems/mass_spectrum/calc/Calibration.py +602 -0
- corems/mass_spectrum/calc/CalibrationCalc.py +253 -0
- corems/mass_spectrum/calc/KendrickGroup.py +239 -0
- corems/mass_spectrum/calc/MassErrorPrediction.py +436 -0
- corems/mass_spectrum/calc/MassSpectrumCalc.py +303 -0
- corems/mass_spectrum/calc/MeanResolvingPowerFilter.py +212 -0
- corems/mass_spectrum/calc/NoiseCalc.py +371 -0
- corems/mass_spectrum/calc/NoiseCalc_Bayes.py +93 -0
- corems/mass_spectrum/calc/PeakPicking.py +994 -0
- corems/mass_spectrum/calc/__init__.py +0 -0
- corems/mass_spectrum/factory/MassSpectrumClasses.py +1753 -0
- corems/mass_spectrum/factory/__init__.py +0 -0
- corems/mass_spectrum/input/__init__.py +0 -0
- corems/mass_spectrum/input/baseClass.py +531 -0
- corems/mass_spectrum/input/boosterHDF5.py +161 -0
- corems/mass_spectrum/input/coremsHDF5.py +475 -0
- corems/mass_spectrum/input/massList.py +402 -0
- corems/mass_spectrum/input/numpyArray.py +133 -0
- corems/mass_spectrum/output/__init__.py +0 -0
- corems/mass_spectrum/output/export.py +841 -0
- corems/molecular_formula/__init__.py +0 -0
- corems/molecular_formula/calc/MolecularFormulaCalc.py +885 -0
- corems/molecular_formula/calc/__init__.py +0 -0
- corems/molecular_formula/factory/MolecularFormulaFactory.py +895 -0
- corems/molecular_formula/factory/__init__.py +0 -0
- corems/molecular_formula/input/__init__.py +0 -0
- corems/molecular_formula/input/masslist_ref.py +355 -0
- corems/molecular_id/__init__.py +0 -0
- corems/molecular_id/calc/ClusterFilter.py +251 -0
- corems/molecular_id/calc/MolecularFilter.py +122 -0
- corems/molecular_id/calc/SpectralSimilarity.py +632 -0
- corems/molecular_id/calc/__init__.py +0 -0
- corems/molecular_id/calc/math_distance.py +1637 -0
- corems/molecular_id/data/FAMES_REF.msp +980 -0
- corems/molecular_id/data/PNNLMetV20191015.msp +157267 -0
- corems/molecular_id/factory/EI_SQL.py +650 -0
- corems/molecular_id/factory/MolecularLookupTable.py +914 -0
- corems/molecular_id/factory/__init__.py +0 -0
- corems/molecular_id/factory/classification.py +884 -0
- corems/molecular_id/factory/lipid_molecular_metadata.py +50 -0
- corems/molecular_id/factory/molecularSQL.py +827 -0
- corems/molecular_id/factory/spectrum_search_results.py +119 -0
- corems/molecular_id/input/__init__.py +0 -0
- corems/molecular_id/input/nistMSI.py +148 -0
- corems/molecular_id/search/__init__.py +0 -0
- corems/molecular_id/search/compoundSearch.py +214 -0
- corems/molecular_id/search/database_interfaces.py +1527 -0
- corems/molecular_id/search/findOxygenPeaks.py +330 -0
- corems/molecular_id/search/lcms_spectral_search.py +348 -0
- corems/molecular_id/search/molecularFormulaSearch.py +1117 -0
- corems/molecular_id/search/priorityAssignment.py +723 -0
- corems/ms_peak/__init__.py +0 -0
- corems/ms_peak/calc/MSPeakCalc.py +1010 -0
- corems/ms_peak/calc/__init__.py +0 -0
- corems/ms_peak/factory/MSPeakClasses.py +542 -0
- corems/ms_peak/factory/__init__.py +0 -0
- corems/transient/__init__.py +0 -0
- corems/transient/calc/TransientCalc.py +362 -0
- corems/transient/calc/__init__.py +0 -0
- corems/transient/factory/TransientClasses.py +457 -0
- corems/transient/factory/__init__.py +0 -0
- corems/transient/input/__init__.py +0 -0
- corems/transient/input/brukerSolarix.py +461 -0
- corems/transient/input/midasDatFile.py +172 -0
- corems-4.0.0.dist-info/METADATA +475 -0
- corems-4.0.0.dist-info/RECORD +171 -0
- corems-4.0.0.dist-info/WHEEL +5 -0
- corems-4.0.0.dist-info/licenses/LICENSE +22 -0
- corems-4.0.0.dist-info/top_level.txt +4 -0
- examples/archive/scripts/CoreMS_tutorial.py +94 -0
- examples/archive/scripts/DI HR-MS Halogens Bruker.py +196 -0
- examples/archive/scripts/DI HR-MS MassList.py +385 -0
- examples/archive/scripts/GC-MS MetabRef.py +213 -0
- examples/archive/scripts/GC-MS NetCDF.py +217 -0
- examples/archive/scripts/HR-MS Thermo Raw 21T.py +136 -0
- examples/archive/scripts/LC-ICPMS_metal_peaks.py +297 -0
- examples/archive/scripts/LCMS-Thermo.py +460 -0
- examples/archive/scripts/LCMS_isotopes.py +283 -0
- examples/archive/scripts/MSParams_example.py +21 -0
- examples/archive/scripts/Molecular Formula Data Aggreation.py +84 -0
- examples/archive/scripts/Single Mz Search.py +69 -0
- examples/test_notebooks.py +145 -0
- ext_lib/ChemstationMSFileReader.dll +0 -0
- ext_lib/ChemstationMSFileReader.xml +126 -0
- ext_lib/RawFileReaderLicense.doc +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.Data.xml +28974 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.xml +31174 -0
- ext_lib/__init__.py +0 -0
- ext_lib/dotnet/OpenMcdf.Extensions.dll +0 -0
- ext_lib/dotnet/OpenMcdf.dll +0 -0
- ext_lib/dotnet/OpenMcdf.xml +1154 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.dll +0 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.xml +506 -0
- ext_lib/dotnet/System.Security.AccessControl.dll +0 -0
- ext_lib/dotnet/System.Security.AccessControl.xml +2043 -0
- ext_lib/dotnet/System.Security.Principal.Windows.dll +0 -0
- ext_lib/dotnet/System.Security.Principal.Windows.xml +1011 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.xml +29148 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.xml +31492 -0
- ext_lib/version +18 -0
- support_code/atom_parsers/AtomsDescription.py +359 -0
- support_code/atom_parsers/CreateAtomsDescription.py +56 -0
- support_code/nmdc/filefinder.py +90 -0
- support_code/nmdc/lipidomics/lipidomics_workflow.py +748 -0
- support_code/nmdc/lipidomics/manifest_examples.py +49 -0
- support_code/nmdc/metabolomics/gcms_workflow.py +158 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_targeted_search.py +59 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_workflow.py +248 -0
- support_code/nmdc/metabolomics/metabolomics_collection.py +628 -0
- support_code/nmdc/metadata/dms_api.py +42 -0
- support_code/nmdc/nom/archived_scripts/nmdc_metadata_gen.py +288 -0
- support_code/nmdc/nom/archived_scripts/nom_grow_workflow.py +209 -0
- support_code/nmdc/nom/nom_workflow.py +312 -0
- support_code/windows_only_importers/BrukerCompassXtract.py +180 -0
- support_code/windows_only_importers/ThermoMSFileReader.py +405 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
from os.path import basename, dirname, normpath
|
|
2
|
+
|
|
3
|
+
from matplotlib import rcParamsDefault, rcParams
|
|
4
|
+
from numpy import linspace
|
|
5
|
+
|
|
6
|
+
from corems.encapsulation.factory.parameters import MSParameters
|
|
7
|
+
from corems.mass_spectrum.factory.MassSpectrumClasses import MassSpecfromFreq
|
|
8
|
+
from corems.transient.calc.TransientCalc import TransientCalculations
|
|
9
|
+
import matplotlib.pyplot as plt
|
|
10
|
+
from copy import deepcopy
|
|
11
|
+
from corems.encapsulation.input.parameter_from_json import (
|
|
12
|
+
load_and_set_parameters_class,
|
|
13
|
+
load_and_set_toml_parameters_class,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__author__ = "Yuri E. Corilo"
|
|
18
|
+
__date__ = "Jun 19, 2019"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Transient(TransientCalculations):
|
|
22
|
+
"""The Transient object contains the transient data and the parameters used to process it
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
data : numpy.ndarray
|
|
27
|
+
Array with the transient data
|
|
28
|
+
d_params : dict
|
|
29
|
+
Dictionary with the parameters to be set
|
|
30
|
+
|
|
31
|
+
Attributes
|
|
32
|
+
----------
|
|
33
|
+
calibration_terms : tuple
|
|
34
|
+
Tuple with the calibration terms (A, B, C)
|
|
35
|
+
bandwidth : float
|
|
36
|
+
The bandwidth of the transient (Hz)
|
|
37
|
+
number_data_points : int
|
|
38
|
+
The number of data points of the transient
|
|
39
|
+
polarity : int
|
|
40
|
+
The polarity of the transient
|
|
41
|
+
transient_time : float
|
|
42
|
+
The time domain length of the transient
|
|
43
|
+
d_params : dict
|
|
44
|
+
Dictionary with the parameters to be set
|
|
45
|
+
frequency_domain : numpy.ndarray
|
|
46
|
+
Array with the frequency domain
|
|
47
|
+
magnitude : numpy.ndarray
|
|
48
|
+
Array with the magnitude
|
|
49
|
+
_full_filename_path : str
|
|
50
|
+
The full path of the transient file
|
|
51
|
+
_exc_high_freq : float
|
|
52
|
+
The high frequency of the excitation (Hz)
|
|
53
|
+
_exc_low_freq : float
|
|
54
|
+
The low frequency of the excitation (Hz)
|
|
55
|
+
_parameters : corems.transient.parameters.TransientParameters
|
|
56
|
+
The transient parameters
|
|
57
|
+
_transient_data : numpy.ndarray
|
|
58
|
+
Array with the transient data
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
Methods
|
|
62
|
+
-------
|
|
63
|
+
* get_frequency_domain(plot_result=True).
|
|
64
|
+
Get the frequency domain and magnitude from the transient data
|
|
65
|
+
* get_mass_spectrum(auto_process=True, plot_result=True, keep_profile=True).
|
|
66
|
+
Get the mass spectrum from the transient data
|
|
67
|
+
* set_processing_parameter(apodization_method, number_of_truncations, number_of_zero_fills).
|
|
68
|
+
Set the processing parameters
|
|
69
|
+
* scale_plot_size(factor=1.5).
|
|
70
|
+
Scale the plot size by a factor
|
|
71
|
+
* plot_transient(ax=None, c='k').
|
|
72
|
+
Plot the transient data
|
|
73
|
+
* plot_zerofilled_transient(ax=None, c='k').
|
|
74
|
+
Plot the transient data with zero fill
|
|
75
|
+
* plot_apodized_transient(ax=None, c='k').
|
|
76
|
+
Plot the transient data with apodization
|
|
77
|
+
* plot_frequency_domain(ax=None, c='k').
|
|
78
|
+
Plot the frequency domain and magnitude
|
|
79
|
+
* set_parameter_from_toml(parameters_path).
|
|
80
|
+
Set the processing parameters from a toml file
|
|
81
|
+
* set_parameter_from_json(parameters_path).
|
|
82
|
+
Set the processing parameters from a json file
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
def __init__(self, data, d_params):
|
|
89
|
+
self._transient_data = data
|
|
90
|
+
|
|
91
|
+
self.d_params = d_params
|
|
92
|
+
|
|
93
|
+
self.frequency_domain = None
|
|
94
|
+
|
|
95
|
+
self.magnitude = None
|
|
96
|
+
|
|
97
|
+
self.__set__parameters__objects(d_params)
|
|
98
|
+
|
|
99
|
+
self.__set__transient__time()
|
|
100
|
+
|
|
101
|
+
def __set__parameters__objects(self, d_params):
|
|
102
|
+
"""Set the parameters objects from the dictionary d_params
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
d_params : dict
|
|
107
|
+
Dictionary with the parameters to be set
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
self._full_filename_path = d_params.get("filename_path")
|
|
112
|
+
|
|
113
|
+
self.calibration_terms = (
|
|
114
|
+
d_params.get("Aterm"),
|
|
115
|
+
d_params.get("Bterm"),
|
|
116
|
+
d_params.get("Cterm"),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
self._exc_high_freq = d_params.get("exc_high_freq")
|
|
120
|
+
|
|
121
|
+
self._exc_low_freq = d_params.get("exc_low_freq")
|
|
122
|
+
|
|
123
|
+
self._qpd_enabled = d_params.get("qpd_enabled") # Quadrupolar detection enabled
|
|
124
|
+
|
|
125
|
+
self._mw_low = d_params.get("mw_low") # low mass for detection
|
|
126
|
+
|
|
127
|
+
self._mw_high = d_params.get("mw_high") # high mass for detection
|
|
128
|
+
|
|
129
|
+
self.bandwidth = d_params.get("bandwidth")
|
|
130
|
+
|
|
131
|
+
self.number_data_points = d_params.get("number_data_points")
|
|
132
|
+
|
|
133
|
+
self.polarity = int(d_params.get("polarity"))
|
|
134
|
+
|
|
135
|
+
self.location = 220
|
|
136
|
+
|
|
137
|
+
self._parameters = deepcopy(MSParameters.transient)
|
|
138
|
+
|
|
139
|
+
def scale_plot_size(self, factor=1.5):
|
|
140
|
+
"""Scale the plot size by a factor
|
|
141
|
+
|
|
142
|
+
Parameters
|
|
143
|
+
----------
|
|
144
|
+
factor : float, optional
|
|
145
|
+
The factor to scale the plot size, by default 1.5
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
default_dpi = rcParamsDefault["figure.dpi"]
|
|
149
|
+
rcParams["figure.dpi"] = default_dpi * factor
|
|
150
|
+
|
|
151
|
+
def __set__transient__time(self):
|
|
152
|
+
"""Set the transient time variable with the calculated length."""
|
|
153
|
+
self.transient_time = self.cal_transient_time()
|
|
154
|
+
|
|
155
|
+
def set_processing_parameter(
|
|
156
|
+
self,
|
|
157
|
+
apodization_method: str,
|
|
158
|
+
number_of_truncations: int,
|
|
159
|
+
number_of_zero_fills: int,
|
|
160
|
+
):
|
|
161
|
+
"""Set the processing parameters
|
|
162
|
+
|
|
163
|
+
Parameters
|
|
164
|
+
----------
|
|
165
|
+
apodization_method : str
|
|
166
|
+
Apodization method to be used
|
|
167
|
+
number_of_truncations : int
|
|
168
|
+
Number of truncations to be used
|
|
169
|
+
number_of_zero_fills : int
|
|
170
|
+
Number of zero fills to be used
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
self.parameters.apodization_method = apodization_method
|
|
174
|
+
|
|
175
|
+
self.parameters.number_of_truncations = number_of_truncations
|
|
176
|
+
|
|
177
|
+
self.parameters.number_of_zero_fills = number_of_zero_fills
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def parameters(self):
|
|
181
|
+
"""The transient parameters"""
|
|
182
|
+
return self._parameters
|
|
183
|
+
|
|
184
|
+
@parameters.setter
|
|
185
|
+
def parameters(self, instance_TransientParameters):
|
|
186
|
+
self._parameters = instance_TransientParameters
|
|
187
|
+
|
|
188
|
+
def set_parameter_from_toml(self, parameters_path):
|
|
189
|
+
"""Set the processing parameters from a toml file"""
|
|
190
|
+
self._parameters = load_and_set_toml_parameters_class(
|
|
191
|
+
"Transient", self._parameters, parameters_path=parameters_path
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def set_parameter_from_json(self, parameters_path):
|
|
195
|
+
"""Set the processing parameters from a json file"""
|
|
196
|
+
self._parameters = load_and_set_parameters_class(
|
|
197
|
+
"Transient", self._parameters, parameters_path=parameters_path
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
def get_frequency_domain(self, plot_result=True):
|
|
201
|
+
"""Get the frequency domain and magnitude from the transient data
|
|
202
|
+
|
|
203
|
+
Parameters
|
|
204
|
+
----------
|
|
205
|
+
plot_result : bool, optional
|
|
206
|
+
Plot the frequency domain and magnitude, by default True
|
|
207
|
+
|
|
208
|
+
Returns
|
|
209
|
+
-------
|
|
210
|
+
frequency_domain : numpy.ndarray
|
|
211
|
+
Array with the frequency domain
|
|
212
|
+
magnitude : numpy.ndarray
|
|
213
|
+
Array with the magnitude
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
if self.parameters.number_of_truncations > 0:
|
|
217
|
+
new_time_domain = self.truncation(self._transient_data)
|
|
218
|
+
|
|
219
|
+
else:
|
|
220
|
+
new_time_domain = self._transient_data
|
|
221
|
+
|
|
222
|
+
if self.parameters.apodization_method is not None:
|
|
223
|
+
new_time_domain = self.apodization(new_time_domain)
|
|
224
|
+
|
|
225
|
+
if plot_result:
|
|
226
|
+
self._plot_transient(self._transient_data)
|
|
227
|
+
|
|
228
|
+
self._plot_transient(new_time_domain)
|
|
229
|
+
|
|
230
|
+
time_domain_y_zero_filled = self.zero_fill(new_time_domain)
|
|
231
|
+
|
|
232
|
+
self.transient_time = self.transient_time * (
|
|
233
|
+
self.parameters.number_of_zero_fills + 1
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
if plot_result:
|
|
237
|
+
self._plot_transient(time_domain_y_zero_filled)
|
|
238
|
+
|
|
239
|
+
return self.perform_magniture_mode_ft(time_domain_y_zero_filled)
|
|
240
|
+
# return frequency_domain, magnitude
|
|
241
|
+
|
|
242
|
+
def get_mass_spectrum(
|
|
243
|
+
self,
|
|
244
|
+
auto_process: bool = True,
|
|
245
|
+
plot_result: bool = True,
|
|
246
|
+
keep_profile: bool = True,
|
|
247
|
+
) -> MassSpecfromFreq:
|
|
248
|
+
"""Get the mass spectrum from the transient data
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
auto_process : bool, optional
|
|
253
|
+
Process the transient data, by default True
|
|
254
|
+
plot_result : bool, optional
|
|
255
|
+
Plot the frequency domain and magnitude, by default True
|
|
256
|
+
keep_profile : bool, optional
|
|
257
|
+
Keep the profile data, by default True
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
MassSpecfromFreq
|
|
262
|
+
Mass spectrum object
|
|
263
|
+
"""
|
|
264
|
+
|
|
265
|
+
frequency_domain, magnitude = self.get_frequency_domain(plot_result=plot_result)
|
|
266
|
+
|
|
267
|
+
if plot_result:
|
|
268
|
+
self._plot_frequency_domain(frequency_domain, magnitude)
|
|
269
|
+
|
|
270
|
+
self.d_params["filename"] = self.filename
|
|
271
|
+
self.d_params["dir_location"] = self.dir_location
|
|
272
|
+
|
|
273
|
+
return MassSpecfromFreq(
|
|
274
|
+
frequency_domain,
|
|
275
|
+
magnitude,
|
|
276
|
+
self.d_params,
|
|
277
|
+
auto_process=auto_process,
|
|
278
|
+
keep_profile=keep_profile,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
@property
|
|
282
|
+
def filename(self):
|
|
283
|
+
# return dirname(self._full_filename_path)
|
|
284
|
+
return basename(normpath(self._full_filename_path))
|
|
285
|
+
|
|
286
|
+
@property
|
|
287
|
+
def dir_location(self):
|
|
288
|
+
return dirname(self._full_filename_path).strip(
|
|
289
|
+
basename(normpath(self._full_filename_path))
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
@property
|
|
293
|
+
def A_therm(self):
|
|
294
|
+
return self.calibration_terms[0]
|
|
295
|
+
|
|
296
|
+
@property
|
|
297
|
+
def B_therm(self):
|
|
298
|
+
return self.calibration_terms[1]
|
|
299
|
+
|
|
300
|
+
@property
|
|
301
|
+
def C_therm(self):
|
|
302
|
+
return self.calibration_terms[2]
|
|
303
|
+
|
|
304
|
+
def _plot_frequency_domain(self, frequency_domain, magnitude): # pragma: no cover
|
|
305
|
+
"""Plot the frequency domain and magnitude
|
|
306
|
+
|
|
307
|
+
Parameters
|
|
308
|
+
----------
|
|
309
|
+
frequency_domain : numpy.ndarray
|
|
310
|
+
Array with the frequency domain
|
|
311
|
+
magnitude : numpy.ndarray
|
|
312
|
+
Array with the magnitude
|
|
313
|
+
"""
|
|
314
|
+
|
|
315
|
+
self.location += 1
|
|
316
|
+
plt.subplot(self.location)
|
|
317
|
+
plt.plot(frequency_domain, magnitude, color="green")
|
|
318
|
+
plt.xlabel("Hz")
|
|
319
|
+
plt.ylabel("Magnitude")
|
|
320
|
+
# reset grid location index to 0
|
|
321
|
+
self.location = 220
|
|
322
|
+
# plt.show()
|
|
323
|
+
|
|
324
|
+
def _plot_transient(self, transient_data): # pragma: no cover
|
|
325
|
+
"""Plot the transient data
|
|
326
|
+
|
|
327
|
+
Parameters
|
|
328
|
+
----------
|
|
329
|
+
transient_data : numpy.ndarray
|
|
330
|
+
Array with the transient data
|
|
331
|
+
|
|
332
|
+
"""
|
|
333
|
+
|
|
334
|
+
self.location += 1
|
|
335
|
+
# print( self.location)
|
|
336
|
+
time_axis = linspace(0, self.transient_time, num=len(transient_data))
|
|
337
|
+
plt.subplot(self.location)
|
|
338
|
+
plt.plot(time_axis, transient_data, color="green")
|
|
339
|
+
plt.xlabel("Time (s)")
|
|
340
|
+
plt.ylabel("Magnitude")
|
|
341
|
+
# plt.show()
|
|
342
|
+
|
|
343
|
+
def plot_transient(self, ax=None, c="k"): # pragma: no cover
|
|
344
|
+
"""Plot the transient data
|
|
345
|
+
|
|
346
|
+
Parameters
|
|
347
|
+
----------
|
|
348
|
+
ax : matplotlib.axes, optional
|
|
349
|
+
Matplotlib axes object, by default None
|
|
350
|
+
c : str, optional
|
|
351
|
+
Color, by default 'k'
|
|
352
|
+
|
|
353
|
+
Returns
|
|
354
|
+
-------
|
|
355
|
+
matplotlib.axes
|
|
356
|
+
Matplotlib axes object
|
|
357
|
+
|
|
358
|
+
"""
|
|
359
|
+
|
|
360
|
+
# self.location +=1
|
|
361
|
+
# print( self.location)
|
|
362
|
+
if ax is None:
|
|
363
|
+
ax = plt.gca()
|
|
364
|
+
time_axis = linspace(0, self.transient_time, num=len(self._transient_data))
|
|
365
|
+
# plt.subplot(self.location)
|
|
366
|
+
ax.plot(time_axis, self._transient_data, color=c)
|
|
367
|
+
plt.xlabel("Time (s)")
|
|
368
|
+
plt.ylabel("Magnitude")
|
|
369
|
+
# plt.show()
|
|
370
|
+
return ax
|
|
371
|
+
|
|
372
|
+
def plot_zerofilled_transient(self, ax=None, c="k"): # pragma: no cover
|
|
373
|
+
"""Plot the transient data with zero fill
|
|
374
|
+
|
|
375
|
+
Parameters
|
|
376
|
+
----------
|
|
377
|
+
ax : matplotlib.axes, optional
|
|
378
|
+
Matplotlib axes object, by default None
|
|
379
|
+
c : str, optional
|
|
380
|
+
Color, by default 'k'
|
|
381
|
+
|
|
382
|
+
Returns
|
|
383
|
+
-------
|
|
384
|
+
matplotlib.axes
|
|
385
|
+
Matplotlib axes object
|
|
386
|
+
|
|
387
|
+
"""
|
|
388
|
+
if ax is None:
|
|
389
|
+
ax = plt.gca()
|
|
390
|
+
new_time_domain = self.apodization(self._transient_data)
|
|
391
|
+
time_domain_y_zero_filled = self.zero_fill(new_time_domain)
|
|
392
|
+
self.transient_time = self.transient_time * (
|
|
393
|
+
self.parameters.number_of_zero_fills + 1
|
|
394
|
+
)
|
|
395
|
+
time_axis = linspace(0, self.transient_time, num=len(time_domain_y_zero_filled))
|
|
396
|
+
# plt.subplot(self.location)
|
|
397
|
+
ax.plot(time_axis, time_domain_y_zero_filled, color=c)
|
|
398
|
+
plt.xlabel("Time (s)")
|
|
399
|
+
plt.ylabel("Magnitude")
|
|
400
|
+
# plt.show()
|
|
401
|
+
return ax
|
|
402
|
+
|
|
403
|
+
def plot_apodized_transient(self, ax=None, c="k"): # pragma: no cover
|
|
404
|
+
"""Plot the transient data with apodization
|
|
405
|
+
|
|
406
|
+
Parameters
|
|
407
|
+
----------
|
|
408
|
+
ax : matplotlib.axes, optional
|
|
409
|
+
Matplotlib axes object, by default None
|
|
410
|
+
c : str, optional
|
|
411
|
+
Color, by default 'k'
|
|
412
|
+
|
|
413
|
+
Returns
|
|
414
|
+
-------
|
|
415
|
+
matplotlib.axes
|
|
416
|
+
Matplotlib axes object
|
|
417
|
+
|
|
418
|
+
"""
|
|
419
|
+
# self.location +=1
|
|
420
|
+
# print( self.location)
|
|
421
|
+
if ax is None:
|
|
422
|
+
ax = plt.gca()
|
|
423
|
+
new_time_domain = self.apodization(self._transient_data)
|
|
424
|
+
time_axis = linspace(0, self.transient_time, num=len(new_time_domain))
|
|
425
|
+
# plt.subplot(self.location)
|
|
426
|
+
ax.plot(time_axis, new_time_domain, color=c)
|
|
427
|
+
plt.xlabel("Time (s)")
|
|
428
|
+
plt.ylabel("Magnitude")
|
|
429
|
+
# plt.show()
|
|
430
|
+
return ax
|
|
431
|
+
|
|
432
|
+
def plot_frequency_domain(self, ax=None, c="k"): # pragma: no cover
|
|
433
|
+
"""Plot the frequency domain and magnitude
|
|
434
|
+
|
|
435
|
+
Parameters
|
|
436
|
+
----------
|
|
437
|
+
ax : matplotlib.axes, optional
|
|
438
|
+
Matplotlib axes object, by default None
|
|
439
|
+
c : str, optional
|
|
440
|
+
Color, by default 'k'
|
|
441
|
+
|
|
442
|
+
Returns
|
|
443
|
+
-------
|
|
444
|
+
matplotlib.axes
|
|
445
|
+
Matplotlib axes object
|
|
446
|
+
|
|
447
|
+
"""
|
|
448
|
+
# self.location +=1
|
|
449
|
+
# plt.subplot(self.location)
|
|
450
|
+
if ax is None:
|
|
451
|
+
ax = plt.gca()
|
|
452
|
+
frequency_domain, magnitude = self.get_frequency_domain(plot_result=False)
|
|
453
|
+
ax.plot(frequency_domain / 1000, magnitude, color=c)
|
|
454
|
+
plt.xlabel("KHz")
|
|
455
|
+
plt.ylabel("Magnitude")
|
|
456
|
+
# plt.show()
|
|
457
|
+
return ax
|
|
File without changes
|
|
File without changes
|