Skip to content

Commit

Permalink
Merge pull request #255 from cta-observatory/fix
Browse files Browse the repository at this point in the history
fix config
  • Loading branch information
jsitarek authored Sep 12, 2024
2 parents cea9fa6 + 283835f commit c4fc1e6
Showing 1 changed file with 12 additions and 12 deletions.
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

0 comments on commit c4fc1e6

Please sign in to comment.