Experiment#
An Experiment describes the measurement (EasySpin’s Exp):
microwave frequency and field range for field-swept spectra, or a fixed field
and frequency range for frequency-swept ones, plus harmonic, modulation
amplitude, temperature, and sample orientation.
Units: microwave frequency in GHz, fields in mT, temperature in K.
- class torchspin.Experiment(mwFreq=None, Range=None, CenterSweep=None, mwCenterSweep=None, ModAmp=0.0, SampleFrame=None, CrystalSymmetry=None, MolFrame=None, SampleRotation=None, nPoints=1024, Harmonic=None, mwPhase=0.0, Temperature=None, lightBeam=None, lightScatter=0.0, Ordering=None, Mode='perpendicular', mwMode=None, Field=None, mwRange=None, ExciteWidth=None, Orientations=None, OrientationWeights=None)[source]#
Experimental parameters for CW EPR simulations (EasySpin
Exp).One
Experimentdescribes the sweep, the detection and the sample. The sweep mode follows from which fields are set:Field sweep (the default): set
mwFreq(GHz) andRangeorCenterSweep(mT). The simulators return a field axis in mT.Frequency sweep: set
Field(mT) andmwRangeormwCenterSweep(GHz);Rangeis not used. The simulators return a frequency axis in GHz.Fixed field (ENDOR): set
Fieldonly.salt()runs fixed-field ENDOR;pepper()treats this as a frequency sweep with an automatic range.
Fields are validated on construction (see Raises). A field that a simulator does not read is ignored by it; the “Read by” notes below list the CW simulators that use each field.
- Parameters:
mwFreq (float, optional) – Microwave frequency in GHz. Required (
> 0) for field sweeps; not used by frequency sweeps. DefaultNone.Range (list of float, optional) – Field sweep range
[Bmin, Bmax]in mT,Bmin < Bmax. DefaultNone:pepper()andgarlic()then choose the range automatically (pepper: S = 1/2 systems only, from the g and A extremes).CenterSweep (list of float, optional) – Alternative to
Range:[center, sweep_width]in mT, width> 0. Converted toRange = [center - width/2, center + width/2]on construction. DefaultNone.mwCenterSweep (list of float, optional) – Alternative to
mwRange:[center, sweep_width]in GHz, width> 0. Converted tomwRangeon construction. DefaultNone.ModAmp (float, default 0.0) – Peak-to-peak field-modulation amplitude in mT.
0= no modulation: the harmonic is produced by differentiating the line shape.> 0: the absorption spectrum is pseudo-modulated (torchspin.fieldmod()) atHarmonic; pepper and garlic raiseValueErrorforHarmonic = 0and for frequency sweeps.Noneis read as 0. Read by pepper, garlic and chili.SampleFrame (array_like, shape (3,) or (N, 3), optional) – Euler angles
[alpha, beta, gamma]in radians of the lab-to-sample frame transformation, one row per sample orientation. In pepper this describes a single crystal only together withMolFrameorCrystalSymmetry; on its own it leaves a disordered (powder) sample unchanged. Also read by chili. DefaultNone(no rotation).CrystalSymmetry (int or str, optional) – Crystal symmetry of a single crystal: space-group number (1-230), space-group symbol or point-group symbol (e.g.
'P21/c','C2h'). Determines the symmetry-related sites;NonewithMolFrameset is space group P1 (one site). Setting it makes pepper simulate a crystal. DefaultNone.MolFrame (array_like, shape (3,), optional) – Euler angles in radians of the sample-to-molecular frame transformation of a single crystal. Setting it makes pepper simulate a crystal. Default
None.SampleRotation (tuple, optional) –
(axis, rho): rotate the sample aboutaxis('x','y','z'or a lab-frame 3-vector) byrhoradians (a scalar or a list of angles, one sample orientation each). pepper only. DefaultNone.nPoints (int, default 1024) – Number of points of the sweep axis, at least 2.
Harmonic (int, optional) – Detection harmonic: 0 = absorption, 1 = first derivative, 2 = second derivative. Default
None, resolved on construction to 1 for a field sweep and to 0 otherwise (frequency sweep or fixed field), whether or notmwFreqis also given. pepper falls back to 0 when the system has no line width and no strain.mwPhase (float, default 0.0) – Detection phase in radians: 0 = absorption,
pi/2= dispersion. Read by pepper, garlic and chili.Temperature (float, optional) – Sample temperature in K for Boltzmann populations of the levels.
None(default) = infinite temperature (equal populations).infis the same asNone; a value<= 0raisesValueError.lightBeam (str or tuple, optional) – Photoselection by a polarized light beam (pepper only; requires
SpinSystem.tdm):''/None(default, none),'perpendicular'or'parallel'(beam along the lab y axis, linear polarization perpendicular or parallel to B0),'unpolarized', or(k, alpha)with the propagation directionk(lab frame: a direction string such as'y'or'-z', a 3-vector or[phi, theta]) and the anglealphaof the electric field in the plane perpendicular tok(radians,nan= unpolarized).lightScatter (float, default 0.0) – Isotropic fraction of the photoselection weights, between 0 and 1: weight =
(1 - lightScatter) * w + lightScatter. A value>= 1switches photoselection off. pepper only.Ordering (float or callable, optional) – Partial ordering of a disordered sample (pepper only). A scalar
lambdagives the axial distributionexp(lambda * P2(cos beta)); a callablef(alpha, beta, gamma)orf(beta)(Euler angles in radians, sample to molecular frame, array arguments) returns the orientational weights. Requires a Ci grid; cannot be combined withMolFrame,CrystalSymmetryorOrientations. DefaultNone(isotropic powder).Mode (str, default 'perpendicular') – Microwave excitation geometry:
'perpendicular'(B1 perpendicular to B0, standard CW EPR, mainly Delta m_S = +-1 transitions) or'parallel'(B1 parallel to B0, Delta m_S = 0 transitions, e.g. integer-spin systems). Used whenmwModeisNone.mwMode (str or tuple, optional) – EasySpin’s
Exp.mwMode; overridesModewhen set (pepper and the resonance-field solvers; garlic readsModeonly).'perpendicular','parallel'or(k, mode2)with the propagation directionk('x'/'y'/'z'with optional sign, a 3-vector,[phi, theta]or one polar angle, radians) andmode2the linear polarization angle (radians) or one of'unpolarized','circular+','circular-'. DefaultNone.Field (float, optional) – Static field in mT for frequency sweeps and fixed-field (ENDOR) experiments;
None(default) for field sweeps. Must be>= 0;Field = 0is accepted only by pepper frequency sweeps and salt withOptions(ZeroField=True); every other simulator, and pepper or salt without that option, raisesValueErrorwhen called.mwRange (list of float, optional) – Frequency sweep range
[nu_lo, nu_hi]in GHz,nu_lo < nu_hi. RequiresField. DefaultNone.ExciteWidth (float, optional) – Microwave excitation bandwidth (FWHM) in MHz for orientation selection in fixed-field experiments (salt ENDOR, orisel, saffron).
None(default) = no orientation selection;orisel()requires it (math.inf= no selection).Orientations (array_like or Tensor, shape (N, 2), optional) – pepper and orisel only. Field directions
[phi, theta]in radians in the molecular frame: B0 points along(sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)), the convention oflevels(sys, phi, theta, B)andresfields. A single[phi, theta]pair isN = 1. pepper then sums the stick spectra of these orientations, each with the powder (B1 averaged about B0) transition rates, without grid interpolation or SOPHE projection;Options.GridSize/GridSymmetryare ignored. Cannot be combined withOrdering,SampleFrame,SampleRotation,MolFrame,CrystalSymmetry,Options.SitesorOptions.separate='transitions'/'sites'. orisel returns one weight per orientation.None(default) = powder average on the simulator’s grid. Tensors are kept as given (may require grad); other inputs are converted to float arrays.OrientationWeights (array_like or Tensor, shape (N,), optional) – pepper only; requires
Orientations. Non-negative, finite weights, not all zero, used as given (not renormalized): each is the fraction of the full sphere its orientation stands for, so weights summing to 1 give the amplitude of pepper’s powder spectrum (a solid-angle quadrature of the sphere divided by 4 pi reproduces the powder).None(default) = equal weights1/N. May be a tensor that requires grad (pepper_autograd).
- Raises:
ValueError – On construction, if
RangeandCenterSweep(ormwRangeandmwCenterSweep) are both given; aCenterSweep/mwCenterSweepis not[center, width]with width> 0;ModAmp < 0;Field < 0in a frequency sweep or fixed-field experiment;mwRange(frequency sweep) orRange(field sweep) is not an increasing pair; a field sweep has no positivemwFreq;Harmonicis not 0, 1 or 2;nPoints < 2;Temperature <= 0; orOrientations/OrientationWeightshave the wrong shape, are not finite, or the weights are negative or all zero (or given withoutOrientations).
See also
Options,SpinSystem,torchspin.pepper.pepper,torchspin.garlic.garlicNotes
Single-crystal and ordered-sample conventions follow EasySpin; see KNOWN_LIMITATIONS.md, “Simulator — user-supplied orientations in pepper (0.7.6)” for
Orientationsand “Pepper and salt — zero field,Options.ZeroField(0.7.4)” forField = 0.Examples
A field sweep at X band;
Harmonicdefaults to the first derivative:>>> from torchspin import Experiment >>> exp = Experiment(mwFreq=9.5, CenterSweep=[340.0, 20.0], nPoints=512) >>> exp.Range, exp.Harmonic ([330.0, 350.0], 1)
A frequency sweep at a fixed field;
Harmonicdefaults to absorption:>>> exp = Experiment(Field=340.0, mwRange=[9.3, 9.7]) >>> exp.is_freq_swept, exp.Harmonic (True, 0)
See also
Options for computational settings, PulseExperiment for
pulse experiments in saffron().