diff --git a/src/sorcha/ephemeris/simulation_driver.py b/src/sorcha/ephemeris/simulation_driver.py index a008798c..39f1ab8c 100644 --- a/src/sorcha/ephemeris/simulation_driver.py +++ b/src/sorcha/ephemeris/simulation_driver.py @@ -122,7 +122,7 @@ def create_ephemeris(orbits_df, pointings_df, args, sconfigs): verboselog("Generating ASSIST+REBOUND simulations.") sim_dict = generate_simulations(ephem, gm_sun, gm_total, orbits_df, args) pixel_dict = defaultdict(list) - observatories = Observatory(args, sconfigs) + observatories = Observatory(args, sconfigs.auxiliary) output = StringIO() in_memory_csv = writer(output) diff --git a/src/sorcha/ephemeris/simulation_parsing.py b/src/sorcha/ephemeris/simulation_parsing.py index 930f0803..d09890f8 100644 --- a/src/sorcha/ephemeris/simulation_parsing.py +++ b/src/sorcha/ephemeris/simulation_parsing.py @@ -129,7 +129,7 @@ class Observatory: Class containing various utility tools related to the calculation of the observatory position """ - def __init__(self, args, sconfigs, oc_file=None): + def __init__(self, args, auxconfigs, oc_file=None): """ Initialization method @@ -137,7 +137,7 @@ def __init__(self, args, sconfigs, oc_file=None): ---------- args : dictionary or `sorchaArguments` object dictionary of command-line arguments. - sconfigs: dataclass + auxconfigs: dataclass Dataclass of configuration file arguments. oc_file : str Path for the file with observatory codes @@ -145,17 +145,17 @@ def __init__(self, args, sconfigs, oc_file=None): self.observatoryPositionCache = {} # previously calculated positions to speed up the process if oc_file == None: - retriever = make_retriever(sconfigs.auxiliary, args.ar_data_file_path) + retriever = make_retriever(auxconfigs, args.ar_data_file_path) # is the file available locally, if so, return the full path - if os.path.isfile(os.path.join(retriever.abspath, sconfigs.auxiliary.observatory_codes)): - obs_file_path = retriever.fetch(sconfigs.auxiliary.observatory_codes) + if os.path.isfile(os.path.join(retriever.abspath, auxconfigs.observatory_codes)): + obs_file_path = retriever.fetch(auxconfigs.observatory_codes) # if the file is not local, download, and decompress it, then return the path. else: obs_file_path = retriever.fetch( - sconfigs.auxiliary.observatory_codes_compressed, - processor=Decompress(name=sconfigs.auxiliary.observatory_codes), + auxconfigs.observatory_codes_compressed, + processor=Decompress(name=auxconfigs.observatory_codes), ) else: diff --git a/src/sorcha/ephemeris/simulation_setup.py b/src/sorcha/ephemeris/simulation_setup.py index d5522616..e825c869 100644 --- a/src/sorcha/ephemeris/simulation_setup.py +++ b/src/sorcha/ephemeris/simulation_setup.py @@ -186,7 +186,7 @@ def precompute_pointing_information(pointings_df, args, sconfigs): furnish_spiceypy(args, sconfigs) obsCode = sconfigs.simulation.ar_obs_code - observatories = Observatory(args, sconfigs) + observatories = Observatory(args, sconfigs.auxiliary) # vectorize the calculation to get x,y,z vector from ra/dec vectors = ra_dec2vec( diff --git a/tests/ephemeris/test_pixdict.py b/tests/ephemeris/test_pixdict.py index 59765441..4c404efb 100644 --- a/tests/ephemeris/test_pixdict.py +++ b/tests/ephemeris/test_pixdict.py @@ -84,7 +84,7 @@ def test_pixeldict(tmp_path): furnish_spiceypy(args,configs) sim_dict = generate_simulations(ephem, gm_sun, gm_total, orbits_df, args) - observatory = Observatory(sconfigs=configs,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) + observatory = Observatory(auxconfigs=configs.auxiliary,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) pixdict = PixelDict(54800.0 + 2400000.5, sim_dict, ephem, "Z20", observatory, picket_interval=1, nside=32) diff --git a/tests/ephemeris/test_simulation_parsing.py b/tests/ephemeris/test_simulation_parsing.py index 4d6988f6..a136e784 100644 --- a/tests/ephemeris/test_simulation_parsing.py +++ b/tests/ephemeris/test_simulation_parsing.py @@ -5,9 +5,8 @@ from sorcha.utilities.sorchaConfigs import sorchaConfigs, auxiliaryConfigs def test_observatory_compared_to_original(): - sconfigs = sorchaConfigs() - sconfigs.auxiliary = auxiliaryConfigs() - observatory = sp.Observatory(sconfigs=sconfigs,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) + auxconfigs = auxiliaryConfigs() + observatory = sp.Observatory(auxconfigs=auxconfigs,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) obs = observatory.ObservatoryXYZ # Reference tuples were taken from Matt Holman's original notebook @@ -19,9 +18,8 @@ def test_observatory_compared_to_original(): def test_observatory_for_moving_observatories(): - sconfigs = sorchaConfigs() - sconfigs.auxiliary = auxiliaryConfigs() - observatory = sp.Observatory(sconfigs=sconfigs,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) + auxconfigs = auxiliaryConfigs() + observatory = sp.Observatory(auxconfigs=auxconfigs,args=None, oc_file=get_test_filepath("ObsCodes_test.json")) obs = observatory.ObservatoryXYZ assert obs["250"] == (None, None, None)