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
5 changes: 5 additions & 0 deletions src/fibad/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import toml

DEFAULT_CONFIG_FILEPATH = Path(__file__).parent.resolve() / "fibad_default_config.toml"
DEFAULT_USER_CONFIG_FILEPATH = Path.cwd() / "fibad_config.toml"


def get_runtime_config(
Expand Down Expand Up @@ -38,6 +39,10 @@ def get_runtime_config(
with open(default_config_filepath, "r") as f:
default_runtime_config = toml.load(f)

# If a named config exists in cwd, and no config specified on cmdline, use cwd.
if runtime_config_filepath is None and DEFAULT_USER_CONFIG_FILEPATH.exists():
runtime_config_filepath = DEFAULT_USER_CONFIG_FILEPATH
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that this is meant to be a convenience so that you don't have to pass in a user config, yeah? If that's the case, I can understand where you're coming from.

However, it also feels like it might open a door for unintended settings. i.e. A user has a fibad_config.toml and a fibad_config2.toml, and fails to pass the config when they want to use the "2" version.

Maybe I'm misinterpreting the utility here though. Let me know if I'm missing a broader point.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not a broader point to this part beyond the convenience of not passing --runtime-config or config= every time.


if runtime_config_filepath is not None:
if not runtime_config_filepath.exists():
raise FileNotFoundError(f"Runtime configuration file not found: {runtime_config_filepath}")
Expand Down
6 changes: 2 additions & 4 deletions src/fibad/fibad_default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ sh = "22asec"
filter = ["HSC-G", "HSC-R", "HSC-I", "HSC-Z", "HSC-Y"]
type = "coadd"
rerun = "pdr3_wide"
username = "mtauraso@local"
password = "cCw+nX53lmNLHMy+JbizpH/dl4t7sxljiNm6a7k1"
max_connections = 2
fits_file = "../hscplay/temp.fits"
cutout_dir = "../hscplay/cutouts/"
fits_file = "./catalog.fits"
cutout_dir = "./data"
offset = 0
num_sources = 500

Expand Down