From 24d08fc037f6d988e49c9ddeff39c4a42430e04f Mon Sep 17 00:00:00 2001 From: Arjun Savel Date: Wed, 5 Mar 2025 12:52:28 -0500 Subject: [PATCH] make those local changes! --- src/scope/calc_quantities.py | 2 +- src/scope/input.txt | 12 +++--- src/scope/input_output.py | 77 +++++++++++++++++++----------------- src/scope/run_simulation.py | 2 +- 4 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/scope/calc_quantities.py b/src/scope/calc_quantities.py index 6aeaa08..fbb36a9 100644 --- a/src/scope/calc_quantities.py +++ b/src/scope/calc_quantities.py @@ -176,7 +176,7 @@ def calc_crossing_time( n_exp: number of exposures you can take during transit. """ - + print(mstar, rstar, period, e, b, peri, mplanet) orbit = KeplerianOrbit( m_star=mstar, # solar masses! r_star=rstar, # solar radii! diff --git a/src/scope/input.txt b/src/scope/input.txt index b2c2229..5dbc4a0 100644 --- a/src/scope/input.txt +++ b/src/scope/input.txt @@ -16,7 +16,7 @@ Planet name: WASP-166 b modelname wasp_166_150seed_ld # name of the model. used for saving the output files. seed 150 # seed for the random number generator when generating noisy data. set to None for a random seed. -log_level INFO # logging level above which statements are printed. Supported levels are ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR``, and ``CRITICAL``. +log_level DEBUG # logging level above which statements are printed. Supported levels are ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR``, and ``CRITICAL``. # Filepaths planet_spectrum_path /home/asavel/scratch/retrieval_stuff/fm_wasp_77ab_noisy/fm_wasp_77ab_noisy/spectrum_tran_WASP-166b_0.3_c_to_o.pic @@ -28,7 +28,7 @@ snr_path /home/asavel/scratch/scope/src/scope/data/snr_IGRINS_LTT- Rp DATABASE # planetary radius in Jupiter radii. [DB] Mp DATABASE # planetary mass in Jupiter masses. [DB] e DATABASE # eccentricity of the planet's orbit. [DB] -omega DATABASE # argument of periastron of the planet's orbit, in degrees. [DB] +omega 0 # argument of periastron of the planet's orbit, in degrees. [DB] b DATABASE # impact parameter of the planet's orbit. [DB] Rstar DATABASE # stellar radius, in solar radii. [DB] Mstar DATABASE # stellar mass, in solar masses. [DB] @@ -47,7 +47,7 @@ lambda_misalign 0 # misalignment angle of the planet's or inc 90.0 # inclination of the planet's orbit with respect to the line of sight, in degrees. only matters if include_rm is set to True. and observation is set to transmission. # Instrument Parameters -spectrograph IGRINS # name of the spectrograph to simulate. currently spectrographs are ``IGRINS`` and ``CRIRES+``. +instrument IGRINS # name of the spectrograph to simulate. currently spectrographs are ``IGRINS`` and ``CRIRES+``. blaze True # whether to include a blaze function or not. wav_error False # whether to include wavelength solution errors or not. order_dep_throughput True # whether to include order-dependent throughput variations. @@ -56,9 +56,9 @@ vary_throughput True # whether to include throughput variations. # Observation Parameters observation transmission # type of observation to perform. supported observations are ``emission`` and ``transmission``. -phase_start 0.986222200994206 # phase of the beginning of the observations. 0 is center of transit, 0.5 is secondary eclipse. If DATABASE, just the transit duration. [DB] -phase_end 1.0137777990057941 # phase of the end of the observations. 0 is center of transit, 0.5 is secondary eclipse. If DATABASE, just the transit duration. [DB] -n_exposures 0 # number of exposures to simulate. sets the phases of the exposures. if set to 0, the minimum number of exposures that prevent pixel crossing for the provided instrument is used. +phase_start DATABASE # phase of the beginning of the observations. 0 is center of transit, 0.5 is secondary eclipse. If DATABASE, just the transit duration. [DB] +phase_end DATABASE # phase of the end of the observations. 0 is center of transit, 0.5 is secondary eclipse. If DATABASE, just the transit duration. [DB] +n_exposures 17 # number of exposures to simulate. sets the phases of the exposures. if set to 0, the minimum number of exposures that prevent pixel crossing for the provided instrument is used. star True # whether to include the star in the simulation. In general, you'd like to! telluric True # whether to include tellurics in the simulation. In general, you'd like to! SNR 250 # signal-to-noise ratio of the observations, per pixel. I.e., what sets the photon counts at the detector. diff --git a/src/scope/input_output.py b/src/scope/input_output.py index 5fd4d27..40de02c 100644 --- a/src/scope/input_output.py +++ b/src/scope/input_output.py @@ -37,6 +37,7 @@ def __init__(self, message="scope input file error:"): "e": "pl_orbeccen", "peri": "pl_orblper", "v_rot_star": "st_vsin", + "b": "pl_imppar" } @@ -115,8 +116,10 @@ def coerce_integers(data, key, value): def coerce_database(data, key, value, astrophysical_params, planet_name, database_path): + if value == "DATABASE" and key in astrophysical_params: data[key] = query_database(planet_name, key, database_path) + elif value == "DATABASE" and key in ["phase_start", "phase_end"]: tdur = query_database(planet_name, "pl_trandur", database_path) period = query_database(planet_name, "pl_orbper", database_path) @@ -201,6 +204,8 @@ def parse_input_file( "P_rot", "a", "u1", + "e", + "b", "u2", "Mstar", "Mp", @@ -313,110 +318,110 @@ def parse_arguments(): # Required parameters parser.add_argument( - "--planet_spectrum_path", type=str, default=".", help="Path to planet spectrum" + "--planet_spectrum_path", type=str, help="Path to planet spectrum" ) parser.add_argument( - "--star_spectrum_path", type=str, default=".", help="Path to star spectrum" + "--star_spectrum_path", type=str, help="Path to star spectrum" ) parser.add_argument( - "--data_cube_path", type=str, default=".", help="Path to data cube" + "--data_cube_path", type=str, help="Path to data cube" ) # Optional parameters with their defaults matching your function parser.add_argument( "--phase_start", type=float, - default=0, + help="Start phase of the simulated observations", ) parser.add_argument( "--phase_end", type=float, - default=1, + help="End phase of the simulated observations", ) parser.add_argument( - "--n_exposures", type=int, default=10, help="Number of exposures" + "--n_exposures", type=int, help="Number of exposures" ) parser.add_argument( - "--observation", type=str, default="emission", help="Observation type" + "--observation", type=str, help="Observation type" ) - parser.add_argument("--blaze", type=bool, default=True, help="Blaze flag") + parser.add_argument("--blaze", type=bool, help="Blaze flag") parser.add_argument( - "--n_princ_comp", type=int, default=4, help="Number of principal components" + "--n_princ_comp", type=int, help="Number of principal components" ) - parser.add_argument("--star", type=bool, default=True, help="Star flag") - parser.add_argument("--SNR", type=float, default=250, help="Signal to noise ratio") - parser.add_argument("--telluric", type=bool, default=True, help="Telluric flag") + parser.add_argument("--star", type=bool, help="Star flag") + parser.add_argument("--SNR", type=float, help="Signal to noise ratio") + parser.add_argument("--telluric", type=bool, help="Telluric flag") parser.add_argument( - "--tell_type", type=str, default="data-driven", help="Telluric type" + "--tell_type", type=str, help="Telluric type" ) parser.add_argument( - "--time_dep_tell", type=bool, default=False, help="Time dependent telluric" + "--time_dep_tell", type=bool, help="Time dependent telluric" ) parser.add_argument( - "--wav_error", type=bool, default=False, help="Wavelength error flag" + "--wav_error", type=bool, help="Wavelength error flag" ) parser.add_argument( - "--rv_semiamp_orbit", type=float, default=0.3229, help="RV semi-amplitude orbit" + "--rv_semiamp_orbit", type=float, help="RV semi-amplitude orbit" ) parser.add_argument( "--order_dep_throughput", type=bool, - default=True, + help="Order dependent throughput", ) parser.add_argument( - "--Rp", type=float, default=1.21, help="Planet radius (Jupiter radii)" + "--Rp", type=float, help="Planet radius (Jupiter radii)" ) parser.add_argument( - "--Rstar", type=float, default=0.955, help="Star radius (solar radii)" + "--Rstar", type=float, help="Star radius (solar radii)" ) parser.add_argument( - "--kp", type=float, default=192.02, help="Planetary orbital velocity (km/s)" + "--kp", type=float, help="Planetary orbital velocity (km/s)" ) - parser.add_argument("--v_rot", type=float, default=4.5, help="Rotation velocity") - parser.add_argument("--scale", type=float, default=1.0, help="Scale factor") - parser.add_argument("--v_sys", type=float, default=0.0, help="Systemic velocity") + parser.add_argument("--v_rot", type=float, help="Rotation velocity") + parser.add_argument("--scale", type=float, help="Scale factor") + parser.add_argument("--v_sys", type=float, help="Systemic velocity") parser.add_argument( - "--modelname", type=str, default="yourfirstsimulation", help="Model name" + "--modelname", type=str, help="Model name" ) parser.add_argument( "--divide_out_of_transit", type=bool, - default=False, + help="Divide out of transit", ) parser.add_argument( - "--out_of_transit_dur", type=float, default=0.1, help="Out of transit duration" + "--out_of_transit_dur", type=float, help="Out of transit duration" ) parser.add_argument( - "--include_rm", type=bool, default=False, help="Include RM effect" + "--include_rm", type=bool, help="Include RM effect" ) parser.add_argument( - "--v_rot_star", type=float, default=3.0, help="Star rotation velocity" + "--v_rot_star", type=float, help="Star rotation velocity" ) - parser.add_argument("--a", type=float, default=0.033, help="Semi-major axis") + parser.add_argument("--a", type=float, help="Semi-major axis") parser.add_argument( - "--lambda_misalign", type=float, default=0.0, help="Misalignment angle" + "--lambda_misalign", type=float, help="Misalignment angle" ) - parser.add_argument("--inc", type=float, default=90.0, help="Inclination") - parser.add_argument("--seed", type=int, default=42, help="Random seed") - parser.add_argument("--LD", type=bool, default=True, help="Limb darkening") + parser.add_argument("--inc", type=float, help="Inclination") + parser.add_argument("--seed", type=int, help="Random seed") + parser.add_argument("--LD", type=bool, help="Limb darkening") parser.add_argument( - "--vary_throughput", type=bool, default=True, help="Vary throughput" + "--vary_throughput", type=bool, help="Vary throughput" ) parser.add_argument( "--log_level", type=str, - default="INFO", + choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], help="Logging level (default: INFO)", ) # For file input option parser.add_argument( - "--input_file", type=str, default="input.txt", help="Input file with parameters" + "--input_file", type=str, default='input.txt',help="Input file with parameters" ) return parser.parse_args() diff --git a/src/scope/run_simulation.py b/src/scope/run_simulation.py index 1278613..231be6d 100644 --- a/src/scope/run_simulation.py +++ b/src/scope/run_simulation.py @@ -619,7 +619,7 @@ def simulate_observation( logger = setup_logging(log_level=inputs["log_level"]) logger.debug(f"Parsed inputs: {inputs}") - + print(inputs) # Call the simulation function with the merged parameters try: simulate_observation(**inputs)