def clear_ogp(): """ Clear all of the Offset, Gain and Phase corrections registers on the adc. """ for core in range(1, 5): adc5g.set_spi_gain(roach2, zdok, core, 0) adc5g.set_spi_offset(roach2, zdok, core, 0) adc5g.set_spi_phase(roach2, zdok, core, 0)
def clear_ogp(): """ Clear all of the Offset, Gain and Phase corrections registers on the adc. """ for core in range(1,5): adc5g.set_spi_gain(roach2,zdok, core, 0) adc5g.set_spi_offset(roach2,zdok, core, 0) adc5g.set_spi_phase(roach2,zdok, core, 0)
def clear_ogp(self): ''' Clears the OGP registers on the ADC. ''' for core in range(1, 5): adc.set_spi_gain(self._roach, 0, core, 0) adc.set_spi_offset(self._roach, 0, core, 0) adc.set_spi_phase(self._roach, 0, core, 0)
def set_ogp(self, ogp): ''' Sets the OGP registers on the ADC. Input shape must be (4, 3). ''' offs = ogp[:, 0] gains = ogp[:, 1] phase = ogp[:, 2] for i in range(len(offs)): adc.set_spi_offset(self._roach, 0, i+1, offs[i]) adc.set_spi_gain(self._roach, 0, i+1, gains[i]) adc.set_spi_phase(self._roach, 0, i+1, phase[i])
def clear_ogp(self, chans=[0, 1, 2, 3]): """ Sets OGP to 0 for channels in 'chans' """ for chan in chans: zdok, cores = self.get_channel_core_spi(chan) for core in cores: adc5g.set_spi_offset(self.roach, zdok, core, 0) adc5g.set_spi_gain(self.roach, zdok, core, 0) adc5g.set_spi_phase(self.roach, zdok, core, 0)
def clear_ogp(self, chans = [0,1,2,3]): """ Sets OGP to 0 for channels in 'chans' """ for chan in chans: zdok, cores = self.get_channel_core_spi(chan) for core in cores: adc5g.set_spi_offset(self.roach, zdok, core, 0) adc5g.set_spi_gain(self.roach, zdok, core, 0) adc5g.set_spi_phase(self.roach, zdok, core, 0)
def set_phase(p1, p2, p3, p4): """ Set the phases (delays) for each core in the order a, b, c, d. """ t = float(p1) print math.floor(.5+t*255/28.)+0x80, adc5g.set_spi_phase(roach2,zdok, 1, t) t = float(p2) print math.floor(.5+t*255/28.)+0x80, adc5g.set_spi_phase(roach2,zdok, 2, t) t = float(p3) print math.floor(.5+t*255/28.)+0x80, adc5g.set_spi_phase(roach2,zdok, 3, t) t = float(p4) print math.floor(.5+t*255/28.)+0x80 adc5g.set_spi_phase(roach2,zdok, 4, t)
def set_phase(p1, p2, p3, p4): """ Set the phases (delays) for each core in the order a, b, c, d. """ t = float(p1) print math.floor(.5 + t * 255 / 28.) + 0x80, adc5g.set_spi_phase(roach2, zdok, 1, t) t = float(p2) print math.floor(.5 + t * 255 / 28.) + 0x80, adc5g.set_spi_phase(roach2, zdok, 2, t) t = float(p3) print math.floor(.5 + t * 255 / 28.) + 0x80, adc5g.set_spi_phase(roach2, zdok, 3, t) t = float(p4) print math.floor(.5 + t * 255 / 28.) + 0x80 adc5g.set_spi_phase(roach2, zdok, 4, t)
def set_ogp(self, ogp_chan, chan): """ Sets ogp for two cores of channel 'chan' multi_ogp is format (ogp1, ogp2) """ zdok, cores = self.get_channel_core_spi(chan) i = 0 for core in cores: off, gain, phase = ogp_chan[i] off_spi = math.floor(.5 + off * 255 / 100.) + 0x80 adc5g.set_spi_offset(self.roach, zdok, core, float(off)) gain_spi = math.floor(.5 + gain * 255 / 36.) + 0x80 adc5g.set_spi_gain(self.roach, zdok, core, float(gain)) phase_spi = math.floor(.5 + phase * 255 / 28.) + 0x80 adc5g.set_spi_phase(self.roach, zdok, core, float(phase) * 0.65) i += 1
def set_ogp(self, ogp_chan, chan): """ Sets ogp for two cores of channel 'chan' multi_ogp is format (ogp1, ogp2) """ zdok, cores = self.get_channel_core_spi(chan) i = 0 for core in cores: off, gain, phase = ogp_chan[i] off_spi = math.floor(.5 + off*255/100.) + 0x80 adc5g.set_spi_offset(self.roach, zdok, core, float(off)) gain_spi = math.floor(.5 + gain*255/36.) + 0x80 adc5g.set_spi_gain(self.roach, zdok, core, float(gain)) phase_spi = math.floor(.5 + phase*255/28.) + 0x80 adc5g.set_spi_phase(self.roach, zdok, core, float(phase)*0.65) i += 1