T1T2ne_UTILS module
- class t1t2ne.scripts.t1t2ne_utils.Conf_Optns(parser, module='makelists')[source]
Bases:
object- add_ref(ref)[source]
Adds a reference to the list of references to be cited. The reference is added to the
citelistattribute of theCOobject and its DOI is added to thedoilistattribute. The reference is identified by its key in therefdictionaryattribute of theCOobject, which contains the full reference and its DOI.- Parameters:
ref (str) – The key of the reference to be added, which should be present in the
refdictionaryattribute of theCOobject.- Returns:
The function updates the
citelistanddoilistattributes of theCOobject with the reference and its DOI, respectively. If the reference is already present in thedoilist, it is not added again.- Return type:
None
- check_values(parser)[source]
Check the values provided by the user for compatibility with the options selected.
- Parameters:
parser (argparse.Namespace) – The parser object containing the command-line arguments.
- Returns:
The function checks the values provided by the user for compatibility with the options selected and raises ValueError with an appropriate message if any incompatibility is found. Updates the attributes of the
COobject with the values provided by the user.- Return type:
None
- eval_truefalse(parser)[source]
Evaluate the true/false options and store them in the
optionsattribute of theCOobject. The options are:integrate: whether to perform the analysis using integrals of the spectra instead of point-by-point fitting. This option is used in the analysis of TRACT experiments.
selectregion: whether to select a region of the spectrum for the analysis instead of using a default range. This option is used in the analysis of TRACT experiments.
phase: whether to phase the spectra. This option is used in the analysis of TRACT experiments and for the NS module.
smoothdata: whether to apply a Savitzky-Golay filter to the spectra before the analysis. This option is used in the analysis of TRACT experiments.
smoothrates: whether to apply a Savitzky-Golay filter to the relaxation rates before the design of the T1 and T2 experiments. This option is used in the design of T1 and T2 experiments.
plot: whether to plot the spectra and the results of the analysis. This option is used in the analysis of TRACT experiments.
logscale: whether to create a logarithmically spaced vdlist for the design of T1 and T2 experiments. This option is used in the design of T1 and T2 experiments and in the setup of TRACT experiments.
large: whether to create the lists for the “large” sequence, which is optimized for short T2 times. This option is used in the design of T1 and T2 experiments. If True, the d21 value is set to 450 us and only 8 cycles per CPMG block are used instead of 16.
small: whether to create the lists for the “small” sequence, which is optimized for long T2 times. This option is used in the design of T1 and T2 experiments. If True, the d21 value is set to 600 ms and 16 cycles per CPMG block are used.
idp: whether to use the IDP model to extract the order parameter S2 instead of tau_c. This option is used in the analysis of TRACT experiments and in the design of T1 and T2 experiments. If True, the molecular weight of the protein must be provided using the –MW argument.
randomize: whether to randomize the order of the values in the vdlist for the design of T1 and T2 experiments. This option is used in the design of T1 and T2 experiments.
- Parameters:
parser (argparse.Namespace) – The parser object containing the command-line arguments.
- Returns:
Updates the
optionsattribute of theCOobject with the evaluated options and adds the references. If the options are mutually exclusive, it raises a ValueError with an appropriate message.- Return type:
None
- evaluate_S2_tau(parser)[source]
Evaluate the order parameter S2 and the correlation time tau to be used for the calculations. If the –idp option is used, check if the molecular weight of the protein is provided using the –MW argument. If not, raise a ValueError with an appropriate message. I If the molecular weight is provided, calculate the tau_slow and store it in the first entry of
tauattribute of theCOobject. Also, add the reference for the IDP model to the list of references to be cited. If the –S2 option is provided, in the TRACT modules use this value for the order parameter S2 instead of the default values of 0.15. In the other modules 2 values should be provided with the –idp flag. They are then stored in theS2attribute of theCOobject. If the –corr_window_idp option is provided, calculate the correlation time of the intermediate motion using the formula MWi = corr_window_idp * 0.110 and computes the intermediate tau from it. Otherwise the tau defaults to 1.6 ns.- Parameters:
parser (argparse.Namespace) – The parser object containing the command-line arguments.
- Returns:
The function updates the
S2andtauattributes of theCOobject, and adds the references to the list of references to be cited.- Return type:
None
- get_B0()[source]
Get the magnetic field value from the spectrometer uxnmr.info file if it exists, otherwise ask the user to provide it. The magnetic field value is stored in the
B_0attribute of theCOobject.- Parameters:
None – The function does not take any parameters. It checks for the magnetic field value in the spectrometer uxnmr.info file and if it is not found, it prompts the user to input it.
- Returns:
The function updates the
B_0attribute of theCOobject with the magnetic field value in Tesla, either from the config file or from the user input.- Return type:
None
- get_experiment(parser, config_p=None)[source]
Configures the experiment folders for the default experiments.
- Parameters:
config_p (configparser.ConfigParser, optional) – The config object containing the parameters. If None, the function will ask the user to provide the experiment parameters. Default is None.
- Returns:
The function updates the
basedir,tract, andhsqcattributes of theCOobject with the experiment parameters, either from the config file or from the user input.- Return type:
None
- refdictionary = {'Fiorucci': ['Fiorucci, L., Bruno, F., et al. (2024). TrAGICo: a tool for the analysis of TRACT experiments and the design of T1 and T2 experiments. Magnetic Resonance in Chemistry, 62(6), e5537.', '10.1002/mrc.5537'], 'bermel': ['Bermel, W., Bertini, I., Felli, I. C., Piccioli, M., Pierattelli, R. (2006). Progress in NMR Spectroscopy, 48, 25-45', 'doi.org/10.1016/j.pnmrs.2005.09.002'], 'bertini': ['Bertini, I., Luchinat, C., Parigi, G., & Ravera, E. (2016). NMR of paramagnetic molecules: applications to metallobiomolecules and models (Vol. 2).', '10.1016/B978-0-444-63436-8.00022-3'], 'bolognesi': ['Bolognesi, T., Schiavina, M., Felli, I. C., & Pierattelli, R. (2025). NMR insights on multidomain proteins: the case of the SARS-CoV-2 nucleoprotein. Progress in Nuclear Magnetic Resonance Spectroscopy, 148, 101577.', '10.1016/j.pnmrs.2025.101577'], 'cavanagh': ['Cavanagh, J., Fairbrother, W. J., Palmer III, A. G., Rance, M., & Skelton, N. J. (2007). Protein NMR spectroscopy: principles and practice. Academic Press.', '10.1016/B978-0-12-164491-8.X5000-3'], 'ferrage': ['Ferrage, F. (2011). Protein dynamics by 15N nuclear magnetic relaxation. In: Shekhtman, A., Burz, D. (eds) Protein NMR Techniques. Methods in Molecular Biology, vol 831. Humana Press.', '10.1007/978-1-61779-480-3_9'], 'fushman': ['Fushman, D. (2012). Determining Protein Dynamics from 15N Relaxation Data by Using DYNAMICS. In: Shekhtman, A., Burz, D. (eds) Protein NMR Techniques. Methods in Molecular Biology, vol 831. Humana Press.', '10.1007/978-1-61779-480-3_24'], 'klassez': ['Bruno, F. (2025). Automatized quantitative NMR for industrial applications. Doctoral Thesis, University of Florence', 'None'], 'lee': ['Lee, D., Hilty, C., Wider, G., Wüthrich, K. (2006). J. Magn. Reson., 178, 72-76', '10.1016/j.jmr.2005.08.014'], 'parigi2000': ['Bertini, I., Fragai, M., Luchinat, C., & Parigi, G. (2000). 1H NMRD profiles of diamagnetic proteins: a model‐free analysis. Magnetic Resonance in Chemistry, 38(7), 543-550.', '10.1002/1097-458X(200007)38:7<543::AID-MRC722>3.0.CO;2-%23'], 'rezaei-ghaleh': ['Rezaei‐Ghaleh, N., Parigi, G., Soranno, A., Holla, A., Becker, S., Schuler, B., ... & Zweckstetter, M. (2018). Local and global dynamics in intrinsically disordered synuclein. Angewandte Chemie International Edition, 57(46), 15262-15266.', '10.1002/anie.201808172'], 'robson': ['Robson, S. A., Dağ, Ç., Wu, H., & Ziarek, J. J. (2021). TRACT revisited: an algebraic solution for determining overall rotational correlation times from cross-correlated relaxation rates. Journal of biomolecular NMR, 75(8), 293-302.', '10.1007/s10858-021-00379-5'], 'salvi': ['Salvi, N., Abyzov, A., Blackledge, M. (2017). Atomic resolution conformational dynamics of intrinsically disordered proteins from NMR spin relaxation. Progress in Nuclear Magnetic Resonance Spectroscopy, 102-103, 43-60.', '10.1016/j.pnmrs.2017.06.001'], 'suturina': ['Suturina, E. A., Mason, K., Geraldes, C. F., Chilton, N. F., Parker, D., & Kuprov, I. (2018). Lanthanide-induced relaxation anisotropy. Physical Chemistry Chemical Physics, 20(26), 17676-17686', '10.1039/C8CP01332B']}
- t1t2ne.scripts.t1t2ne_utils.T2max_duty_cycle(p30=160, d21=450)[source]
Computes the duty cycle of the CPMG experiment as the ratio between the duration of the pulse and overall duration of the cycle, returns the maximum duration with respect to the standard 250 ms.
- Parameters:
p30 (float) – The duration of a 90 degree pulse in seconds.
d21 (float) – The duration of a delay in seconds.
- Returns:
the maximum length of the CPMG.
- Return type:
max_cpmg = float
- t1t2ne.scripts.t1t2ne_utils.config_exists()[source]
Checks if the config file exists in the curdir folder of topspin for any of the users in the nmrsuperuser list. If it exists, it returns the path to the config file, otherwise it returns None.
- Returns:
The path to the config file if it exists, otherwise None.
- Return type:
str or None
- t1t2ne.scripts.t1t2ne_utils.extract_regions_from_trace(scale, trace, region)[source]
Extract regions of the spectrum and return a single array
- Parameters:
scale (array_like) – The scale corresponding to the trace (e.g., ppm values).
trace (array_like) – The spectrum to extract the regions from.
region (list of tuples) – The regions to extract, each tuple contains the start and end ppm values.
- Returns:
The extracted regions concatenated into a single array.
- Return type:
array_like
- t1t2ne.scripts.t1t2ne_utils.f4(value)[source]
Format floats for flopspin. If the value is smaller than 5e-4, it is formatted in micro (u), if it is smaller than 5e-2, it is formatted in milli (m), otherwise it is formatted in the original unit. The value is always formatted with 5 decimal places.
- Parameters:
value (float) – The value to be formatted.
- Returns:
The formatted string.
- Return type:
str
- t1t2ne.scripts.t1t2ne_utils.fs_version(S)[source]
Determines the version of TopSpin used to acquire the spectrum S by looking at the ‘_coreheader’ parameter in the acqus dictionary of the spectrum.
- Parameters:
S (kz.Pseudo_2D) – The spectrum for which to determine the TopSpin version.
- Returns:
The version of TopSpin used to acquire the spectrum if the ‘_coreheader’ parameter is found, otherwise None.
- Return type:
str
- t1t2ne.scripts.t1t2ne_utils.in_vdlist(vdlist_file)[source]
Load vdlist from a Bruker-readable file.
- Parameters:
vdlist_file (str) – The path to the file containing the vdlist.
- Returns:
The array of values read from the file.
- Return type:
- t1t2ne.scripts.t1t2ne_utils.istract(S)[source]
Check if the experiment is a TRACT experiment by looking at the name of the sequence (PULPROG parameter in the acqus dictionary of the spectrum).
- Parameters:
S (kz.Pseudo_2D) – The spectrum to check.
- Returns:
True if the experiment is a TRACT experiment, False otherwise.
- Return type:
bool
- t1t2ne.scripts.t1t2ne_utils.load_config()[source]
Loads the config file from the curdir folder of topspin for the current user and returns a configparser object. If the config file does not exist, it raises a FileNotFoundError.
- Returns:
configparser.ConfigParser – The loaded config object.
or
None
- t1t2ne.scripts.t1t2ne_utils.out_vdlist(vdlist)[source]
Print vdlist in Bruker-readable format.
- Parameters:
vdlist (list of float) – The list of values to be printed.
- t1t2ne.scripts.t1t2ne_utils.print_divider(length=48, str_toformat='')[source]
Print a divider with the name of the section in the middle. The divider is made of asterisks and the name of the section is centered in the middle of the divider.
- Parameters:
length (int, optional) – The total length of the divider, including the name of the section. Default is 48.
str_toformat (str) – The string to be formatted and displayed in the middle of the divider.
- Returns:
The function prints the divider with the name of the section in the middle.
- Return type:
None
- t1t2ne.scripts.t1t2ne_utils.splashscreen(module=None)[source]
Display the splash screen with the name of the software and the authors. If a module name is provided, it is also displayed in the splash screen.
- Parameters:
module (str, optional) – The name of the module to be displayed in the splash screen. Default is None.
- Return type:
None