def counts_to_rms_amps(wiringmap, hkmap, bolo, system, tf=None): boardhk, mezzhk, modhk, chanhk = HousekeepingForBolo(hkmap, wiringmap, bolo, True) if system == 'ICE': if chanhk.dan_streaming_enable: tf_I = IceboardConversions.convert_TF(modhk.nuller_gain, target='nuller', custom_TF=tf, unit='RAW', frequency=chanhk.carrier_frequency/core.G3Units.Hz) else: tf_V = IceboardConversions.convert_adc_samples('Streamer') tf_I = tf_V/modhk.squid_transimpedance if chanhk.carrier_frequency != 0: tf_I /= numpy.sqrt(2) # Use RMS amps elif system == 'DfMux': if chanhk.dan_streaming_enable: squid_converter = convert_squid(units='Normalized') tf_I = 1. / (2.**24) * squid_converter.theo_AnToIbolo(1., Gnuller=modhk.nuller_gain, eff=1.) else: dfmux_converter = convert_demod('gcp') resistor='10K' # Assume this for DAN Off # Handle the three exceptions for SPTpol if bolo in ['Sq3SBpol23Ch7', 'Sq3SBpol23Ch3', 'Sq3SBpol23Ch5']: resistor='5K' # XXX above list is wrong for 100d data if boardhk.timestamp.mjd < 56293: core.log_fatal('Set correct resistor values for 2012 SPTpol data', unit='dfmux.unittransforms') tf_I = dfmux_converter.theo_AdcToIbolo(1., modhk.demod_gain, resistor, f_carrier_equals_f_demod=True) tf_I *= 256 # 3G software shifts 8 bits right compared to SPTpol, so account for difference in meaning of "counts" else: core.log_fatal('Unknown transfer function profile %s' % system, unit='dfmux.unittransforms') return tf_I * core.G3Units.amp
def bolo_bias_voltage_rms(wiringmap, hkmap, bolo, system, tf=None): boardhk, mezzhk, modhk, chanhk = HousekeepingForBolo(hkmap, wiringmap, bolo, True) if system == 'ICE': tf_V = IceboardConversions.convert_TF(modhk.carrier_gain, target='carrier', custom_TF=tf, unit='NORMALIZED', frequency=chanhk.carrier_frequency/core.G3Units.Hz) volts = tf_V * chanhk.carrier_amplitude * core.G3Units.V if chanhk.carrier_frequency != 0: volts /= numpy.sqrt(2) # Use RMS amps elif system == 'DfMux': squid_converter = convert_squid(units='Normalized') volts = squid_converter.theo_AcToVbias(chanhk.carrier_amplitude, modhk.carrier_gain) * core.G3Units.V else: core.log_fatal('Unknown transfer function profile %s' % system, unit='dfmux.unittransforms') return volts