Beispiel #1
0
    def get_grain_polygon_blob(self):
        # self.debug('Get grain polygons n={}'.format(len(self.grain_polygons)))

        try:
            t, md, p = next(self.grain_polygons)

            a = pack('ff', ((t, md), ))
            b = pack('HH', p)

            return encode_blob(a + b)

        except (StopIteration, TypeError) as e:
            self.debug('No more grain polygons. {}'.format(e))
Beispiel #2
0
    def _save_peak_center(self, pc):
        self.info('DVC saving peakcenter')
        p = self._make_path(modifier='peakcenter')

        if pc:
            fmt = '>ff'
            obj = {'reference_detector': pc.reference_detector.name,
                   'reference_isotope': pc.reference_isotope,
                   'fmt': fmt,
                   'interpolation': pc.interpolation_kind if pc.use_interpolation else ''}

            results = pc.get_results()
            if results:
                for result in results:
                    points = encode_blob(pack(fmt, result.points))

                    obj[result.detector] = {'low_dac': result.low_dac,
                                            'center_dac': result.center_dac,
                                            'high_dac': result.high_dac,
                                            'low_signal': result.low_signal,
                                            'center_signal': result.center_signal,
                                            'high_signal': result.high_signal,
                                            'resolution': result.resolution,
                                            'low_resolving_power': result.low_resolving_power,
                                            'high_resolving_power': result.high_resolving_power,
                                            'points': points}

            dvc_dump(obj, p)
Beispiel #3
0
    def _save_monitor(self):
        if self.per_spec.monitor:
            p = self._make_path(modifier='monitor')
            checks = []
            for ci in self.per_spec.monitor.checks:
                data = encode_blob(pack('>ff', ci.data))
                params = dict(name=ci.name,
                              parameter=ci.parameter, criterion=ci.criterion,
                              comparator=ci.comparator, tripped=ci.tripped,
                              data=data)
                checks.append(params)

            dvc_dump(checks, p)
 def get_setpoint_blob(self):
     if len(self.setpoint_data):
         return pack('<ff', self.setpoint_data)
 def get_output_blob(self):
     if len(self.output_data):
         return pack('<ff', self.output_data)
 def get_response_blob(self):
     if len(self.response_data):
         # return ''.join([struct.pack('<ff', x, y) for x, y in self.response_data])
         return pack('<ff', self.response_data)