if __name__ == '__main__': logger = logging.getLogger('main') handler = logging.StreamHandler() colored_formatter = ColoredFormatter("%(log_color)s%(asctime)s%(levelname)s:%(name)s:%(message)s") handler.setFormatter(colored_formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG) correlator = Correlator(logger = logger.getChild('correlator')) correlator.set_shift_schedule(0b00000000000) correlator.set_accumulation_len(40000) correlator.re_sync() correlator.fetch_autos() correlator.fetch_time_domain_snapshot(force=True) correlator.add_cable_length_calibrations('/home/jgowans/workspace/directionFinder_backend/config/cable_length_calibration.json') #correlator.apply_frequency_bin_calibrations('/home/jgowans/workspace/directionFinder_backend/config/frequency_domain_calibration_through_chain.json') correlator.add_frequency_bin_calibrations('/home/jgowans/workspace/directionFinder_backend/config/frequency_domain_calibration_direct_in_phase.json') created = False while True: time = [] correlator.fetch_time_domain_snapshot(force=True) for antenna_idx in range(4): time.append(correlator.time_domain_signals[antenna_idx][0:2048]) correlator.fetch_all() correlator.apply_frequency_domain_calibrations() frequency = [(correlator.frequency_correlations[(0,0)].signal)] frequency[0][0] = 0 # focing DC bin to 0. naughty... this should be done with ADC cal f = correlator.frequency_correlations[(0,1)].strongest_frequency() #ph = correlator.correlations[(0,1)].phase_at_freq(f) #print("f: {f} ; ph: {ph}".format(f = f, ph = ph)) cross = [] cross_combinations = list(itertools.combinations(range(4), 2))
if __name__ == '__main__': # logging infrastructure logger = logging.getLogger('main') handler = logging.StreamHandler() colored_formatter = ColoredFormatter( "%(log_color)s%(asctime)s%(levelname)s:%(name)s:%(message)s") handler.setFormatter(colored_formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG) correlator = Correlator(logger=logger.getChild('correlator')) correlator.set_shift_schedule(0b00000000000) correlator.set_accumulation_len(40000) correlator.add_frequency_bin_calibrations('baseline.json') time.sleep(1) correlator.re_sync() siggen = SCPI(host='localhost') offsets = {} offsets['axis'] = [] for a, b in correlator.cross_combinations: offsets["{a}{b}".format(a=a, b=b)] = [] for f in correlator.frequency_correlations[(0, 1)].frequency_bins: siggen.setFrequency(f) time.sleep(1) correlator.fetch_crosses() correlator.apply_frequency_domain_calibrations()
"%(log_color)s%(asctime)s%(levelname)s:%(name)s:%(message)s") handler.setFormatter(colored_formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG) correlator = Correlator(logger=logger.getChild('correlator')) correlator.set_shift_schedule(0b00000000000) correlator.set_accumulation_len(40000) correlator.re_sync() correlator.fetch_autos() correlator.fetch_time_domain_snapshot(force=True) correlator.add_cable_length_calibrations( '/home/jgowans/workspace/directionFinder_backend/config/cable_length_calibration.json' ) #correlator.apply_frequency_bin_calibrations('/home/jgowans/workspace/directionFinder_backend/config/frequency_domain_calibration_through_chain.json') correlator.add_frequency_bin_calibrations( '/home/jgowans/workspace/directionFinder_backend/config/frequency_domain_calibration_direct_in_phase.json' ) created = False while True: time = [] correlator.fetch_time_domain_snapshot(force=True) for antenna_idx in range(4): time.append(correlator.time_domain_signals[antenna_idx][0:2048]) correlator.fetch_all() correlator.apply_frequency_domain_calibrations() frequency = [(correlator.frequency_correlations[(0, 0)].signal)] frequency[0][ 0] = 0 # focing DC bin to 0. naughty... this should be done with ADC cal f = correlator.frequency_correlations[(0, 1)].strongest_frequency() #ph = correlator.correlations[(0,1)].phase_at_freq(f) #print("f: {f} ; ph: {ph}".format(f = f, ph = ph))