Collection of rw sim scripts, maybe working, use C++ version instead
may
Go to file
2024-08-03 19:04:25 +02:00
rwsims proper saving of STE results; 2024-08-03 19:04:13 +02:00
.gitignore Initial commit 2024-06-12 17:12:50 +00:00
config.json proper saving of STE results; 2024-08-03 19:04:13 +02:00
LICENSE more modularity 2024-06-19 19:10:49 +02:00
main.py proper saving of STE results; 2024-08-03 19:04:13 +02:00
pyproject.toml moving around 2024-06-20 19:19:55 +02:00
README.md expand README 2024-08-03 19:04:25 +02:00

RWSims

Collection of rw sim scripts

Usage

# the next lines are only necessary if the python script is not in the same folder as rwsims
import sys
sys.path.append('/path/to/RWSims')

from rwsims.sims import run_ste_sim, run_spectrum_sim

run_ste_sim('/path/to/json-file')
run_spectrum_sim('/path/to/json-file')

Parameter file

Parameter for a simulation are given by a JSON file, sections are:

simulation

key type description
num integer Number of trajectories
seed integer or null Seed value for random number generator

molecule

key type description
delta float Anisotropy (in Hz)
eta float Asymmetry

correlation_times

key type description
distribution string Name of distribution. Possible values: DeltaDistribution, LogGaussian
tau variable Characteristic time of distribution (in s)
Other parameter variable Additional parameter, e.g., sigma

motion

key type description
model string Name of motion. Possible values: RandomJump, TetrahedralJump

spectrum

key type description
dwell_time float Dwell time of acquisition (in s)
num_points integer Number of acquisition points
t_echo variable One or more echo delays (use zero for FID) (in s)
line_broadening float Additional exponential broadening (in Hz)
t_pulse float Pulse length used of attenuation (in s)

ste

key type description
t_evo variable One or more evolution times
t_mix variable One or more mixing times
t_echo float Optional echo delay for 4-pulse sequence (in s)

variable type

Keys of type variable can be a single value, a list of values, or values between a given start and stop value.

Examples:

  • A single value
{
  // Other parameter...
  "tau": 1e-3,
  // More parameter..
}
  • A list of predefined values, defined by key list
{
  // Other parameter...
  "tau": {
    "list": [1e-5, 1e-4, 1e-3, 1e-2]
  },
  // More parameter..
}

++ A list of predefined values, based on start and end value

{
  // Other parameter...
  "tau": {
    "start": 1e-6,
    "stop": 1e0,
    "steps": 31,
    "is_log": true  // this parameter is optional, default is false
  },
  // More parameter..
}

Output

Results are written to text files and png images.

  • For spectrum simulations:
    1. Each combination of distribution and motion parameter produces files for the dependence of timesignals/spectra on the echo delay.
    2. The reduction factor vs. correlation time is plotted for all variable together in one png plot
  • For STE simulation:
    1. Each combination of distribution and motion parameter produces files for the CC/SS decays.
    2. The dependence on the evolution of the fit parameter is saved and plotted for the various variable combinations