def __init__(self): # Initialize aquisition/behavior part of acoustics system self.adc = ADS7865() self.filt = LTC1564() self.plt = None self.auto_update = None # Initialize Data buffer self.data_buffer = (None, None, None, None) # Initialize pinger frequency via config file self.pinger_freq = config.getfloat('Acoustics', 'pinger_frequency') # Initialize abstract hydrophone object self.array = hydrophones.Array() # Define hydrophone locations self.array.move(ARRAY_DEFAULT_LOCATION) d = config.getfloat('Acoustics','array_spacing') array_conf = config.get('Acoustics', 'array_configuration') if array_conf == 'yaw': self.array.define( hydrophones.generate_yaw_array_definition(d) ) elif array_conf == 'dual': self.array.define( hydrophones.generate_yaw_pitch_dual_array_definition(d,d) ) else: raise IOError("Unrecognized hydrophone array configuration (%s)." % array_conf) # Various parameter used later in this class self.valid_signal_flg = '' self.fig = None # Init logging class self.logger = Logging()
def _refresh_array_spacing(self): """Following refresh of config file, the array model must be updated. """ # set update tolerance tol = 0.001e-3 # update if necessary d = config.getfloat('Acoustics', 'array_spacing') # Assumes Config has been refreshed if not (-tol < d-self.array.d[0] < tol): # User has supplied a new value of hydrophone distance print("acoustics.py: update array with %.2fcm spacing" % (d *100.0)) self.array.define( hydrophones.generate_yaw_array_definition(d) )
def create_hydrophone_pair(spacing): array = hydrophones.Array() array.move(WORLD_ORIGIN) array.define( hydrophones.generate_yaw_array_definition( spacing ) ) return array