diff --git a/lisainstrument/hexagon.py b/lisainstrument/hexagon.py index addf3bd3bfc29ff99aa2a7acdfdb96f910a250d0..cd2edda0be190daf557ca0e0c688c833e8ceabae 100644 --- a/lisainstrument/hexagon.py +++ b/lisainstrument/hexagon.py @@ -14,12 +14,15 @@ Authors: Jean-Baptiste Bayle <j2b.bayle@gmail.com> """ +import logging import numpy as np from h5py import File from . import noises +logger = logging.getLogger(__name__) + class Hexagon(): """Represent the Hexagon instrument. @@ -52,12 +55,15 @@ class Hexagon(): self.duration = self.size * self.dt self.time = np.arange(self.size) * self.dt + logger.info("Initialize hexagon experiment (size=%d, dt=%f, duration=%f", + self.size, self.dt, self.duration) self.primary_laser_asd = float(primary_laser_asd) self.locked_laser_asd = float(locked_laser_asd) self.central_freq = float(central_freq) if offset_freqs == 'default': + logger.debug("Use default set of offset frequencies") self.offset_freqs = {'1': 0.0, '2': 15E6, '3': 7E6} else: self.offset_freqs = offset_freqs @@ -76,9 +82,13 @@ class Hexagon(): def simulate(self): """Run a simulation, and generate all intermediary signals.""" + logger.info("Starting simulation") + if self.simulated: + logger.warning("Overwriting previous simulated values") + # Laser noise + logger.debug("Generating laser noise") self.laser_noises = np.empty((self.size, 3)) # (size, laser) [Hz] - # Laser 1 has its own stability self.laser_noises[:, 0] = noises.laser(self.fs, self.size, self.primary_laser_asd) # Laser 2 replicated laser 1 with added locking noise @@ -89,6 +99,7 @@ class Hexagon(): + noises.white(self.fs, self.size, self.locked_laser_asd) # Carrier beams + logger.debug("Simulating carrier beams") self.carrier_fluctuations = self.laser_noises # (size, laser) [Hz] self.carrier_offsets = np.array( [[self.offset_freqs[index] for index in self.INDICES]] @@ -96,6 +107,7 @@ class Hexagon(): # Compute beatnotes # Convention is from paper: beatnote ij is beam j - beam i + logger.debug("Computing carrier beatnotes") self.carrier_beatnote_offsets = np.stack([ self.carrier_offsets[:, int(ij[1]) - 1] - self.carrier_offsets[:, int(ij[0]) - 1] for ij in self.BEATNOTES @@ -107,9 +119,11 @@ class Hexagon(): self.carrier_beatnotes = self.carrier_beatnote_offsets + self.carrier_beatnote_fluctuations # Three-signal combination + logger.debug("Forming three-signal combination") self.three_signal_combination = self.carrier_beatnotes[:,0] \ + self.carrier_beatnotes[:,1] + self.carrier_beatnotes[:,2] + logger.info("Simulation complete") self.simulated = True def write(self, output='measurements.h5', mode='w'):