diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index db0af92..d14e8d9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,6 +8,12 @@ on: branches: ["main"] pull_request: branches: ["main"] + workflow_dispatch: + inputs: + bypass_cache: + description: 'Bypass cache (true/false)' + required: false + default: 'false' jobs: build: @@ -22,6 +28,7 @@ jobs: - uses: actions/checkout@v3 - name: Cache test data + id: cache-test-data uses: actions/cache@v3 with: path: src/scope/data @@ -29,7 +36,7 @@ jobs: restore-keys: | ${{ runner.os }}-test-data- - name: Download test data if not cached - if: steps.cache-test-data.outputs.cache-hit != 'true' + if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.bypass_cache == 'true') || steps.cache-test-data.outputs.cache-hit != 'true' }} run: | echo "Downloading test data..." cd src/scope diff --git a/src/scope/input.txt b/src/scope/input.txt index c29fb9e..b2c2229 100644 --- a/src/scope/input.txt +++ b/src/scope/input.txt @@ -42,7 +42,7 @@ LD True # whether to include limb darkening in u1 0.1 # first quadratic limb darkening coefficient. not used if limb_darkening is set to False or if observation is set to emission. u2 0.1 # second quadratic limb darkening coefficient. not used if limb_darkening is set to False or if observation is set to emission. include_rm False # *experimental*. Whether to include Rossiter-McLaughlin effect in the simulation or not. only matters if observation is set to transmission. -v_rot_star 3 # equatorial rotational velocity of the star in km/s. only matters if include_rm is set to True. and observation is set to transmission. +v_rot_star 3 # equatorial rotational velocity of the star in km/s. only matters if include_rm is set to True. and observation is set to transmission. [DB] lambda_misalign 0 # misalignment angle of the planet's orbit with respect to the star's rotation axis, in degrees. only matters if include_rm is set to True. and observation is set to transmission. [DB] 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. diff --git a/src/scope/input_output.py b/src/scope/input_output.py index 44ed3e7..5fd4d27 100644 --- a/src/scope/input_output.py +++ b/src/scope/input_output.py @@ -25,7 +25,7 @@ def __init__(self, message="scope input file error:"): # Mapping between input file parameters and database columns parameter_mapping = { "Rp": "pl_radj", - "Mp": "pl_massj", + "Mp": "pl_bmassj", "Rstar": "st_rad", "Mstar": "st_mass", "v_sys": "system_velocity", @@ -33,10 +33,10 @@ def __init__(self, message="scope input file error:"): "P_rot": "pl_orbper", "v_sys": "st_radv", "planet_name": "pl_name", - "Rp_solar": "planet_radius_solar", "lambda_misalign": "pl_projobliq", "e": "pl_orbeccen", "peri": "pl_orblper", + "v_rot_star": "st_vsin", } diff --git a/src/scope/tests/test_io.py b/src/scope/tests/test_io.py index b449336..81c68e6 100644 --- a/src/scope/tests/test_io.py +++ b/src/scope/tests/test_io.py @@ -1,5 +1,6 @@ import os import tempfile +import pandas as pd import numpy as np import pytest @@ -8,8 +9,11 @@ parse_input_file, write_input_file, ScopeConfigError, + parameter_mapping, ) +test_data_path = os.path.join(os.path.dirname(__file__), "../data") + @pytest.fixture def sample_files(): @@ -195,3 +199,14 @@ def test_calc_n_max_when_input_0(sample_files_second): data = parse_input_file(input_file_path, db_file_path) assert data["n_exposures"] > 0 and type(data["n_exposures"]) == int + + +def test_database_columns(): + # read in the exoplanet archive data + input_file_path = os.path.join( + test_data_path, "default_params_exoplanet_archive.csv" + ) + db = pd.read_csv(input_file_path) + + for value in parameter_mapping.values(): + assert value in db.columns