diff --git a/README.md b/README.md index f4300fe..5317e28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Backscattering Experiment Data +# Backscattering Experimental Data Python interface of experimental data for measurements of backscattered light in the Virgo interferometer. It can be executed on Cascina server to load online @@ -13,7 +13,238 @@ version and virtual environment. > [!NOTE] > You can still use pip to manage dependencies using [pyproject.toml](pyproject.toml) -This is a library, which cannot be used as is. +## Example + +```py +from backscattering_experimental_data.factory.initializer import ( + InitializerComponent, + InitializerScatterer, +) +from backscattering_experimental_data.factory.measurement import MeasurementFactory +from backscattering_experimental_data.root import Root +from backscattering_experimental_data.metadata import MetadataRoot, InjectionFactory +from gwpy.time import Time +from astropy.units import s, V, m, min, Hz, dimensionless_unscaled +from h5py import File + +SR = InitializerComponent( + name = "SR", + calibration_factor = 1.15*m/V, +) +NE = InitializerComponent( + name = "NE", + calibration_factor = 0.97*m/V, +) + +REF_LOW_NOISE_2 = MeasurementFactory.fetch( + "Low Noise 2 - reference", + "Reference data taken before the injection, in Low Noise 2", + Time("2025-06-17T18:11:00.000000000", format="isot", scale="utc"), + 4 * min, + [ + InitializerScatterer( + name = "SDB1", + calibration_factor = 1.15 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SDB2", + calibration_factor = 1.3 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SWEB", + calibration_factor = 0.97 * m / V, + associated_component = NE, + injection = None, + ), + ], + True, +) +SDB1_LOW_NOISE_2 = MeasurementFactory.fetch( + "Low Noise 2 - SDB1", + "Injection of sine line in SDB1's suspension stage F0 in Low Noise 2 (SR is aligned)", + Time("2025-06-17T18:23:00.000000000", format="isot", scale="utc"), + 4 * min, + [ + InitializerScatterer( + name="SDB1", + calibration_factor=1.15*m/V, + associated_component=SR, + injection=InjectionFactory.make( + type_="sin", + amplitude=0.7 * dimensionless_unscaled, + frequency=0.1 * Hz, + ), + ), + InitializerScatterer( + name="SDB2", + calibration_factor=1.3*m/V, + associated_component=SR, + injection=None, + ), + ], + True, +) +SWEB_LOW_NOISE_2 = MeasurementFactory.fetch( + "Low Noise 2 - SWEB", + "Injection of sine line on SWEB's SBE top stage in Low Noise 2 (SR is aligned)", + Time("2025-06-17T18:53:00.000000000", format="isot", scale="utc"), + 15 * min, + [ + InitializerScatterer( + name = "SWEB", + calibration_factor=0.97*m/V, + associated_component=NE, + injection=InjectionFactory.make( + type_ = "sin", + amplitude = 150 * dimensionless_unscaled, + frequency = 0.2 * Hz, + ) + ), + ], + True, +) +REF_LOW_NOISE_3_1 = MeasurementFactory.fetch( + "Low Noise 3 - reference 1", + "Reference data taken after going in Low Noise 3", + Time("2025-06-17T19:21:00.000000000", format="isot", scale="utc"), + 5 * min, + [ + InitializerScatterer( + name = "SDB1", + calibration_factor = 1.15 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SDB2", + calibration_factor = 1.3 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SWEB", + calibration_factor = 0.97 * m / V, + associated_component = NE, + injection = None, + ), + ], + True, +) +SDB1_LOW_NOISE_3 = MeasurementFactory.fetch( + "Low Noise 3 - SDB1", + "Injection of sine line in SDB1's suspension stage F0 in Low Noise 3, so with SR misaligned", + Time("2025-06-17T19:33:00.000000000", format="isot", scale="utc"), + 4 * min, + [ + InitializerScatterer( + name = "SDB1", + calibration_factor = 1.15 * m / V, + associated_component = SR, + injection = InjectionFactory.make( + type_ = "sin", + amplitude = 0.7 * dimensionless_unscaled, + frequency = 0.1 * Hz, + ), + ), + InitializerScatterer( + name="SDB2", + calibration_factor=1.3*m/V, + associated_component=SR, + injection=None, + ), + ], + True, +) +SWEB_LOW_NOISE_3 = MeasurementFactory.fetch( + "Low Noise 3 - SWEB", + "Injection of sine line on SWEB's top stage suspension in Low Noise 3 (SR misaligned)", + Time("2025-06-17T19:51:29.000000000", format="isot", scale="utc"), + 5 * min + 31 * s, + [ + InitializerScatterer( + name = "SWEB", + calibration_factor = 0.97 * m/V, + associated_component = NE, + injection = InjectionFactory.make( + type_ = "sin", + amplitude = 100 * dimensionless_unscaled, + frequency = 0.2 * Hz, + ), + ), + ], + True, +) +REF_LOW_NOISE_3_2 = MeasurementFactory.fetch( + "Low Noise 3 - reference 2", + "Reference data taken after the SDB1 measurement in Low Noise 3", + Time("2025-06-17T19:45:00.000000000", format="isot", scale="utc"), + 4 * min, + [ + InitializerScatterer( + name = "SDB1", + calibration_factor = 1.15 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SDB2", + calibration_factor = 1.3 * m / V, + associated_component = SR, + injection = None, + ), + InitializerScatterer( + name = "SWEB", + calibration_factor = 0.97 * m / V, + associated_component = NE, + injection = None, + ), + ], + True, +) +SDB2_LOW_NOISE_3 = MeasurementFactory.fetch( + "Low Noise 3 - SDB2", + "Injection of sine line on SDB2's top stage suspension to check if everything is working (still in Low Noise 3, so with SR misaligned)", + Time("2025-06-17T20:07:38.000000000", format="isot", scale="utc"), + 7 * min + 12 * s, + [ + InitializerScatterer( + name = "SDB2", + calibration_factor = 1.3 * m/V, + associated_component = SR, + injection = InjectionFactory.make( + type_ = "sin", + amplitude = 75 * dimensionless_unscaled, + frequency = 0.1 * Hz, + ), + ) + ], + True, +) + +root = Root( + metadata=MetadataRoot( + name="Low Noise 2 & Low Noise 3 injections", + description="These measurements were done in 2025-06-17 to check the difference of SDB1 fsc for SR misaligned and SR aligned. In Low Noise 2, SR is aligned, and in Low Noise 3, SR is misaligned. All the measurements are described in this logbook entry: https://logbook.virgo-gw.eu/virgo/?r=67027.", + ), + measurements=[ + REF_LOW_NOISE_2, + SDB1_LOW_NOISE_2, + SWEB_LOW_NOISE_2, + REF_LOW_NOISE_3_1, + SDB1_LOW_NOISE_3, + REF_LOW_NOISE_3_2, + SWEB_LOW_NOISE_3, + SDB2_LOW_NOISE_3, + ], +) + +with File("mesure-juin-2025.hdf5", "w") as store: + root = root.to_hdf5(store) +``` ## License diff --git a/src/backscattering_experimental_data/factory/measurement.py b/src/backscattering_experimental_data/factory/measurement.py index 9f52853..972a730 100644 --- a/src/backscattering_experimental_data/factory/measurement.py +++ b/src/backscattering_experimental_data/factory/measurement.py @@ -126,7 +126,7 @@ class MeasurementFactory: raise Exception(message) state = LockingState(state_data[0]) injection_power = data["V1:INJ_IMC_TRA_DC_mean"].mean() - dark_fringe_power = data["V1:DET_B1p_DC_mean"].mean() + dark_fringe_power = data["V1:LSC_B1_DC_mean"].mean() metadata = MetadataMeasurement( name=name,