def test_05(): """Satellite to central correlation method declaration""" sp0 = dict( count=512, spectral_width=5e6, events=[{ "rotor_angle": 0 * np.pi / 180, "transition_query": [{ "P": [-1], "D": [2] }, { "P": [-1], "D": [-2] }], }], ) mth = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T spectral_dimensions=[sp0, MAS_DIM.copy()], ) assert mth.json() == TESTDATA["STMAS"] assert Method.parse_dict_with_units(TESTDATA["STMAS"]) == mth assert Method2D.parse_dict_with_units(TESTDATA["STMAS"]) == mth
def test_04(): """SAS method declaration""" mth = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T rotor_angle=70.12 * np.pi / 180, spectral_dimensions=[ { "count": 512, "spectral_width": 5e4, # in Hz "events": [ { "transition_query": { "P": [-1], "D": [0] } }, ], }, MAS_DIM.copy(), ], ) assert mth.json() == TESTDATA["SAS"] assert Method.parse_dict_with_units(mth.json()) == mth assert Method2D.parse_dict_with_units(mth.json()) == mth
def test_methods(): das = Method2D( channels=["87Rb"], magnetic_flux_density=4.2, # in T rotor_angle=54.735 * 3.14159 / 180, # in rads spectral_dimensions=[ { "count": 256, "spectral_width": 2e4, # in Hz "reference_offset": -5e3, # in Hz "label": "70.12 dimension", "events": [ { "fraction": 0.5, "rotor_angle": 70.12 * 3.14159 / 180, # in rads "transition_query": [{ "ch1": { "P": [-1], "D": [0] } }], }, { "fraction": 0.5, "rotor_angle": 30.12 * 3.14159 / 180, # in rads "transition_query": [{ "ch1": { "P": [-1], "D": [0] } }], }, ], }, # The last spectral dimension block is the direct-dimension { "count": 256, "spectral_width": 3e4, # in Hz "reference_offset": -7e3, # in Hz "label": "MAS dimension", "events": [{ "transition_query": [{ "ch1": { "P": [-1], "D": [0] } }] }], }, ], ) assert das.affine_matrix is None assert das.json() == TESTDATA["DAS"] assert Method.parse_dict_with_units(das.json()) == das assert Method2D.parse_dict_with_units(das.json()) == das
def quad_static_2d_method(): tq = [{"P": [-1], "D": [0]}] to_rad = 3.14159 / 180 return Method2D( channels=["17O"], magnetic_flux_density=4.2, # in T spectral_dimensions=[ { "count": 256, "spectral_width": 4e4, # in Hz "reference_offset": -1e4, # in Hz "events": [{ "rotor_angle": 70.12 * to_rad, "transition_query": tq }], }, { "count": 512, "spectral_width": 5e4, # in Hz "reference_offset": -5e3, # in Hz "events": [{ "rotor_angle": 54.74 * to_rad, "transition_query": tq }], }, ], )
def test_method_2D(): error = "The first element of the affine matrix cannot be zero." with pytest.raises(ValueError, match=f".*{error}.*"): Method2D(spectral_dimensions=[{}, {}], affine_matrix=[0, 1, 2, 3]) # parse dict with units test dict_1d = { "channels": ["87Rb"], "magnetic_flux_density": "7 T", # in T "rotor_angle": "54.735 deg", "spectral_dimensions": [ { "spectral_width": "10 kHz", **sample_test_output }, { "spectral_width": "10 kHz", **sample_test_output }, ], } method1a = Method2D.parse_dict_with_units(dict_1d) assert Method.parse_dict_with_units(method1a.json()) == method1a method1b = Method2D( channels=["87Rb"], magnetic_flux_density=7, # in T rotor_angle=54.735 * np.pi / 180, spectral_dimensions=[ { "spectral_width": 1e4, **sample_test_output }, { "spectral_width": 1e4, **sample_test_output }, ], ) assert method1a == method1b
def test_cosy(): system = SpinSystem(sites=[{"isotope": "1H"}, {"isotope": "1H"}]) cosy = Method2D( channels=["1H"], spectral_dimensions=[ { "events": [ {"fraction": 1, "transition_query": {"P": [-1]}}, {"mixing_query": {"ch1": {"tip_angle": np.pi / 2, "phase": 0}}}, ], }, { "events": [{"fraction": 1, "transition_query": {"P": [-1]}}], }, ], ) tr = cosy.get_transition_pathways(system) weights = np.asarray([1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1]) * 0.25 transition_pathways = 0.5 * np.asarray( [ [[[-1, 1], [-1, -1]], [[-1, 1], [-1, -1]]], [[[-1, 1], [-1, -1]], [[1, -1], [-1, -1]]], [[[-1, 1], [-1, -1]], [[1, 1], [-1, 1]]], [[[-1, 1], [-1, -1]], [[1, 1], [1, -1]]], # [[[1, -1], [-1, -1]], [[-1, 1], [-1, -1]]], [[[1, -1], [-1, -1]], [[1, -1], [-1, -1]]], [[[1, -1], [-1, -1]], [[1, 1], [-1, 1]]], [[[1, -1], [-1, -1]], [[1, 1], [1, -1]]], # [[[1, 1], [-1, 1]], [[-1, 1], [-1, -1]]], [[[1, 1], [-1, 1]], [[1, -1], [-1, -1]]], [[[1, 1], [-1, 1]], [[1, 1], [-1, 1]]], [[[1, 1], [-1, 1]], [[1, 1], [1, -1]]], # [[[1, 1], [1, -1]], [[-1, 1], [-1, -1]]], [[[1, 1], [1, -1]], [[1, -1], [-1, -1]]], [[[1, 1], [1, -1]], [[1, 1], [-1, 1]]], [[[1, 1], [1, -1]], [[1, 1], [1, -1]]], ] ) expected = [ TransitionPathway( pathway=[ {"initial": list(states[0]), "final": list(states[1])} for states in transitions ], weight=w, ) for transitions, w in zip(transition_pathways, weights) ] assert tr == expected
def test_rotor_frequency(): """Ensures only 1 non-zero finite spinning speed in method""" # Good method, should not throw error Method( channels=["1H"], spectral_dimensions=[ SpectralDimension(events=[ SpectralEvent(fraction=0.5, rotor_frequency=123), SpectralEvent(fraction=0.5, rotor_frequency=0), ]), SpectralDimension(events=[SpectralEvent(rotor_frequency=np.inf)]), ], ) # Bad method, should throw error for multiple finite speeds for cls in [Method, Method1D]: with pytest.raises(NotImplementedError): cls( channels=["1H"], spectral_dimensions=[ SpectralDimension(events=[ SpectralEvent(fraction=0.5, rotor_frequency=123), SpectralEvent(fraction=0.5, rotor_frequency=456), ]) ], ) with pytest.raises(NotImplementedError): Method2D( channels=["1H"], spectral_dimensions=[ SpectralDimension(events=[ SpectralEvent(fraction=0.5, rotor_frequency=123), SpectralEvent(fraction=0.5, rotor_frequency=np.inf), ]), SpectralDimension(events=[ SpectralEvent(fraction=0.5, rotor_frequency=0), SpectralEvent(fraction=0.5, rotor_frequency=456), ]), ], ) with pytest.raises(NotImplementedError): Method( channels=["27Al"], rotor_frequency=np.inf, spectral_dimensions=[ SpectralDimension(events=[ SpectralEvent(fraction=0.5, rotor_frequency=0.1), SpectralEvent(fraction=0.5, rotor_frequency=456), ]) ], )
def test_05(): """Satellite to central correlation method declaration""" mth = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T spectral_dimensions=[ { "count": 512, "spectral_width": 5e6, # in Hz "reference_offset": 0, # in Hz "events": [ { "rotor_angle": 0 * np.pi / 180, "transition_query": { "P": [-1], "D": [2, -2] }, }, ], }, { "count": 128, "spectral_width": 5e4, # in Hz "reference_offset": 0, # in Hz "events": [ { "rotor_angle": 54.735 * np.pi / 180, "transition_query": { "P": [-1], "D": [0] }, }, ], }, ], ) assert TESTDATA["STMAS"] == mth.json() assert Method.parse_dict_with_units(TESTDATA["STMAS"]) == mth
def test_03(): """generic method declaration""" mth = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T spectral_dimensions=[ { "count": 1024, "spectral_width": 5e4 }, { "count": 1024, "spectral_width": 5e4 }, ], ) assert mth.json() == TESTDATA["generic"] assert Method.parse_dict_with_units(mth.json()) == mth
das = Method2D( channels=["17O"], magnetic_flux_density=11.74, # in T spectral_dimensions=[ { "count": 256, "spectral_width": 5e3, # in Hz "reference_offset": 0, # in Hz "label": "DAS isotropic dimension", "events": [ { "fraction": 0.5, "rotor_angle": 37.38 * 3.14159 / 180, "transition_query": [{ "P": [-1], "D": [0] }], }, { "fraction": 0.5, "rotor_angle": 79.19 * 3.14159 / 180, "transition_query": [{ "P": [-1], "D": [0] }], }, ], }, # The last spectral dimension block is the direct-dimension { "count": 256, "spectral_width": 2e4, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", "events": [{ "rotor_angle": 54.735 * 3.14159 / 180, "transition_query": [{ "P": [-1], "D": [0] }], }], }, ], )
def test_MQMAS(): site = Site( isotope="87Rb", isotropic_chemical_shift=-9, shielding_symmetric={ "zeta": 100, "eta": 0 }, quadrupolar={ "Cq": 3.5e6, "eta": 0.36, "beta": 70 / 180 * np.pi }, ) spin_system = SpinSystem(sites=[site]) method = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, spectral_dimensions=[ { "count": 128, "spectral_width": 20000, "events": [{ "transition_query": [{ "P": [-3], "D": [0] }] }], }, { "count": 128, "spectral_width": 20000, "events": [{ "transition_query": [{ "P": [-1], "D": [0] }] }], }, ], ) sim = Simulator() sim.spin_systems = [spin_system] sim.methods = [method] sim.config.integration_volume = "hemisphere" sim.run() # process k = 21 / 27 # shear factor processor = sp.SignalProcessor(operations=[ sp.IFFT(dim_index=1), aft.Shear(factor=-k, dim_index=1, parallel=0), aft.Scale(factor=1 + k, dim_index=1), sp.FFT(dim_index=1), ]) processed_data = processor.apply_operations( data=sim.methods[0].simulation).real # Since there is a single site, after the shear and scaling transformations, there # should be a single perak along the isotropic dimension at index 70. # The isotropic coordinate of this peak is given by # w_iso = (17.8)*iso_shift + 1e6/8 * (vq/v0)^2 * (eta^2 / 3 + 1) # ref: D. Massiot et al. / Solid State Nuclear Magnetic Resonance 6 (1996) 73-83 iso_slice = processed_data[40, :] assert np.argmax(iso_slice.y[0].components[0]) == 70 # calculate the isotropic coordinate spin = method.channels[0].spin w0 = method.channels[0].gyromagnetic_ratio * 9.4 * 1e6 wq = 3 * 3.5e6 / (2 * spin * (2 * spin - 1)) w_iso = -9 * 17 / 8 + 1e6 / 8 * (wq / w0)**2 * ((0.36**2) / 3 + 1) # the coordinate from spectrum w_iso_spectrum = processed_data.x[1].coordinates[70].value np.testing.assert_almost_equal(w_iso, w_iso_spectrum, decimal=2) # The projection onto the MAS dimension should be the 1D block decay central # transition spectrum mas_slice = processed_data.sum(axis=1).y[0].components[0] # MAS spectrum method = BlochDecayCTSpectrum( channels=["87Rb"], magnetic_flux_density=9.4, rotor_frequency=1e9, spectral_dimensions=[{ "count": 128, "spectral_width": 20000 }], ) sim = Simulator() sim.spin_systems = [spin_system] sim.methods = [method] sim.config.integration_volume = "hemisphere" sim.run() data = sim.methods[0].simulation.y[0].components[0] np.testing.assert_almost_equal(data / data.max(), mas_slice / mas_slice.max(), decimal=2, err_msg="not equal")
# %% # Use the generic 2D method, `Method2D`, to simulate a MAF spectrum by customizing the # method parameters, as shown below. Note, the Method2D method simulates an infinite # spinning speed spectrum. maf = Method2D( channels=["29Si"], magnetic_flux_density=14.1, # in T spectral_dimensions=[ { "count": 128, "spectral_width": 2e4, # in Hz "label": "Anisotropic dimension", "events": [{ "rotor_angle": 90 * 3.14159 / 180 }], }, { "count": 128, "spectral_width": 3e3, # in Hz "reference_offset": -1.05e4, # in Hz "label": "Isotropic dimension", "events": [{ "rotor_angle": 54.735 * 3.14159 / 180 }], }, ], affine_matrix=[[1, -1], [0, 1]], ) # %% # Create the Simulator object, add the method and spin system objects, and run the # simulation.
def test_02(): e = "`rotor_frequency=1e12 Hz` is fixed for 2D Methods and cannot be modified." with pytest.raises(ValueError, match=f".*{e}.*"): Method2D(channels=["87Rb"], rotor_frequency=10, spectral_dimensions=[{}, {}])
def test_02(): e = "`rotor_frequency` attribute cannot be modified for Method2D method." with pytest.raises(AttributeError, match=f".*{e}.*"): Method2D(channels=["87Rb"], rotor_frequency=10, spectral_dimensions=[{}, {}])
sas = Method2D( name="Switched Angle Spinning", channels=["87Rb"], magnetic_flux_density=9.4, # in T spectral_dimensions=[ SpectralDimension( count=256, spectral_width=3.5e4, # in Hz reference_offset=1e3, # in Hz label="90 dimension", events=[ SpectralEvent( rotor_angle=90 * 3.14159 / 180, transition_query=[{"ch1": {"P": [-1], "D": [0]}}], ) ], # in radians ), SpectralDimension( count=256, spectral_width=22e3, # in Hz reference_offset=-4e3, # in Hz label="MAS dimension", events=[ SpectralEvent( rotor_angle=54.74 * 3.14159 / 180, transition_query=[{"ch1": {"P": [-1], "D": [0]}}], ) ], # in radians ), ], )
maf = Method2D( name="Magic Angle Flipping", channels=["29Si"], magnetic_flux_density=14.1, # in T spectral_dimensions=[ SpectralDimension( count=128, spectral_width=2e4, # in Hz label="Anisotropic dimension", events=[ SpectralEvent( rotor_angle=90 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ) ], ), SpectralDimension( count=128, spectral_width=3e3, # in Hz reference_offset=-1.05e4, # in Hz label="Isotropic dimension", events=[ SpectralEvent( rotor_angle=54.735 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ) ], ), ], affine_matrix=[[1, -1], [0, 1]], )
shifting_d = Method2D( channels=["2H"], magnetic_flux_density=9.395, # in T spectral_dimensions=[ { "count": 512, "spectral_width": 2.5e5, # in Hz "label": "Quadrupolar frequency", "events": [ { "rotor_frequency": 0, "transition_query": {"P": [-1]}, "freq_contrib": ["Quad1_2"], } ], }, { "count": 256, "spectral_width": 2e5, # in Hz "reference_offset": 2e4, # in Hz "label": "Paramagnetic shift", "events": [ { "rotor_frequency": 0, "transition_query": {"P": [-1]}, "freq_contrib": ["Shielding1_0", "Shielding1_2"], } ], }, ], )
DAS = Method2D( channels=["17O"], magnetic_flux_density=11.744, # in T spectral_dimensions=[ SpectralDimension( **spectral_dims[0], events=[ SpectralEvent( fraction=0.5, rotor_angle=37.38 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ), SpectralEvent( fraction=0.5, rotor_angle=79.19 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ), ], ), # The last spectral dimension block is the direct-dimension SpectralDimension( **spectral_dims[1], events=[ SpectralEvent( rotor_angle=54.735 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ) ], ), ], experiment=experiment, # also add the measurement to the method. )
shifting_d = Method2D( name="Shifting-d", channels=["2H"], magnetic_flux_density=9.395, # in T spectral_dimensions=[ SpectralDimension( count=512, spectral_width=2.5e5, # in Hz label="Quadrupolar frequency", events=[ SpectralEvent( rotor_frequency=0, transition_query=[{ "ch1": { "P": [-1] } }], freq_contrib=["Quad1_2"], ) ], ), SpectralDimension( count=256, spectral_width=2e5, # in Hz reference_offset=2e4, # in Hz label="Paramagnetic shift", events=[ SpectralEvent( rotor_frequency=0, transition_query=[{ "ch1": { "P": [-1] } }], freq_contrib=["Shielding1_0", "Shielding1_2"], ) ], ), ], )
sas = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T spectral_dimensions=[ { "count": 256, "spectral_width": 3.5e4, # in Hz "reference_offset": 1e3, # in Hz "label": "90 dimension", "events": [{ "rotor_angle": 90 * 3.14159 / 180, "transition_query": [{ "P": [-1], "D": [0] }], }], # in radians }, { "count": 256, "spectral_width": 22e3, # in Hz "reference_offset": -4e3, # in Hz "label": "MAS dimension", "events": [{ "rotor_angle": 54.74 * 3.14159 / 180, "transition_query": [{ "P": [-1], "D": [0] }], }], # in radians }, ], )
def test_DAS(): B0 = 11.7 das = Method2D( channels=["17O"], magnetic_flux_density=B0, # in T spectral_dimensions=[ { "count": 912, "spectral_width": 5e3, # in Hz "reference_offset": 0, # in Hz "label": "DAS isotropic dimension", "events": [ { "fraction": 0.5, "rotor_angle": 37.38 * 3.14159 / 180 }, { "fraction": 0.5, "rotor_angle": 79.19 * 3.14159 / 180 }, ], }, # The last spectral dimension block is the direct-dimension { "count": 2048, "spectral_width": 2e4, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", "events": [{ "rotor_angle": 54.735 * 3.14159 / 180 }], }, ], ) sim = Simulator() sim.spin_systems = spin_systems # add spin systems sim.methods = [das] # add the method. sim.config.decompose_spectrum = "spin_system" sim.run(pack_as_csdm=False) data_das = sim.methods[0].simulation data_das_coords_ppm = das.spectral_dimensions[0].coordinates_ppm() # Bloch decay central transition method bloch = BlochDecayCentralTransitionSpectrum( channels=["17O"], magnetic_flux_density=B0, # in T rotor_frequency=1e9, # in Hz rotor_angle=54.735 * 3.14159 / 180, spectral_dimensions=[ { "count": 2048, "spectral_width": 2e4, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", }, ], ) sim = Simulator() sim.spin_systems = spin_systems sim.methods = [bloch] sim.config.decompose_spectrum = "spin_system" sim.run(pack_as_csdm=False) data_bloch = sim.methods[0].simulation larmor_freq = das.channels[0].gyromagnetic_ratio * B0 * 1e6 spin = das.channels[0].spin for i, sys in enumerate(spin_systems): for site in sys.sites: Cq = site.quadrupolar.Cq eta = site.quadrupolar.eta iso = site.isotropic_chemical_shift factor1 = -(3 / 40) * (Cq / larmor_freq)**2 factor2 = (spin * (spin + 1) - 3 / 4) / (spin**2 * (2 * spin - 1)**2) factor3 = 1 + (eta**2) / 3 iso_obs = factor1 * factor2 * factor3 * 1e6 + iso # get the index where there is a signal id1 = data_das[i] / data_das[i].max() index = np.where(id1 == id1.max())[0] iso_spectrum = data_das_coords_ppm[ index[0]] # x[1].coords[index[0]] # test for the position of isotropic peaks. np.testing.assert_almost_equal(iso_obs, iso_spectrum, decimal=1) # test for the spectrum across the isotropic peaks. data_bloch_i = data_bloch[i] / data_bloch[i].max() assert np.allclose(id1[index[0]], data_bloch_i)
shifting_d = Method2D( channels=["2H"], magnetic_flux_density=9.395, # in T spectral_dimensions=[ SpectralDimension( **spectral_dims[0], label="Quadrupolar frequency", events=[ SpectralEvent( rotor_frequency=0, transition_query=[{ "ch1": { "P": [-1] } }], freq_contrib=["Quad1_2"], ) ], ), SpectralDimension( **spectral_dims[1], label="Paramagnetic shift", events=[ SpectralEvent( rotor_frequency=0, transition_query=[{ "ch1": { "P": [-1] } }], freq_contrib=["Shielding1_0", "Shielding1_2"], ) ], ), ], experiment=experiment, # also add the measurement to the method. )
def SSB2D_setup(ist, vr, method_type): sites = [ Site( isotope=ist, isotropic_chemical_shift=29, shielding_symmetric={ "zeta": -70, "eta": 0.000 }, ), Site( isotope=ist, isotropic_chemical_shift=44, shielding_symmetric={ "zeta": -96, "eta": 0.166 }, ), Site( isotope=ist, isotropic_chemical_shift=57, shielding_symmetric={ "zeta": -120, "eta": 0.168 }, ), ] spin_systems = [SpinSystem(sites=[s]) for s in sites] B0 = 11.7 if method_type == "PASS": method = SSB2D( channels=[ist], magnetic_flux_density=B0, # in T rotor_frequency=vr, spectral_dimensions=[ { "count": 32, "spectral_width": 32 * vr, # in Hz "label": "Anisotropic dimension", }, # The last spectral dimension block is the direct-dimension { "count": 2048, "spectral_width": 2e4, # in Hz "reference_offset": 5e3, # in Hz "label": "Fast MAS dimension", }, ], ) else: method = Method2D( channels=[ist], magnetic_flux_density=B0, # in T spectral_dimensions=[ { "count": 64, "spectral_width": 8e4, # in Hz "label": "Anisotropic dimension", "events": [{ "rotor_angle": 90 * 3.14159 / 180 }], }, # The last spectral dimension block is the direct-dimension { "count": 2048, "spectral_width": 2e4, # in Hz "reference_offset": 5e3, # in Hz "label": "Fast MAS dimension", }, ], affine_matrix=[[1, -1], [0, 1]], ) sim = Simulator() sim.spin_systems = spin_systems # add spin systems sim.methods = [method] # add the method. sim.run() data_ssb = sim.methods[0].simulation dim_ssb = data_ssb.x[0].coordinates.value if method_type == "PASS": bloch = BlochDecaySpectrum( channels=[ist], magnetic_flux_density=B0, # in T rotor_frequency=vr, # in Hz spectral_dimensions=[ { "count": 32, "spectral_width": 32 * vr, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", }, ], ) else: bloch = BlochDecaySpectrum( channels=[ist], magnetic_flux_density=B0, # in T rotor_frequency=vr, # in Hz rotor_angle=90 * 3.14159 / 180, spectral_dimensions=[ { "count": 64, "spectral_width": 8e4, # in Hz "reference_offset": 0, # in Hz "label": "MAS dimension", }, ], ) for i in range(3): iso = spin_systems[i].sites[0].isotropic_chemical_shift sys = spin_systems[i].copy() sys.sites[0].isotropic_chemical_shift = 0 sim2 = Simulator() sim2.spin_systems = [sys] # add spin systems sim2.methods = [bloch] # add the method. sim2.run() index = np.where(dim_ssb < iso)[0][-1] one_d_section = data_ssb.y[0].components[0][:, index] one_d_section /= one_d_section.max() one_d_sim = sim2.methods[0].simulation.y[0].components[0] one_d_sim /= one_d_sim.max() np.testing.assert_almost_equal(one_d_section, one_d_sim, decimal=6)
shifting_d = Method2D( channels=["2H"], magnetic_flux_density=9.395, # in T spectral_dimensions=[ { **spectral_dims[0], "label": "Quadrupolar frequency", "events": [{ "rotor_frequency": 0, "transition_query": { "P": [-1] }, "freq_contrib": ["Quad1_2"], }], }, { **spectral_dims[1], "label": "Paramagnetic shift", "events": [{ "rotor_frequency": 0, "transition_query": { "P": [-1] }, "freq_contrib": ["Shielding1_0", "Shielding1_2"], }], }, ], experiment=experiment, # also add the measurement to the method. )
sas = Method2D( channels=["87Rb"], magnetic_flux_density=4.2, # in T spectral_dimensions=[ SpectralDimension( count=256, spectral_width=1.5e4, # in Hz reference_offset=-5e3, # in Hz label="70.12 dimension", events=[ SpectralEvent( rotor_angle=70.12 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ) ], # in radians ), SpectralDimension( count=512, spectral_width=15e3, # in Hz reference_offset=-7e3, # in Hz label="MAS dimension", events=[ SpectralEvent( rotor_angle=54.74 * 3.14159 / 180, transition_query=[{ "ch1": { "P": [-1], "D": [0] } }], ) ], # in radians ), ], )
das = Method2D( name="Dynamic Angle Spinning", channels=["17O"], magnetic_flux_density=11.74, # in T spectral_dimensions=[ SpectralDimension( count=256, spectral_width=5e3, # in Hz reference_offset=0, # in Hz label="DAS isotropic dimension", events=[ SpectralEvent( fraction=0.5, rotor_angle=37.38 * 3.14159 / 180, transition_query=[{"ch1": {"P": [-1], "D": [0]}}], ), SpectralEvent( fraction=0.5, rotor_angle=79.19 * 3.14159 / 180, transition_query=[{"ch1": {"P": [-1], "D": [0]}}], ), ], ), # The last spectral dimension block is the direct-dimension SpectralDimension( count=256, spectral_width=2e4, # in Hz reference_offset=0, # in Hz label="MAS dimension", events=[ SpectralEvent( rotor_angle=54.735 * 3.14159 / 180, transition_query=[{"ch1": {"P": [-1], "D": [0]}}], ) ], ), ], )
spectral_dims = get_spectral_dimensions(experiment) das = Method2D( channels=["17O"], magnetic_flux_density=11.7, # in T spectral_dimensions=[ { **spectral_dims[0], "events": [ { "fraction": 0.5, "rotor_angle": 37.38 * 3.14159 / 180 }, { "fraction": 0.5, "rotor_angle": 79.19 * 3.14159 / 180 }, ], }, # The last spectral dimension block is the direct-dimension { **spectral_dims[1], "events": [{ "rotor_angle": 54.735 * 3.14159 / 180 }] }, ], experiment=experiment, # also add the measurement to the method. ) # Optimize the script by pre-setting the transition pathways for each spin system from
coaster = Method2D( name="COASTER", channels=["87Rb"], magnetic_flux_density=9.4, # in T rotor_angle=70.12 * 3.14159 / 180, # in rads spectral_dimensions=[ SpectralDimension( count=256, spectral_width=4e4, # in Hz reference_offset=-8e3, # in Hz label="3Q dimension", events=[ SpectralEvent(transition_query=[{ "ch1": { "P": [3], "D": [0] } }]) ], ), # The last spectral dimension block is the direct-dimension SpectralDimension( count=256, spectral_width=2e4, # in Hz reference_offset=-3e3, # in Hz label="70.12 dimension", events=[ SpectralEvent(transition_query=[{ "ch1": { "P": [-1], "D": [0] } }]) ], ), ], )
coaster = Method2D( channels=["87Rb"], magnetic_flux_density=9.4, # in T rotor_angle=70.12 * 3.14159 / 180, # in rads spectral_dimensions=[ { "count": 256, "spectral_width": 4e4, # in Hz "reference_offset": -8e3, # in Hz "label": "3Q dimension", "events": [{ "transition_query": [{ "P": [3], "D": [0] }] }], }, # The last spectral dimension block is the direct-dimension { "count": 256, "spectral_width": 2e4, # in Hz "reference_offset": -3e3, # in Hz "label": "70.12 dimension", "events": [{ "transition_query": [{ "P": [-1], "D": [0] }] }], }, ], )
# %% # Use the generic 2D method, `Method2D`, to simulate a SAS spectrum by customizing the # method parameters, as shown below. Note, the Method2D method simulates an infinite # spinning speed spectrum. sas = Method2D( channels=["87Rb"], magnetic_flux_density=4.2, # in T spectral_dimensions=[ { "count": 256, "spectral_width": 1.5e4, # in Hz "reference_offset": -5e3, # in Hz "label": "70.12 dimension", "events": [{ "rotor_angle": 70.12 * 3.14159 / 180 }], # in radians }, { "count": 512, "spectral_width": 15e3, # in Hz "reference_offset": -7e3, # in Hz "label": "MAS dimension", "events": [{ "rotor_angle": 54.74 * 3.14159 / 180 }], # in radians }, ], ) # %% # Create the Simulator object, add the method and spin system objects, and # run the simulation.