Ejemplo n.º 1
0
    def add_sval(self,
                 stype=None,
                 sval=None,
                 unit=None,
                 series_obj=None,
                 comment=''):
        """
        adds a series to measurement.series, then adds is to the data and results datastructure
        
        Parameters
        ----------
           stype: str
              series type to be added
           sval: float or int
              series value to be added
           unit: str
              unit to be added. can be None #todo change so it uses Pint
           comment: str
              adds a comment to the series

        Returns
        -------
           RockPy.Series instance
        """

        if series_obj:
            series = series_obj
        else:
            series = RockPy.Series(stype=stype,
                                   value=sval,
                                   unit=unit,
                                   comment=comment)
        self._series.append(series)
        self._add_sval_to_data(series)
        self._add_sval_to_results(series)
        self.sample_obj.add_series2_mdict(series=series, mobj=self)
        return series
Ejemplo n.º 2
0
 def series(self):
     if self.has_series():
         return self._series
     else:
         series = RockPy.Series(stype='none', value=np.nan, unit='')
         return [series]