Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,14 +28,15 @@ jobs:
- uses: actions/checkout@v3

- name: Cache test data
id: cache-test-data
uses: actions/cache@v3
with:
path: src/scope/data
key: ${{ runner.os }}-test-data-${{ hashFiles('**/test-data-hash') }}
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
Expand Down
2 changes: 1 addition & 1 deletion src/scope/input.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/scope/input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ 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",
"a": "pl_orbsmax",
"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",
}


Expand Down
15 changes: 15 additions & 0 deletions src/scope/tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import tempfile
import pandas as pd

import numpy as np
import pytest
Expand All @@ -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():
Expand Down Expand Up @@ -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
Loading