diff --git a/src/scope/run_simulation.py b/src/scope/run_simulation.py index 2fcabdc..1278613 100644 --- a/src/scope/run_simulation.py +++ b/src/scope/run_simulation.py @@ -15,8 +15,6 @@ from scope.ccf import * from scope.input_output import * from scope.logger import * - - from scope.noise import * from scope.tellurics import * from scope.utils import * @@ -101,7 +99,6 @@ def make_data( logger.debug(f"RV planet: {rv_planet}, RV star: {rv_star}") - flux_cube = np.zeros( (n_order, n_exposure, n_pixel) ) # will store planet and star signal @@ -527,7 +524,8 @@ def simulate_observation( star_wave, star_flux, wl_model, instrument_kernel, smooth=False ) - lls, ccfs = np.zeros((n_kp, n_vsys)), np.zeros((n_kp, n_vsys)) + # fill with NaNs because we're checkpointing. 0 would be a valid value, NaNs indicate that we haven't calculated it yet. + lls, ccfs = np.zeros((n_kp, n_vsys)) * np.nan, np.zeros((n_kp, n_vsys)) * np.nan # redoing the grid. how close does PCA get to a tellurics-free signal detection? A_noplanet, flux_cube, flux_cube_nopca, just_tellurics = make_data( @@ -598,7 +596,8 @@ def simulate_observation( ) lls[l, k], ccfs[l, k] = res - save_results(outdir, run_name, lls, ccfs) + # "checkpoint" by saving the results after each iteration! + save_results(outdir, run_name, lls, ccfs) if __name__ == "__main__": @@ -621,7 +620,6 @@ def simulate_observation( logger = setup_logging(log_level=inputs["log_level"]) logger.debug(f"Parsed inputs: {inputs}") - # Call the simulation function with the merged parameters try: simulate_observation(**inputs)