Commit b6892c0b authored by eric pellegrini's avatar eric pellegrini

The frequencies computed (and displayed) is now an angular frequency

parent d5500e27
......@@ -342,9 +342,9 @@ def _numberp(n): ## Python has to have a decent way to do this!
isinstance(n, types.LongType))
class Magnitude:
def __init__(self, val, m=0, s=0, K=0, kg=0, A=0, mol=0, cd=0, dollar=0, b=0):
def __init__(self, val, m=0, s=0, K=0, kg=0, A=0, mol=0, cd=0, dollar=0, b=0, rad=0):
self.val = val
self.unit = [m, s, K, kg, A, mol, cd, dollar, b]
self.unit = [m, s, K, kg, A, mol, cd, dollar, b, rad]
self.out_unit = None
self.out_factor = None
self.oprec = None
......@@ -1059,10 +1059,11 @@ def _init_mags():
new_mag('$', Magnitude(1.0, dollar=1))
new_mag('dollar', Magnitude(1.0, dollar=1))
new_mag('b', Magnitude(1.0, b=1)) # bit
new_mag('rad', Magnitude(1.0, rad=1)) # bit
# Magnitudes for derived SI units
new_mag('B', Magnitude(8.0, b=1))
new_mag('rad', Magnitude(1.0)) # radian
# new_mag('rad', Magnitude(1.0)) # radian
new_mag('sr', Magnitude(1.0)) # steradian
new_mag('Hz', Magnitude(1.0, s=-1)) # hertz
new_mag('g', Magnitude(1e-3, kg=1)) # gram
......@@ -1134,33 +1135,47 @@ def _init_mags():
new_mag('J_per_mole', Magnitude(1.66055927e-24, m=2, kg=1, s=-2))
new_mag('eV', Magnitude(1.60217649e-19, m=2, kg=1, s=-2))
new_mag('Ha', Magnitude(4.35974394e-18, m=2, kg=1, s=-2))
# Eric - frequency
new_mag('rad_inv_s', Magnitude(2.0*math.pi, s=-1))
# Energy equivalent
new_mag('inv_m_eq', Magnitude(1.9864455e-25, m=2, kg=1, s=-2))
new_mag('Hz_eq', Magnitude(6.62606896e-34, m=2, kg=1, s=-2))
new_mag('K_eq', Magnitude(1.3806504e-23, m=2, kg=1, s=-2))
new_mag('u_eq', Magnitude(1.49241783e-10, m=2, kg=1, s=-2))
new_mag('1/m_eq', Magnitude(1.9864455e-25, m=2, kg=1, s=-2))
new_mag('hnu', Magnitude(6.62606896e-34, m=2, kg=1, s=-2))
new_mag('T(energy)', Magnitude(1.3806504e-23, m=2, kg=1, s=-2))
new_mag('m(energy)', Magnitude(1.49241783e-10, m=2, kg=1, s=-2))
new_mag('h', Magnitude(6.62607004e-34,m=2,kg=1,s=-1))
new_mag('hbar', Magnitude(6.62607004e-34/2.0/math.pi,m=2,kg=1,s=-1,rad=-1))
# Frequency equivalent
new_mag('J_eq', Magnitude(1.50919045e+33, s=-1))
new_mag('eV_eq', Magnitude(2.41798945e+14, s=-1))
new_mag('J(freq)', Magnitude(1.50919045e+33, s=-1))
new_mag('eV(freq)', Magnitude(2.41798945e+14, s=-1))
# Eric - inverse of distance
new_mag('inv_m', Magnitude(1.0, m=-1, kg=0, s=0))
new_mag('inv_m', Magnitude(1.0, m=-1, kg=0, s=0))
new_mag('inv_um', Magnitude(1.0e6, m=-1, kg=0, s=0))
new_mag('inv_nm', Magnitude(1.0e9, m=-1, kg=0, s=0))
new_mag('inv_ang', Magnitude(1.0e10, m=-1, kg=0, s=0))
# new_mag('1/m', Magnitude(1.0, m=-1, kg=0, s=0))
# new_mag('inv_cm', Magnitude(1.0e2, m=-1, kg=0, s=0))
# new_mag('inv_um', Magnitude(1.0e6, m=-1, kg=0, s=0))
# new_mag('inv_nm', Magnitude(1.0e9, m=-1, kg=0, s=0))
# new_mag('inv_ang', Magnitude(1.0e10, m=-1, kg=0, s=0))
new_mag('cyc', Magnitude(2.0*math.pi,rad=1))
new_mag('au', Magnitude(1.0))
new_mag('wu', Magnitude(1.0))
new_mag('unitless', Magnitude(1.0))
new_mag('no-unit', Magnitude(1.0))
# Eric - frequency
# new_mag('rad_inv_s', Magnitude(1.0, s=-1))
# new_mag('rad_inv_ps', Magnitude(1.0e12, s=-1))
if not MAGS:
_init_mags()
if __name__ == "__main__":
print mg(1.0,'h THz','meV')
print mg(1.0,'meV/h','THz')
print mg(1.0,'hbar rad/ps','meV')
print mg(1.0,'cyc THz','rad/ps')
print mg(1.0,'rad/ps',' cyc THz')
print mg(1.0,'rad/ps',' cyc meV(freq)')
......@@ -33,7 +33,7 @@ Created on Mar 30, 2015
import numpy
from MDANSE import REGISTRY
from MDANSE.Framework.Configurators.IConfigurator import IConfigurator, ConfiguratorError
from MDANSE.Framework.Configurators.IConfigurator import IConfigurator
class InstrumentResolutionConfigurator(IConfigurator):
"""
......@@ -43,7 +43,7 @@ class InstrumentResolutionConfigurator(IConfigurator):
of states) when performing the fourier transform of its time-dependant counterpart. This allow to
convolute of the signal with a resolution function to have a better match with experimental spectrum.
In MDANSE, the instrument resolution are defined in frequency (energy) space and are internally
In MDANSE, the instrument resolution are defined in omegas space and are internally
inverse-fourier-transformed to get a time-dependant version. This time-dependant resolution function will then
be multiplied by the time-dependant signal to get the resolution effect according to the Fourier Transform theorem:
......@@ -83,11 +83,10 @@ class InstrumentResolutionConfigurator(IConfigurator):
self._timeStep = framesCfg['time'][1] - framesCfg['time'][0]
self['time_step'] = self._timeStep
self["frequencies"] = numpy.fft.fftshift(numpy.fft.fftfreq(2*self["n_frames"]-1,self["time_step"]))
df = round(self["frequencies"][1] - self["frequencies"][0],3)
self["n_frequencies"] = len(self["frequencies"])
# We compute angular frequency AND NOT ORDINARY FREQUENCY ANYMORE
self["omega"] = 2.0*numpy.pi*numpy.fft.fftshift(numpy.fft.fftfreq(2*self["n_frames"]-1,self["time_step"]))
self["n_omegas"] = len(self["omega"])
kernel, parameters = value
......@@ -97,21 +96,11 @@ class InstrumentResolutionConfigurator(IConfigurator):
resolution.setup(parameters)
resolution.set_kernel(self["frequencies"], self["time_step"])
dmax = resolution.timeWindow.max()-1
if dmax > 0.1:
raise ConfiguratorError('''the resolution function is too sharp for the available frequency step.
You can change your resolution function settings to make it broader or use "ideal" kernel if you do not want to smooth your signal.
For a gaussian resolution function, this would correspond to a sigma at least equal to the frequency step (%s)''' % df,self)
elif dmax < -0.1:
raise ConfiguratorError('''the resolution function is too broad.
You should change your resolution function settings to make it sharper.''',self)
resolution.set_kernel(self["omega"], self["time_step"])
self["frequency_window"] = resolution.frequencyWindow
self["omega_window"] = resolution.omegaWindow
self["time_window"] = resolution.timeWindow
self["time_window"] = resolution.timeWindow.real
self["kernel"] = kernel
self["parameters"] = parameters
......
......@@ -46,10 +46,10 @@ class GaussianInstrumentResolution(IInstrumentResolution):
settings['mu'] = ('float', {"default":0.0})
settings['sigma'] = ('float', {"default":1.0})
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
mu = self._configuration["mu"]["value"]
sigma = self._configuration["sigma"]["value"]
self._frequencyWindow = (numpy.sqrt(2.0*numpy.pi)/sigma)*numpy.exp(-0.5*((frequencies-mu)/sigma)**2)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._frequencyWindow))/dt)
self._omegaWindow = (numpy.sqrt(2.0*numpy.pi)/sigma)*numpy.exp(-0.5*((omegas-mu)/sigma)**2)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._omegaWindow))/dt)
......@@ -49,21 +49,21 @@ class IInstrumentResolution(Configurable):
Configurable.__init__(self)
self._frequencyWindow = None
self._omegaWindow = None
self._timeWindow = None
@abc.abstractmethod
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
pass
@property
def frequencyWindow(self):
def omegaWindow(self):
if self._frequencyWindow is None:
raise InstrumentResolutionError("Undefined frequency window")
if self._omegaWindow is None:
raise InstrumentResolutionError("Undefined omega window")
return self._frequencyWindow
return self._omegaWindow
@property
def timeWindow(self):
......
......@@ -44,9 +44,10 @@ class IdealInstrumentResolution(IInstrumentResolution):
settings = collections.OrderedDict()
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
self._frequencyWindow = numpy.zeros(len(frequencies), dtype=numpy.float64)
self._frequencyWindow[len(frequencies)/2] = 1.0
nOmegas = len(omegas)
self._omegaWindow = numpy.zeros(nOmegas, dtype=numpy.float64)
self._omegaWindow[nOmegas/2] = 1.0
self._timeWindow = numpy.ones(len(frequencies), dtype=numpy.float64)
\ No newline at end of file
self._timeWindow = numpy.ones(nOmegas, dtype=numpy.float64)
\ No newline at end of file
......@@ -47,11 +47,11 @@ class LorentzianInstrumentResolution(IInstrumentResolution):
settings['mu'] = ('float', {"default":0.0})
settings['sigma'] = ('float', {"default":1.0})
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
mu = self._configuration["mu"]["value"]
sigma = self._configuration["sigma"]["value"]
self._frequencyWindow = (2.0*sigma)/((frequencies-mu)**2 + sigma**2)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._frequencyWindow))/dt)
self._omegaWindow = (2.0*sigma)/((omegas-mu)**2 + sigma**2)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._omegaWindow))/dt)
\ No newline at end of file
......@@ -49,7 +49,7 @@ class PseudoVoigtInstrumentResolution(IInstrumentResolution):
settings['mu_gaussian'] = ('float', {"default":0.0})
settings['sigma_gaussian'] = ('float', {"default":1.0})
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
eta = self._configuration["eta"]["value"]
muL = self._configuration["mu_lorentzian"]["value"]
......@@ -57,10 +57,10 @@ class PseudoVoigtInstrumentResolution(IInstrumentResolution):
muG = self._configuration["mu_gaussian"]["value"]
sigmaG = self._configuration["sigma_gaussian"]["value"]
gaussian = (numpy.sqrt(2.0*numpy.pi)/sigmaG)*numpy.exp(-0.5*((frequencies-muG)/sigmaG)**2)
gaussian = (numpy.sqrt(2.0*numpy.pi)/sigmaG)*numpy.exp(-0.5*((omegas-muG)/sigmaG)**2)
lorentzian = (2.0*sigmaL)/((frequencies-muL)**2 + sigmaL**2)
lorentzian = (2.0*sigmaL)/((omegas-muL)**2 + sigmaL**2)
self._frequencyWindow = eta*lorentzian + (1.0-eta)*gaussian
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._frequencyWindow))/dt)
self._omegaWindow = eta*lorentzian + (1.0-eta)*gaussian
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._omegaWindow))/dt)
\ No newline at end of file
......@@ -46,12 +46,12 @@ class SquareInstrumentResolution(IInstrumentResolution):
settings['mu'] = ('float', {"default":0.0})
settings['sigma'] = ('float', {"default":1.0})
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
mu = self._configuration["mu"]["value"]
sigma = self._configuration["sigma"]["value"]
self._frequencyWindow = 2.0*numpy.pi*numpy.where((numpy.abs(frequencies-mu)-sigma) > 0,0.0,1.0/(2.0*sigma))
self._omegaWindow = 2.0*numpy.pi*numpy.where((numpy.abs(omegas-mu)-sigma) > 0,0.0,1.0/(2.0*sigma))
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._frequencyWindow))/dt)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._omegaWindow))/dt)
\ No newline at end of file
......@@ -46,13 +46,13 @@ class TriangularInstrumentResolution(IInstrumentResolution):
settings['mu'] = ('float', {"default":0.0})
settings['sigma'] = ('float', {"default":1.0})
def set_kernel(self, frequencies, dt):
def set_kernel(self, omegas, dt):
mu = self._configuration["mu"]["value"]
sigma = self._configuration["sigma"]["value"]
val = numpy.abs(frequencies-mu) - sigma
val = numpy.abs(omegas-mu) - sigma
self._frequencyWindow = 2.0*numpy.pi*numpy.where( val >= 0, 0.0, -val/sigma**2)
self._omegaWindow = 2.0*numpy.pi*numpy.where( val >= 0, 0.0, -val/sigma**2)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._frequencyWindow))/dt)
self._timeWindow = numpy.fft.fftshift(numpy.fft.ifft(numpy.fft.ifftshift(self._omegaWindow))/dt)
......@@ -86,14 +86,14 @@ class AngularCorrelation(IJob):
self.numberOfSteps = self.configuration['axis_selection']['n_values']
self._outputData.add("times","line", self.configuration['frames']['time'],units='ps')
self._outputData.add("time","line", self.configuration['frames']['time'],units='ps')
self._outputData.add("axis_index","line", numpy.arange(self.configuration['axis_selection']['n_values']), units='au')
self._outputData.add('ac',"line", (self.configuration['frames']['number'],), axis="times", units="au")
self._outputData.add('ac',"line", (self.configuration['frames']['number'],), axis="time", units="au")
if self.configuration['per_axis']['value']:
self._outputData.add('ac_per_axis',"surface", (self.configuration['axis_selection']['n_values'],self.configuration['frames']['number'],), axis='axis_index|times', units="au")
self._outputData.add('ac_per_axis',"surface", (self.configuration['axis_selection']['n_values'],self.configuration['frames']['number'],), axis='axis_index|time', units="au")
def run_step(self, index):
"""
......
......@@ -82,9 +82,9 @@ class AreaPerMolecule(IJob):
if self._nMolecules == 0:
raise AreaPerMoleculeError("No molecule matches %r name." % self.configuration["name"]["value"])
self._outputData.add("times", "line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time", "line", self.configuration['frames']['time'], units='ps')
self._outputData.add("area_per_molecule", "line", (self.configuration['frames']['number'],), axis="times", units="1/nm2")
self._outputData.add("area_per_molecule", "line", (self.configuration['frames']['number'],), axis="time", units="1/nm2")
def run_step(self, index):
"""
......
......@@ -82,13 +82,15 @@ class CurrentCorrelationFunction(IJob):
self._instrResolution = self.configuration["instrument_resolution"]
self._nFrequencies = self._instrResolution['n_frequencies']
self._nOmegas = self._instrResolution['n_omegas']
self._outputData.add("q","line", numpy.array(self.configuration["q_vectors"]["shells"]), units="inv_nm")
self._outputData.add("times","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], units="au")
self._outputData.add("frequency","line", self._instrResolution["frequencies"],units='THz')
self._outputData.add("omega","line", self._instrResolution["omega"],units='rad/ps')
self._outputData.add("omega_window","line", self._instrResolution["omega_window"], axis="omega", units="au")
self._elements = self.configuration['atom_selection']['unique_names']
self._elementsPairs = sorted(itertools.combinations_with_replacement(self._elements,2))
......@@ -96,15 +98,15 @@ class CurrentCorrelationFunction(IJob):
self._indexesPerElement = self.configuration['atom_selection'].get_indexes()
for pair in self._elementsPairs:
self._outputData.add("j(q,t)_long_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|times", units="au")
self._outputData.add("j(q,t)_trans_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|times", units="au")
self._outputData.add("J(q,f)_long_%s%s" % pair,"surface", (nQShells,self._nFrequencies), axis="q|frequency", units="au")
self._outputData.add("J(q,f)_trans_%s%s" % pair,"surface", (nQShells,self._nFrequencies), axis="q|frequency", units="au")
self._outputData.add("j(q,t)_long_total","surface", (nQShells,self._nFrames), axis="q|times" , units="au")
self._outputData.add("J(q,f)_long_total","surface", (nQShells,self._nFrequencies), axis="q|frequency", units="au")
self._outputData.add("j(q,t)_trans_total","surface", (nQShells,self._nFrames), axis="q|times" , units="au")
self._outputData.add("J(q,f)_trans_total","surface", (nQShells,self._nFrequencies), axis="q|frequency", units="au")
self._outputData.add("j(q,t)_long_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|time", units="au")
self._outputData.add("j(q,t)_trans_%s%s" % pair,"surface", (nQShells,self._nFrames), axis="q|time", units="au")
self._outputData.add("J(q,f)_long_%s%s" % pair,"surface", (nQShells,self._nOmegas), axis="q|omega", units="au")
self._outputData.add("J(q,f)_trans_%s%s" % pair,"surface", (nQShells,self._nOmegas), axis="q|omega", units="au")
self._outputData.add("j(q,t)_long_total","surface", (nQShells,self._nFrames), axis="q|time" , units="au")
self._outputData.add("J(q,f)_long_total","surface", (nQShells,self._nOmegas), axis="q|omega", units="au")
self._outputData.add("j(q,t)_trans_total","surface", (nQShells,self._nFrames), axis="q|time" , units="au")
self._outputData.add("J(q,f)_trans_total","surface", (nQShells,self._nOmegas), axis="q|omega", units="au")
def run_step(self, index):
"""
......
......@@ -67,11 +67,11 @@ class Density(IJob):
self._symbols = sorted_atoms(self.configuration['trajectory']['instance'].universe,"symbol")
# Will store the time.
self._outputData.add("times","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("mass_density","line", (self._nFrames,), units='g/cm3')
self._outputData.add("mass_density","line", (self._nFrames,), axis='time', units='g/cm3')
self._outputData.add("atomic_density","line", (self._nFrames,), units='1/cm3')
self._outputData.add("atomic_density","line", (self._nFrames,), axis='time', units='1/cm3')
if not self.configuration['trajectory']['instance'].universe.is_periodic:
raise JobError("Pair distribution function cannot be calculated for infinite universe trajectories")
......
......@@ -77,14 +77,14 @@ class DensityOfStates(IJob):
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line", instrResolution["time_window"], axis="time", units="au")
self._outputData.add("frequency","line", instrResolution["frequencies"], units='THz')
self._outputData.add("frequency_window","line", instrResolution["frequency_window"], axis="frequency", units="au")
self._outputData.add("omega","line", instrResolution["omega"], units='rad/ps')
self._outputData.add("omega_window","line", instrResolution["omega_window"], axis="omega", units="au")
for element in self.configuration['atom_selection']['unique_names']:
self._outputData.add("vacf_%s" % element,"line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2")
self._outputData.add("dos_%s" % element,"line", (instrResolution['n_frequencies'],), axis="frequency", units="nm2/ps")
self._outputData.add("dos_%s" % element,"line", (instrResolution['n_omegas'],), axis="omega", units="nm2/ps")
self._outputData.add("vacf_total","line", (self.configuration['frames']['number'],), axis="time", units="nm2/ps2")
self._outputData.add("dos_total","line", (instrResolution['n_frequencies'],), axis="frequency", units="nm2/ps")
self._outputData.add("dos_total","line", (instrResolution['n_omegas'],), axis="omega", units="nm2/ps")
def run_step(self, index):
"""
......
......@@ -148,7 +148,7 @@ class DensityProfile(IJob):
dpTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,1,"dp_%s")
self._outputData.add("dp_total","line", dpTotal, axis="times", units="au")
self._outputData.add("dp_total","line", dpTotal, axis="time", units="au")
self._extent /= self.numberOfSteps
......
......@@ -88,25 +88,25 @@ class DynamicCoherentStructureFactor(IJob):
self._instrResolution = self.configuration["instrument_resolution"]
self._nFrequencies = self._instrResolution['n_frequencies']
self._nOmegas = self._instrResolution['n_omegas']
self._outputData.add("q","line",self.configuration["q_vectors"]["shells"], units="inv_nm")
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], axis="time", units="au")
self._outputData.add("time_window","line", self._instrResolution["time_window"], units="au")
self._outputData.add("frequency","line", self._instrResolution["frequencies"], units='THz')
self._outputData.add("frequency_window","line", self._instrResolution["frequency_window"], axis="frequency", units="au")
self._outputData.add("omega","line", self._instrResolution["omega"], units='rad/ps')
self._outputData.add("omega_window","line", self._instrResolution["omega_window"], axis="omega", units="au")
self._elementsPairs = sorted(itertools.combinations_with_replacement(self.configuration['atom_selection']['unique_names'],2))
self._indexesPerElement = self.configuration['atom_selection'].get_indexes()
for pair in self._elementsPairs:
self._outputData.add("f(q,t)_%s%s" % pair,"surface", (nQShells,self._nFrames),axis="q|time" , units="au")
self._outputData.add("s(q,f)_%s%s" % pair,"surface", (nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("f(q,t)_%s%s" % pair,"surface", (nQShells,self._nFrames),axis="q|time", units="au")
self._outputData.add("s(q,f)_%s%s" % pair,"surface", (nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
self._outputData.add("f(q,t)_total","surface", (nQShells,self._nFrames), axis="q|time", units="au")
self._outputData.add("s(q,f)_total","surface", (nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("s(q,f)_total","surface", (nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
def run_step(self, index):
"""
......@@ -176,7 +176,7 @@ class DynamicCoherentStructureFactor(IJob):
self._outputData["s(q,f)_%s%s" % pair][:] = get_spectrum(self._outputData["f(q,t)_%s%s" % pair],
self.configuration["instrument_resolution"]["time_window"],
self.configuration["instrument_resolution"]["time_step"],
axis=1)
axis=1)
fqtTotal = weight(self.configuration["weights"].get_weights(),self._outputData,nAtomsPerElement,2,"f(q,t)_%s%s")
......
......@@ -79,22 +79,22 @@ class DynamicIncoherentStructureFactor(IJob):
self._instrResolution = self.configuration["instrument_resolution"]
self._nFrequencies = self._instrResolution['n_frequencies']
self._nOmegas = self._instrResolution['n_omegas']
self._outputData.add("q","line", self.configuration["q_vectors"]["shells"], units="inv_nm")
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line", self._instrResolution["time_window"], axis="time", units="au")
self._outputData.add("frequency","line", self._instrResolution["frequencies"], units='THz')
self._outputData.add("frequency_window","line", self._instrResolution["frequency_window"], axis="frequency", units="au")
self._outputData.add("omega","line", self._instrResolution["omega"], units='rad/ps')
self._outputData.add("omega_window","line", self._instrResolution["omega_window"], axis="omega", units="au")
for element in self.configuration['atom_selection']['unique_names']:
self._outputData.add("f(q,t)_%s" % element,"surface", (self._nQShells,self._nFrames) , axis="q|time", units="au")
self._outputData.add("s(q,f)_%s" % element,"surface", (self._nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("s(q,f)_%s" % element,"surface", (self._nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
self._outputData.add("f(q,t)_total","surface", (self._nQShells,self._nFrames) , axis="q|time", units="au")
self._outputData.add("s(q,f)_total","surface", (self._nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("s(q,f)_total","surface", (self._nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
def run_step(self, index):
"""
......
......@@ -79,7 +79,7 @@ class GaussianDynamicIncoherentStructureFactor(IJob):
self._instrResolution = self.configuration["instrument_resolution"]
self._nFrequencies = self._instrResolution['n_frequencies']
self._nOmegas = self._instrResolution['n_omegas']
self._kSquare = self.configuration["q_shells"]["value"]**2
......@@ -87,18 +87,18 @@ class GaussianDynamicIncoherentStructureFactor(IJob):
self._outputData.add("q2","line",self._kSquare,units="inv_nm**2")
self._outputData.add("times","line",self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line",self._instrResolution["time_window"], axis="times", units="au")
self._outputData.add("time","line",self.configuration['frames']['time'], units='ps')
self._outputData.add("time_window","line",self._instrResolution["time_window"], axis="time", units="au")
self._outputData.add("frequency","line",self.configuration["instrument_resolution"]["frequencies"], units='THz')
self._outputData.add("frequency_window","line",self._instrResolution["frequency_window"], axis="frequency", units="au")
self._outputData.add("omega","line",self.configuration["instrument_resolution"]["omega"], units='rad/ps')
self._outputData.add("omega_window","line",self._instrResolution["omega_window"], axis="omega", units="au")
for element in self.configuration['atom_selection']['unique_names']:
self._outputData.add("f(q,t)_%s" % element,"surface", (self._nQShells,self._nFrames),axis="q|times", units="au")
self._outputData.add("s(q,f)_%s" % element,"surface", (self._nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("f(q,t)_%s" % element,"surface", (self._nQShells,self._nFrames),axis="q|time", units="au")
self._outputData.add("s(q,f)_%s" % element,"surface", (self._nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
self._outputData.add("f(q,t)_total","surface",(self._nQShells,self._nFrames), axis="q|times", units="au")
self._outputData.add("s(q,f)_total","surface",(self._nQShells,self._nFrequencies), axis="q|frequency", units="nm2/ps")
self._outputData.add("f(q,t)_total","surface",(self._nQShells,self._nFrames), axis="q|time", units="au")
self._outputData.add("s(q,f)_total","surface",(self._nQShells,self._nOmegas), axis="q|omega", units="nm2/ps")
def run_step(self, index):
"""
......
......@@ -515,7 +515,7 @@ class %s(IJob):
self.numberOfSteps = self.configuration['frames']['number']
# Create an output data for the selected frames.
self._outputData.add("times", "line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time", "line", self.configuration['frames']['time'], units='ps')
def run_step(self, index):
......
......@@ -79,11 +79,11 @@ class McStasVirtualInstrument(IJob):
settings['frames'] = ('frames', {"dependencies":{'trajectory':'trajectory'}})
settings['sample_coh'] = ('netcdf_input_file', {"widget":'input_file',
"label":'MDANSE Coherent Structure Factor',
"variables":['q','frequency','s(q,f)_total'],
"variables":['q','omega','s(q,f)_total'],
'default' : os.path.join('..','..','..','Data','NetCDF','dcsf_prot.nc')})
settings['sample_inc'] = ('netcdf_input_file', {"widget":'input_file',
"label":'MDANSE Incoherent Structure Factor',
"variables" :['q','frequency','s(q,f)_total'],
"variables" :['q','omega','s(q,f)_total'],
'default':os.path.join('..','..','..','Data','NetCDF','disf_prot.nc')})
settings['temperature'] = ('float', {"default":298.0})
settings['display'] = ('boolean', {'label':'trace the 3D view of the simulation'})
......
......@@ -90,11 +90,11 @@ class MeanSquareDisplacement(IJob):
self.numberOfSteps = self.configuration['atom_selection']['selection_length']
# Will store the time.
self._outputData.add("times", "line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time", "line", self.configuration['frames']['time'], units='ps')
# Will store the mean square displacement evolution.
for element in self.configuration['atom_selection']['unique_names']:
self._outputData.add("msd_%s" % element, "line", (self.configuration['frames']['number'],), axis="times", units="nm2")
self._outputData.add("msd_%s" % element, "line", (self.configuration['frames']['number'],), axis="time", units="nm2")
def run_step(self, index):
"""
......@@ -152,7 +152,7 @@ class MeanSquareDisplacement(IJob):
weights = self.configuration["weights"].get_weights()
msdTotal = weight(weights,self._outputData,nAtomsPerElement,1,"msd_%s")
self._outputData.add("msd_total", "line", msdTotal, axis="times", units="nm2")
self._outputData.add("msd_total", "line", msdTotal, axis="time", units="nm2")
self._outputData.write(self.configuration['output_files']['root'], self.configuration['output_files']['formats'], self._info)
......
......@@ -100,7 +100,7 @@ class OrderParameter(IJob):
self.numberOfSteps = self._nAxis
self._outputData.add("times","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("time","line", self.configuration['frames']['time'], units='ps')
self._outputData.add("axis_index","line", numpy.arange(self.configuration['axis_selection']['n_values']), units='au')
......@@ -117,13 +117,13 @@ class OrderParameter(IJob):
else:
self._doRotation = True
self._outputData.add('p1',"line", (self._nFrames,), axis='times', units="au")
self._outputData.add('p2',"line", (self._nFrames,), axis='times', units="au")
self._outputData.add('s2',"line", (self._nAxis,), axis='times', units="au")
self._outputData.add('p1',"line", (self._nFrames,), axis='time', units="au")
self._outputData.add('p2',"line", (self._nFrames,), axis='time', units="au")
self._outputData.add('s2',"line", (self._nAxis,), axis='time', units="au")
if self.configuration['per_axis']['value']:
self._outputData.add('p1_per_axis',"surface", (self._nAxis,self._nFrames), axis='axis_index|times', units="au")
self._outputData.add('p2_per_axis',"surface", (self._nAxis,self._nFrames), axis='axis_index|times', units="au")
self._outputData.add('p1_per_axis',"surface", (self._nAxis,self._nFrames), axis='axis_index|time', units="au")
self._outputData.add('p2_per_axis',"surface", (self._nAxis,self._nFrames), axis='axis_index|time', units="au")
def run_step(self, index):
"""
......
......@@ -73,18 +73,18 @@ class StructureFactorFromScatteringFunction(IJob):
self._outputData.add("q","line", inputFile.variables['q'].getValue(), units="inv_nm")
self._outputData.add("frequency","line", resolution["frequencies"], units='THz')
self._outputData.add("omega","line", resolution["omega"], units='rad/ps')
self._outputData.add("frequency_window","line", resolution["frequency_window"], axis="frequency", units="au")
self._outputData.add("omega_window","line", resolution["omega_window"], axis="omega", units="au")
nQVectors = len(inputFile.variables['q'].getValue())
nFrequencies = resolution['n_frequencies']
nOmegas = resolution['n_omegas']
for k, v in inputFile.variables.items():
if k.startswith('f(q,t)_'):
self._outputData.add(k,"surface", v.getValue(), axis="q|time", units="au")