Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix config #255

Merged
merged 4 commits into from
Sep 12, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
logger.setLevel(logging.INFO)


def config_file_gen(target_dir, source_name, config_file):
def config_file_gen(target_dir, source_name, config_dict):

"""
Here we create the configuration file needed for transforming DL0 into DL1
Expand All @@ -52,17 +52,10 @@ def config_file_gen(target_dir, source_name, config_file):
Directory to store the results
source_name : str
Name of the target source
config_file : str
Path to MCP configuration file (e.g., resources/config.yaml)
config_dict : dict
Dictionary of a configuration file (e.g., resources/config.yaml)
"""

if config_file == "":
config_file = resource_file("config.yaml")
with open(
config_file, "rb"
) as fc: # "rb" mode opens the file in binary format for reading
config_dict = yaml.safe_load(fc)

conf = {
"mc_tel_ids": config_dict["mc_tel_ids"],
"LST": config_dict["LST"],
Expand Down Expand Up @@ -213,14 +206,21 @@ def main():
) as f: # "rb" mode opens the file in binary format for reading
config = yaml.safe_load(f)

telescope_ids = list(config["mc_tel_ids"].values())
env_name = config["general"]["env_name"]
config_file = config["general"]["base_config_file"]
source_in = config["data_selection"]["source_name_database"]
source = config["data_selection"]["source_name_output"]
cluster = config["general"]["cluster"]
target_dir = Path(config["directories"]["workspace_dir"])

if config_file == "":
config_file = resource_file("config.yaml")
with open(
config_file, "rb"
) as fc: # "rb" mode opens the file in binary format for reading
config_dict = yaml.safe_load(fc)
telescope_ids = list(config_dict["mc_tel_ids"].values())

if source_in is None:
source_list = joblib.load("list_sources.dat")

Expand All @@ -244,7 +244,7 @@ def main():
directories_generator_real(
str(target_dir), telescope_ids, MAGIC_runs, source_name
) # Here we create all the necessary directories in the given workspace and collect the main directory of the target
config_file_gen(target_dir, source_name, config_file)
config_file_gen(target_dir, source_name, config_dict)

# Below we run the analysis on the MAGIC data

Expand Down