epsproc.efield package
Submodules
- epsproc.efield.efields module
Efield
Efield.ECalc()
Efield.EFFT()
Efield.EiFFT()
Efield.FWHMGau()
Efield.Gau()
Efield.calcSpectrogram()
Efield.chirp()
Efield.fConv()
Efield.finst()
Efield.phaseMask()
Efield.plot()
Efield.plotSpectrogram()
Efield.plotSpectrogramHV()
Efield.printDef()
Efield.removePhase()
Efield.setEf()
Efield.setPhase()
Efield.toXarrayDS()
Module contents
ePSproc electric field functions.
Generate, propagate and model E-fields.
06/05/20 Updated methods, added Xarray conversion & Holoviews plotting - basics only.
27/04/20 Updating & packaging - but still very much a work-in-progress.
20/3/20 Basics developed in tests/methodDev/geometric_method_dev_low-level_E-fields_200320.ipynb
TODO - Integration with EPR and geometric methods code. Need Xarray conversion plus appropriate regridding for this, and proper handling of polarisation terms p. - Tidy up and debug. - Improve spectrogram methods & plotting. - Improve pulse modification methods. - Additional pulse properties, e.g. instantaneous frequency.
- class epsproc.efield.Efield(Edef=None, units=None, verbose=True)[source]
Bases:
object
Basic class for handling E-field generation, data and related functions.
Currently set for field creation based on Gaussian defined in time-domain. Defaults to a single (E,t) point if no parameters are supplied - this can be used with
epsproc.geomFunc.EPR()
Starting to look a bit top-heavy… passing directly to Xarray might save some structural overhead here?
Define Gaussian field in the time-domain, with amplitude $E_0$, width $sigma$ and carrier frequency $omega_0$:
\[ \begin{align}\begin{aligned}E(\omega_0,t)=E_{0}e^{-(t^2/2\sigma^{2})}e^{i\omega_0 t}\\Carrier frequency in rad/s:\end{aligned}\end{align} \]\[ \begin{align}\begin{aligned}\omega_0 = 2\pi \Omega_0\\FWHM and Gaussian width (see https://en.wikipedia.org/wiki/Gaussian_function for full definitions):\end{aligned}\end{align} \]\[ \begin{align}\begin{aligned}FWHM = 2\sigma\sqrt{2ln2}\\Parameters ---------- If no parameters are passed, return single point with E0 = 1 For a time-dependent field, pass at least sigma.\\E0 : float, optional, default = None Set (relative) field strength. If None, set E0 = 1\\sigma : float, optional, default = None Set Gaussian width :math:\sigma, where :math:FWHM=2\sigma\sqrt{2ln2}\\t : array, optional, default = None Set time axis for E-field. If None, defaults to np.arange(-(5*sigma), 5*sigma, self.dt), and self.dt = 0.01*sigma\\dt : float, optional, default = None Set time-step. Default will set from t-axis, or self.dt = 0.01*sigma if sigma only passed. Pass here to override.\\l0 : float, optional, default = None Central wavelength in wavelength working units. If supplied this will be used to set f0 and w0.\\f0, w0 : float, optional, default = None Carrier frequency in freq. units, and :math:\omega_0 in (rad/s). If only f0 supplied, w0 will be calculated. If f0 and w0 supplied, w0 will be used directly. If None, this will be ignored.\\units : dictionary, optional, default = None Set units. If not passed, default dict will be created with units (THz, nm, fs) set.\\ TODO: - best way to handle unit conversions? Did some of this for FROG code already? Yes, see python est_codes\E_fields_redux_231118_class.py - Consider other structures here, dataclass or namedtuple? https://stackoverflow.com/questions/354883/how-do-i-return-multiple-values-from-a-function - Xarray conversion? Use Xarray directly in class? - Bug with FFT/iFFT code? If shift=True and ishift=True then get extra freq components on iFFT - must be bug in axis assignment/conversion? OK if shift = False.\end{aligned}\end{align} \]- chirp(A, resetPhase=False, comment=None)[source]
Add quadratic phase (chirp) in spectral domain. Requires an E-field object, and chirp parameter A.
TODO: check Diels for nomenclature here.
- phaseMask(domain=None, thres=None)[source]
Mask pulse phase away from main features. Should convert to use masked arrays for reversibility, or just return a mask (currently overwrites Ef).
- plot(plotType='phaseUW', Nplot=None, domainList=None, thres=0.01)[source]
Basic plot with Matplotlib
- plotSpectrogram()[source]
VERY basic spectrogram plotter from old code - for quick testing only.
TODO: fix axes for with/withou fft shift.
BETTER: use plotSpectrogramHV() instead, this uses full axes as set.