Exemplo n.º 1
0
    def __init__(self,
                 standardName,
                 dataValues,
                 dataUnits,
                 hasNonIsUnits,
                 timeValues,
                 timeUnits,
                 timeSteps,
                 speciesName=''):
        """Constructor.

        Keyword arguments:
        standardName -- standard VisualPIC name of the data.
        dataValues -- a matrix containing all the data, where the columns are the particles and the rows are time steps. Data should be in the original units from the data file.
        dataUnits  -- string containing the data units.
        timeValues -- a 1D array containing the time values on each time step. Same number of elements as rows in dataValues. Data should be in the original units from the data file.
        timeUnits  -- string containing the time units.
        timeSteps  -- a 1D array containing the number of each time step saved to disk during the simulation.
        """
        DataElement.__init__(self, standardName, timeSteps, speciesName,
                             hasNonIsUnits)
        self.dataValues = dataValues
        self.dataUnits = dataUnits
        self.timeValues = timeValues
        self.timeUnits = timeUnits
Exemplo n.º 2
0
 def _SetTimeSteps(self):
     i = 0
     for DataName, DataElement in self.data.items():
         if i == 0:
             timeSteps = DataElement.GetTimeSteps()
         else:
             timeSteps = np.intersect1d(timeSteps, DataElement.GetTimeSteps())
     self.timeSteps = timeSteps
Exemplo n.º 3
0
 def __init__(self,
              simulationCode,
              nameInCode,
              standardName,
              location,
              timeSteps,
              speciesName="",
              internalName="",
              hasNonISUnits=True):
     DataElement.__init__(self, standardName, timeSteps, speciesName,
                          hasNonISUnits)
     self.dataNameInCode = nameInCode  # name of the variable in the simulation code (e.g. "e1-savg" for the averaged longitudinal E field in Osiris)
     self.dataLocation = location
     self.dataReader = None  # Each subclass will load its own
Exemplo n.º 4
0
 def SetSimulationParameters(self, parameters):
     # If there is no unitConverter or the simulation code has changed, create a new unitConverter.
     if (self.unitConverter == None) or (self._simulationParams["SimulationCode"] != parameters["SimulationCode"]):
         self.unitConverter = unitConverters.UnitConverterSelector.GetUnitConverter(parameters)
         DataElement.SetUnitConverter(self.unitConverter)
     # otherwise, update the current one.
     else:
         self.unitConverter.SetSimulationParameters(parameters)
     self._simulationParams = parameters