diff --git a/Camera/AbstractCamera.py b/Camera/AbstractCamera.py index a833d74..898453d 100644 --- a/Camera/AbstractCamera.py +++ b/Camera/AbstractCamera.py @@ -335,7 +335,7 @@ def _setup_calibration(self, 'exp_time': exp_time.to(u.second).value, 'gain': gain, 'offset': offset, - 'temperature_degC': temperature.to(u.Celsius).value if temperature else "no_target", + 'temperature_degC': temperature if temperature else "no_target", 'observation_ids': [o.id for o in observations] } metadata.update(headers) diff --git a/Service/SceneVizualization.py b/Service/SceneVizualization.py index d3c7577..f1afd10 100644 --- a/Service/SceneVizualization.py +++ b/Service/SceneVizualization.py @@ -127,7 +127,8 @@ def run(self): def start(self): self.do_run = True - super().start() + if not self.is_alive(): + super().start() def stop(self): self.do_run = False diff --git a/apps/launch_backyard_conf.sh b/apps/launch_backyard_conf.sh index 6125075..a75d23c 100755 --- a/apps/launch_backyard_conf.sh +++ b/apps/launch_backyard_conf.sh @@ -17,3 +17,5 @@ indiserver indi_lx200gemini indi_canon_ccd indi_asi_ccd # export REMOTE_OBSERVATORY_CONFIG=config_backyard # Other wise in simulation, you might want to set this variable # export REMOTE_OBSERVATORY_IS_DARK=0 +# export REMOTE_OBSERVATORY_CONFIG=config_backyard; export REMOTE_OBSERVATORY_IS_DARK=1; PYTHONPATH=. python ./apps/launch_remote_observatory.py --simulation_mode + diff --git a/calibration/ImagingCalibration.py b/calibration/ImagingCalibration.py index 6f5f9a0..c13874e 100644 --- a/calibration/ImagingCalibration.py +++ b/calibration/ImagingCalibration.py @@ -47,13 +47,13 @@ def __init__(self, f"{self.controller}") def calibrate(self, observed_list): - #TODO TN: event are already waited for, you need to fix that - event = self.take_flat(observed_list) - event.wait() - event = self.take_dark(observed_list) - return event + event_flat = self.take_flat(observed_list) + event_dark = self.take_dark(observed_list, event=event_flat) + return event_dark - def take_flat(self, observed_list): + def take_flat(self, observed_list, event=None): + if event: + event.wait() flat_config = set() for seq_time, observation in observed_list.items(): conf = observation.configuration.get("filter", "no-filter") @@ -75,12 +75,14 @@ def take_flat(self, observed_list): self.controller.switch_off_flat_light() return event - def take_dark(self, observed_list): + def take_dark(self, observed_list, event=None): """ Temperature is the "most expensive" parameter to change, hence we will use this as our primary key :param observed_list: :return: """ + if event: + event.wait() dark_config_dict = dict() for seq_time, observation in observed_list.items(): temp_deg = observation.configuration['temperature'] diff --git a/calibration/SpectralCalibration.py b/calibration/SpectralCalibration.py index 4dbb4d7..e837922 100644 --- a/calibration/SpectralCalibration.py +++ b/calibration/SpectralCalibration.py @@ -59,11 +59,14 @@ def __init__(self, def calibrate(self, observed_list): - self.take_flat(observed_list) - self.take_spectral_calib(observed_list) - self.take_dark(observed_list) + event_flat = self.take_flat(observed_list) + event_spectral = self.take_spectral_calib(observed_list, event=event_flat) + event_dark = self.take_dark(observed_list, event=event_spectral) + return event_dark - def take_flat(self, observed_list): + def take_flat(self, observed_list, event=None): + if event: + event.wait() self.controller.switch_on_flat_light() for i in range(self.flat_nb): event = self.camera.take_calibration( @@ -77,7 +80,9 @@ def take_flat(self, observed_list): event.wait() self.controller.switch_off_flat_light() - def take_spectral_calib(self, observed_list): + def take_spectral_calib(self, observed_list, event=None): + if event: + event.wait() self.controller.switch_on_spectro_light() for i in range(self.spectral_calib_nb): event = self.camera.take_calibration( @@ -91,12 +96,14 @@ def take_spectral_calib(self, observed_list): event.wait() self.controller.switch_off_spectro_light() - def take_dark(self, observed_list): + def take_dark(self, observed_list, event=None): """ Temperature is the "most expensive" parameter to change, hence we will use this as our primary key :param observed_list: :return: """ + if event: + event.wait() dark_config_dict = dict() for seq_time, observation in observed_list.items(): temp_deg = observation.configuration['temperature'] diff --git a/conf_files/config.yaml b/conf_files/config.yaml index 66a16ad..c85548d 100644 --- a/conf_files/config.yaml +++ b/conf_files/config.yaml @@ -234,7 +234,7 @@ offset_pointer: timeout_seconds: 300 max_identification_error_seconds: 1 sync_mount_upon_solve: False - use_guider_adjust: True + use_guider_adjust: False on_star_identification_failure: trust_astrometry # get_brightest or trust_astrometry max_iterations: 5 max_pointing_error_seconds: 2 diff --git a/conf_files/config_backyard.yaml b/conf_files/config_backyard.yaml index b8ba356..ce9caf4 100644 --- a/conf_files/config_backyard.yaml +++ b/conf_files/config_backyard.yaml @@ -146,6 +146,9 @@ mount: equatorial_eod: J2000 # JNOW tcp_host: 192.168.8.63 tcp_port: 11110 + indi_client: + indi_host: localhost + indi_port: 7625 cameras: - module: IndiASICamera290MMMini @@ -156,7 +159,7 @@ cameras: APERTURE: 200 sampling_arcsec: 0.88 do_guiding: true - do_pointing: true + do_pointing: false pointing_seconds: 30 do_adjust_pointing: true adjust_center_x: 877 @@ -280,12 +283,14 @@ pointer: max_iterations: 10 max_pointing_error_seconds: 10 offset_pointer: - module: StarOffsetPointer #StarOffsetPointer #NoOffsetPointer #InvisibleOffsetPointer + module: StarOffsetPointer #StarOffsetPointer #NoOffsetPointer #InvisibleObjectOffsetPointer timeout_seconds: 300 - max_identification_error_seconds: 1 + max_identification_error_seconds: 2 sync_mount_upon_solve: True use_guider_adjust: True on_star_identification_failure: trust_astrometry # get_brightest or trust_astrometry + max_iterations: 10 + max_pointing_error_seconds: 2.5 guider: module : GuiderPHD2 host : 127.0.0.1 diff --git a/conf_files/spectral_targets.yaml b/conf_files/spectral_targets.yaml index 2e71858..82fb99a 100644 --- a/conf_files/spectral_targets.yaml +++ b/conf_files/spectral_targets.yaml @@ -17,20 +17,20 @@ targets : gain: 150 offset: 30 exp_time_sec: 20 -# "10 Lacertae": -# priority: 0 -# count: 1 -# temperature: 15 -# gain: 150 -# offset: 30 -# exp_time_sec: 20 -# "Gamma Cassiopeiae" : -# priority : 0 -# count : 2 -# temperature : 10 -# gain: 150 -# offset: 30 -# exp_time_sec : 5 + "10 Lacertae": + priority: 0 + count: 1 + temperature: 15 + gain: 150 + offset: 30 + exp_time_sec: 20 + "Gamma Cassiopeiae" : + priority : 0 + count : 2 + temperature : 10 + gain: 150 + offset: 30 + exp_time_sec : 5 # "T CrB" : # priority : 0 # count : 1 diff --git a/helper/IndiWebManagerClient.py b/helper/IndiWebManagerClient.py index bbeb327..2937207 100644 --- a/helper/IndiWebManagerClient.py +++ b/helper/IndiWebManagerClient.py @@ -166,7 +166,7 @@ def restart_driver(self, driver_name, master=False): host, port = self.master_host, self.master_port else: host, port = self.host, self.port - if self.is_driver_started(driver_name, host=host, port=port): + if self.is_driver_started(driver_name, master=master): try: base_url = f"http://{host}:{port}" req = f"{base_url}/api/drivers/restart/{urllib.parse.quote(driver_name)}" @@ -179,7 +179,7 @@ def restart_driver(self, driver_name, master=False): self.logger.error(msg) raise RuntimeError(msg) else: - self.start_driver(driver_name, check_started=False, host=host, port=port) + self.start_driver(driver_name, check_started=False, master=master) def start_driver(self, driver_name, check_started=True, master=False): """ @@ -194,7 +194,7 @@ def start_driver(self, driver_name, check_started=True, master=False): if driver_name is None: self.logger.debug(f"In start_driver, no driver name provided, assuming webmanager has auto-start enabled") return - if check_started and self.is_driver_started(driver_name, host=host, port=port): + if check_started and self.is_driver_started(driver_name, master=master): return try: base_url = f"http://{host}:{port}" @@ -219,7 +219,7 @@ def stop_driver(self, driver_name, master=False): else: host, port = self.host, self.port # No need to stop a driver that is not started - if not self.is_driver_started(driver_name, host=host, port=port): + if not self.is_driver_started(driver_name, master=master): self.logger.debug(f"No need to stop driver {driver_name} because it doesn't seems to be started") return try: