Help with simulating basis set: adding freq. shifts and phase distorsions

Hi,

I am simulating a basis set with NMRScope-B and I need help on how to add random frequency shifts and random phase distorsion values with uniform distribution and damping variations in order to mimic in vivo MRS signal. Can someone suggest me software or script for that?

Thank you,
Milena

Hi Milena,

I’m not very familiar with NMRScope-B. I’d probably recommend exporting your simulated spectrum in jMRUI format, and then do the random frequency/phase variation outside of NMRScope-B. You can do that manually (they’re both simple time-domain multiplications), or resort to some sort of processing framework, for example using FID-A in MATLAB (feel free to browse our Software & Code section to find tools that suit your preferred programming environment).

I’m also tagging @agudmund in the hope that he has something more immediately useful to contribute than I’m doing here - I know he’s been simulating signals in NMRScope-B and then adding the phase/frequency variations in Python.

Let me know if that was (or wasn’t helpful) please.
Best,
Georg

1 Like

Hi Milena,
As Georg suggested, I would also recommend simulating your metabolites in NMR-Scope-B first and then add in your frequency, phase, and lw variations in whichever programming language you prefer.

In NMR-Scope-B, after you “Launch” your simulation you can save them as “NMR Scope-B.” This will give you a “.m” file that can be read as a text file. The first 8 or 9 lines of that file are just information about your simulation (dwell time, number of points, etc.) followed by your actual simulated data separated into 2 columns (Real and Imaginary).

From here, you can write some code that will read your data and apply random adjustments. What programming language do you usually work in? Happy to offer more specifics on the code implementation, just let me know what language you prefer.

Thanks,
Aaron Gudmundson
agudmund@uci.edu

2 Likes

Thanks for your reply. I will try the suggestions. @agudmund I’m using MATLAB for programming.

Hi,

Thanks for your suggestions about handling the data. I’ve simulated and saved the spectra in .m file format and also used FID-A for adding freq. and phase shifts, but I didn’t find a script to add random frequency shifts (from -0.09 ppm to +0.09 ppm), and random phase distorsion values with uniform distribution and damping variations (from -0.09 to +0.09 ppm). I’m new in programming (started using Matlab) so I would be grateful if you could give me some advice about this.

Thanks,
Milena

Hello,
Great, it sounds like you made a lot of progress! I would just use rand() or unifrnd() to add random shifts to your data. I’m not sure that there is a premade script to add these variations in, so you’ll likely need to write your own. Does this help or are you looking for a broader idea on how to setup and structure your code?

Thanks,
Aaron Gudmundson
agudmund@uci.edu

1 Like

I agree that you should look into the random number generation functions of MATLAB. For testing, it is a good idea to use a consistent seed (e.g. rng(0,'twister')) so that the random numbers you generate are repeatable.

I’m sure it’s a typo, but your phase variations and exponential/Gaussian damping should cover a larger range. Zero-order phase could range somewhere between -90 and 90 degrees (or, if you’re planning to train a network for something… why not make it entirely random over the whole range), exponential line broadening somewhere between 0 and 50 Hz, and Gaussian linebroadening somewhere between 0 and 5000 Hz^2.

Is that helpful? What precisely do you need advice about?
Best,
Georg

1 Like

Hi,

if I remeber correctly in NMRSCOPEB you can define lists with different frequencies and you can also simulate the data with different dampings
you can also contact Jana or Zenon directly and ask them, or check the manual ?
not sure if I can post here the emails of Jana and Zenon, but send me an email (cristina.cudalbu@epfl.ch) and I will send you their emails
best
cristina

1 Like

Hi,
I appreciate all your help, thank you a lot :slight_smile: Your ideas were very helpful and I made the simulations using MATLAB and FID-A considering your suggestions.
Best,
Milena

1 Like