diff --git a/src/sorcha/modules/PPCommandLineParser.py b/src/sorcha/modules/PPCommandLineParser.py index 08685184..3e548c91 100644 --- a/src/sorcha/modules/PPCommandLineParser.py +++ b/src/sorcha/modules/PPCommandLineParser.py @@ -77,18 +77,6 @@ def PPCommandLineParser(args): if cmd_args_dict["output_ephemeris_file"]: warn_or_remove_file(cmd_args_dict["output_ephemeris_file"], args.f, pplogger) - if args.dw == "default": - oifpath_split = os.path.split(cmd_args_dict["oifoutput"]) - stem_name = oifpath_split[1].split(".")[0] + ".db" - cmd_args_dict["makeTemporaryEphemerisDatabase"] = os.path.join(oifpath_split[0], "temp_" + stem_name) - elif args.dw: - _ = PPFindDirectoryOrExit(os.path.dirname(args.dw), "-dw") - cmd_args_dict["makeTemporaryEphemerisDatabase"] = args.dw - else: - cmd_args_dict["makeTemporaryEphemerisDatabase"] = False - - cmd_args_dict["readTemporaryEphemerisDatabase"] = args.dr - cmd_args_dict["deleteTemporaryEphemerisDatabase"] = bool(args.dl) cmd_args_dict["surveyname"] = args.s cmd_args_dict["outfilestem"] = args.t cmd_args_dict["verbose"] = args.v @@ -101,29 +89,6 @@ def PPCommandLineParser(args): os.path.join(cmd_args_dict["outpath"], cmd_args_dict["outfilestem"] + ".*"), args.f, pplogger ) - if args.dr and args.dw: - pplogger.error("ERROR: both -dr and -dw flags set at command line. Please use only one.") - sys.exit("ERROR: both -dr and -dw flags set at command line. Please use only one.") - - if args.dl and not args.dr and not args.dw: - pplogger.error("ERROR: -dl flag set without either -dr or -dw.") - sys.exit("ERROR: -dl flag set without either -dr or -dw.") - - if args.dr and not os.path.exists(args.dr): - pplogger.error( - "ERROR: temporary ephemeris database not found at " - + args.dr - + ". Rerun with command line flag -dw to create one." - ) - sys.exit( - "ERROR: temporary ephemeris database not found at " - + args.dr - + ". Rerun with command line flag -dw to create one." - ) - - if args.dw: - warn_or_remove_file(cmd_args_dict["makeTemporaryEphemerisDatabase"], args.f, pplogger) - # Log all the command line settings to INFO. for flag, value in cmd_args_dict.items(): pplogger.info(f"Using commandline setting {flag} = {value}") diff --git a/src/sorcha/modules/PPConfigParser.py b/src/sorcha/modules/PPConfigParser.py index ec33fb01..1d99ee38 100755 --- a/src/sorcha/modules/PPConfigParser.py +++ b/src/sorcha/modules/PPConfigParser.py @@ -735,20 +735,6 @@ def PPPrintConfigsToLog(configs, cmd_args): pplogger.info("The output ephemerides file is located " + cmd_args.output_ephemeris_file) pplogger.info("The survey selected is: " + cmd_args.surveyname) - if cmd_args.makeTemporaryEphemerisDatabase: - pplogger.info( - "Creating of temporary ephemeris database at: " + str(cmd_args.makeTemporaryEphemerisDatabase) - ) - - if cmd_args.readTemporaryEphemerisDatabase: - pplogger.info( - "Reading from existing temporary ephemeris database at " - + str(cmd_args.readTemporaryEphemerisDatabase) - ) - - if cmd_args.deleteTemporaryEphemerisDatabase: - pplogger.info("Temporary ephemeris database will be deleted upon code conclusion.") - if configs["comet_activity"] == "comet": pplogger.info("Cometary activity set to: " + str(configs["comet_activity"])) elif configs["comet_activity"] == "none": diff --git a/src/sorcha/modules/PPMakeTemporaryEphemerisDatabase.py b/src/sorcha/modules/PPMakeTemporaryEphemerisDatabase.py deleted file mode 100644 index 78dcc4a1..00000000 --- a/src/sorcha/modules/PPMakeTemporaryEphemerisDatabase.py +++ /dev/null @@ -1,47 +0,0 @@ -import sqlite3 - -from sorcha.readers.OIFReader import OIFDataReader - - -def PPMakeTemporaryEphemerisDatabase(oif_output, out_fn, inputformat, chunksize=1e6): - """ - Makes an temporary ephemeris database from the output of ObjectsInField/other - ephemeris simulation output. This database is done in chunks to avoid memory problems. - - Parameters: - ----------- - oif_output (string): location of OIF/other output to be converted to database. - - out_fn (string): filepath where the temporary database should be saved. - - inputformat (string): format of OIF/other output. Should be "whitespace", "comma"/"csv", - or "h5"/"hdf5"/"HDF5". - - chunksize (int): number of rows in which to chunk database creation. - - Returns: - ----------- - out_fn (string): as input. - - """ - cnx = sqlite3.connect(out_fn) - - cur = cnx.cursor() - - cmd = "drop table if exists interm" - cur.execute(cmd) - - reader = OIFDataReader(oif_output, inputformat) - - # Load in chunks. The reader does automatic chunking for all file formats - # and does all validation. - startChunk = 0 - lastStartChunk = -1 - while lastStartChunk < startChunk: - lastStartChunk = startChunk - interm = reader.read_rows(startChunk, chunksize) - startChunk = int(startChunk + len(interm)) - - interm.to_sql("interm", con=cnx, if_exists="append", index=False) - - return out_fn diff --git a/src/sorcha/modules/__init__.py b/src/sorcha/modules/__init__.py index 42c00259..60f7e4f3 100644 --- a/src/sorcha/modules/__init__.py +++ b/src/sorcha/modules/__init__.py @@ -11,7 +11,6 @@ from . import PPFootprintFilter from . import PPJoinEphemeridesAndParameters from . import PPJoinEphemeridesAndOrbits -from . import PPMakeTemporaryEphemerisDatabase from . import PPReadPointingDatabase from . import PPMatchPointingToObservations from . import PPOutput diff --git a/src/sorcha/readers/DatabaseReader.py b/src/sorcha/readers/DatabaseReader.py index 10f7d37f..47005db1 100755 --- a/src/sorcha/readers/DatabaseReader.py +++ b/src/sorcha/readers/DatabaseReader.py @@ -5,6 +5,9 @@ from sorcha.readers.ObjectDataReader import ObjectDataReader +# NOTE: this was written for a now-defunct functionality, but has been left +# in the code as a database reader class may be useful later. + class DatabaseReader(ObjectDataReader): """A class to read in object data stored in a sqlite database.""" diff --git a/src/sorcha/sorcha.py b/src/sorcha/sorcha.py index 57cd2a67..d8e8945e 100755 --- a/src/sorcha/sorcha.py +++ b/src/sorcha/sorcha.py @@ -13,7 +13,6 @@ from sorcha.modules.PPLinkingFilter import PPLinkingFilter from sorcha.modules.PPTrailingLoss import PPTrailingLoss from sorcha.modules.PPBrightLimit import PPBrightLimit -from sorcha.modules.PPMakeTemporaryEphemerisDatabase import PPMakeTemporaryEphemerisDatabase from sorcha.modules.PPCalculateApparentMagnitude import PPCalculateApparentMagnitude from sorcha.modules.PPApplyFOVFilter import PPApplyFOVFilter from sorcha.modules.PPSNRLimit import PPSNRLimit @@ -111,12 +110,6 @@ def runLSSTSimulation(args, configs, pplogger=None): # End of config parsing - if args.makeTemporaryEphemerisDatabase: - verboselog("Creating temporary ephemeris database...") - args.readTemporaryEphemerisDatabase = PPMakeTemporaryEphemerisDatabase( - args.oifoutput, args.makeTemporaryEphemerisDatabase, configs["eph_format"] - ) - verboselog("Reading pointing database...") filterpointing = PPReadPointingDatabase( @@ -136,17 +129,14 @@ def runLSSTSimulation(args, configs, pplogger=None): ephem_primary = True reader = CombinedDataReader(ephem_primary=ephem_primary, verbose=True) - if args.makeTemporaryEphemerisDatabase or args.readTemporaryEphemerisDatabase: - reader.add_ephem_reader(DatabaseReader(args.readTemporaryEphemerisDatabase)) - else: - # TODO: Once more ephemerides_types are added this should be wrapped in a EphemerisDataReader - # That does the selection and checks. We are holding off adding this level of indirection until there - # is a second ephemerides_type. - if ephem_type.casefold() not in ["ar", "external"]: # pragma: no cover - pplogger.error(f"PPReadAllInput: Unsupported value for ephemerides_type {ephem_type}") - sys.exit(f"PPReadAllInput: Unsupported value for ephemerides_type {ephem_type}") - if ephem_type.casefold() == "external": - reader.add_ephem_reader(OIFDataReader(args.oifoutput, configs["eph_format"])) + # TODO: Once more ephemerides_types are added this should be wrapped in a EphemerisDataReader + # That does the selection and checks. We are holding off adding this level of indirection until there + # is a second ephemerides_type. + if ephem_type.casefold() not in ["ar", "external"]: # pragma: no cover + pplogger.error(f"PPReadAllInput: Unsupported value for ephemerides_type {ephem_type}") + sys.exit(f"PPReadAllInput: Unsupported value for ephemerides_type {ephem_type}") + if ephem_type.casefold() == "external": + reader.add_ephem_reader(OIFDataReader(args.oifoutput, configs["eph_format"])) reader.add_aux_data_reader(OrbitAuxReader(args.orbinfile, configs["aux_format"])) reader.add_aux_data_reader(CSVDataReader(args.paramsinput, configs["aux_format"])) @@ -305,10 +295,6 @@ def runLSSTSimulation(args, configs, pplogger=None): startChunk = startChunk + configs["size_serial_chunk"] # end for - if args.deleteTemporaryEphemerisDatabase: - verboselog("Deleting the temporary ephemeris database...") - os.remove(args.readTemporaryEphemerisDatabase) - pplogger.info("Sorcha process is completed.") @@ -423,26 +409,6 @@ def main(): type=str, dest="cp", ) - optional.add_argument( - "-dl", - help="Delete the temporary ephemeris database after code has completed.", - action="store_true", - default=False, - ) - optional.add_argument( - "-dr", - help="Location of existing/previous temporary ephemeris database to read from if wanted.", - dest="dr", - type=str, - ) - optional.add_argument( - "-dw", - help="Make temporary ephemeris database. If no filepath/name supplied, default name and ephemeris input location used.", - dest="dw", - nargs="?", - const="default", - type=str, - ) optional.add_argument( "-f", "--force", diff --git a/src/sorcha/utilities/sorchaArguments.py b/src/sorcha/utilities/sorchaArguments.py index c95ae8b1..c3067bff 100644 --- a/src/sorcha/utilities/sorchaArguments.py +++ b/src/sorcha/utilities/sorchaArguments.py @@ -27,13 +27,6 @@ class sorchaArguments: verbose: bool = False """logger verbosity""" - makeTemporaryEphemerisDatabase: bool = False - """whether or not to make ephemeris database""" - readTemporaryEphemerisDatabase = False - """path to ephemeris database or `False`""" - deleteTemporaryEphemerisDatabase: bool = False - """whether or not to delete ephemeris database""" - surveyname: str = "" """name of the survey (`lsst` is only one implemented currently)""" @@ -64,10 +57,6 @@ def read_from_dict(self, args): self.ar_data_file_path = args.get("ar_data_path") self.verbose = args["verbose"] - self.makeTemporaryEphemerisDatabase = args["makeTemporaryEphemerisDatabase"] - self.readTemporaryEphemerisDatabase = args["readTemporaryEphemerisDatabase"] - self.deleteTemporaryEphemerisDatabase = args["deleteTemporaryEphemerisDatabase"] - self.surveyname = args["surveyname"] if "complex_physical_parameters" in args.keys(): diff --git a/tests/data/README.md b/tests/data/README.md index 75e7369c..b6c3eb22 100644 --- a/tests/data/README.md +++ b/tests/data/README.md @@ -71,10 +71,8 @@ Used by: Example OIF output, whitespace-separated. Used by: - test_createResultsSQLDatabase.py -- test_createTemporaryDatabases.py - test_makeConfigOIF.py - test_PPJoinEphemeridesAndOrbits.py -- test_PPMakeTemporaryEphemerisDatabase.py - test_PPReadEphemerides.py - test_PPReadOif.py diff --git a/tests/data/testdb_PPIntermDB.db b/tests/data/testdb_PPIntermDB.db new file mode 100644 index 00000000..b9b4b9dc Binary files /dev/null and b/tests/data/testdb_PPIntermDB.db differ diff --git a/tests/readers/test_DatabaseReader.py b/tests/readers/test_DatabaseReader.py index a5f281a0..255c76ea 100755 --- a/tests/readers/test_DatabaseReader.py +++ b/tests/readers/test_DatabaseReader.py @@ -4,100 +4,95 @@ from numpy.testing import assert_equal -from sorcha.modules.PPMakeTemporaryEphemerisDatabase import PPMakeTemporaryEphemerisDatabase from sorcha.readers.DatabaseReader import DatabaseReader from sorcha.utilities.dataUtilitiesForTests import get_test_filepath def test_DatabaseReader_objects(): - with tempfile.TemporaryDirectory() as dir_name: - db_file = os.path.join(dir_name, "testdb_PPIntermDB.db") - _ = PPMakeTemporaryEphemerisDatabase(get_test_filepath("oiftestoutput.txt"), db_file, "whitespace") + db_file = get_test_filepath("testdb_PPIntermDB.db") - eph_reader = DatabaseReader(db_file) - eph_data = eph_reader.read_objects(["S000015", "S000044"]) - assert len(eph_data) == 5 - assert eph_reader.get_reader_info() == "DatabaseReader:" + db_file + eph_reader = DatabaseReader(db_file) + eph_data = eph_reader.read_objects(["S000015", "S000044"]) + assert len(eph_data) == 5 + assert eph_reader.get_reader_info() == "DatabaseReader:" + db_file - # Check that we correctly loaded the header information. - column_headings = np.array( - [ - "ObjID", - "FieldID", - "FieldMJD_TAI", - "AstRange(km)", - "AstRangeRate(km/s)", - "AstRA(deg)", - "AstRARate(deg/day)", - "AstDec(deg)", - "AstDecRate(deg/day)", - "Ast-Sun(J2000x)(km)", - "Ast-Sun(J2000y)(km)", - "Ast-Sun(J2000z)(km)", - "Ast-Sun(J2000vx)(km/s)", - "Ast-Sun(J2000vy)(km/s)", - "Ast-Sun(J2000vz)(km/s)", - "Obs-Sun(J2000x)(km)", - "Obs-Sun(J2000y)(km)", - "Obs-Sun(J2000z)(km)", - "Obs-Sun(J2000vx)(km/s)", - "Obs-Sun(J2000vy)(km/s)", - "Obs-Sun(J2000vz)(km/s)", - "Sun-Ast-Obs(deg)", - ], - dtype=object, - ) - assert_equal(column_headings, eph_data.columns.values) + # Check that we correctly loaded the header information. + column_headings = np.array( + [ + "ObjID", + "FieldID", + "FieldMJD_TAI", + "AstRange(km)", + "AstRangeRate(km/s)", + "AstRA(deg)", + "AstRARate(deg/day)", + "AstDec(deg)", + "AstDecRate(deg/day)", + "Ast-Sun(J2000x)(km)", + "Ast-Sun(J2000y)(km)", + "Ast-Sun(J2000z)(km)", + "Ast-Sun(J2000vx)(km/s)", + "Ast-Sun(J2000vy)(km/s)", + "Ast-Sun(J2000vz)(km/s)", + "Obs-Sun(J2000x)(km)", + "Obs-Sun(J2000y)(km)", + "Obs-Sun(J2000z)(km)", + "Obs-Sun(J2000vx)(km/s)", + "Obs-Sun(J2000vy)(km/s)", + "Obs-Sun(J2000vz)(km/s)", + "Sun-Ast-Obs(deg)", + ], + dtype=object, + ) + assert_equal(column_headings, eph_data.columns.values) - # Check that we load the correct object ids. - for i in range(5): - assert (eph_data.iloc[i].values[0] == "S000015") or (eph_data.iloc[i].values[0] == "S000044") + # Check that we load the correct object ids. + for i in range(5): + assert (eph_data.iloc[i].values[0] == "S000015") or (eph_data.iloc[i].values[0] == "S000044") - # Read different object IDs. - eph_data2 = eph_reader.read_objects(["S000021"]) - assert len(eph_data2) == 1 - assert_equal(eph_data2.iloc[0].values[0], "S000021") + # Read different object IDs. + eph_data2 = eph_reader.read_objects(["S000021"]) + assert len(eph_data2) == 1 + assert_equal(eph_data2.iloc[0].values[0], "S000021") def test_DatabaseReader_lines(): - with tempfile.TemporaryDirectory() as dir_name: - db_file = os.path.join(dir_name, "testdb_PPIntermDB.db") - _ = PPMakeTemporaryEphemerisDatabase(get_test_filepath("oiftestoutput.txt"), db_file, "whitespace") + db_file = get_test_filepath("testdb_PPIntermDB.db") - eph_reader = DatabaseReader(db_file) - eph_data = eph_reader.read_rows() - assert len(eph_data) == 9 + eph_reader = DatabaseReader(db_file) + eph_data = eph_reader.read_rows() + assert len(eph_data) == 9 - expected_first_row = np.array( - [ - "S00000t", - 379, - 59853.205174, - 283890475.515, - -1.12, - 11.969664, - -0.280799, - -0.19939, - -0.132793, - 426166274.581, - 77286024.759, - 6987943.309, - -2.356, - 11.386, - 4.087, - 148449956.422, - 18409281.409, - 7975891.432, - -4.574, - 27.377, - 11.699, - 2.030016, - ], - dtype="object", - ) - assert_equal(expected_first_row, eph_data.iloc[0].values) + expected_first_row = np.array( + [ + "S00000t", + 379, + 59853.205174, + 283890475.515, + -1.12, + 11.969664, + -0.280799, + -0.19939, + -0.132793, + 426166274.581, + 77286024.759, + 6987943.309, + -2.356, + 11.386, + 4.087, + 148449956.422, + 18409281.409, + 7975891.432, + -4.574, + 27.377, + 11.699, + 2.030016, + ], + dtype="object", + ) + assert_equal(expected_first_row, eph_data.iloc[0].values) - # Read in rows 3, 4, 5, 6 + the header - eph_data = eph_reader.read_rows(3, 4) - assert len(eph_data) == 4 - assert_equal("S000021", eph_data.iloc[0].values[0]) + # Read in rows 3, 4, 5, 6 + the header + eph_data = eph_reader.read_rows(3, 4) + assert len(eph_data) == 4 + assert_equal("S000021", eph_data.iloc[0].values[0]) diff --git a/tests/sorcha/test_PPCommandLineParser.py b/tests/sorcha/test_PPCommandLineParser.py index 10ea2123..d65f17ad 100644 --- a/tests/sorcha/test_PPCommandLineParser.py +++ b/tests/sorcha/test_PPCommandLineParser.py @@ -5,7 +5,7 @@ class args: - def __init__(self, cp, dw, dr, dl, t="testout", o="./", f=False): + def __init__(self, cp, t="testout", o="./", f=False): self.p = get_test_filepath("testcolour.txt") self.ob = get_test_filepath("testorb.des") self.er = get_test_filepath("oiftestoutput.txt") @@ -17,9 +17,6 @@ def __init__(self, cp, dw, dr, dl, t="testout", o="./", f=False): self.s = "lsst" self.t = t self.v = True - self.dw = dw - self.dr = dr - self.dl = dl self.f = f self.ar = None @@ -29,7 +26,7 @@ def test_PPCommandLineParser(): tmp_path = os.path.dirname(get_test_filepath("test_input_fullobs.csv")) - cmd_dict_1 = PPCommandLineParser(args(False, False, None, False)) + cmd_dict_1 = PPCommandLineParser(args(False)) expected_1 = { "paramsinput": get_test_filepath("testcolour.txt"), "orbinfile": get_test_filepath("testorb.des"), @@ -37,9 +34,6 @@ def test_PPCommandLineParser(): "configfile": get_test_filepath("test_PPConfig.ini"), "pointing_database": get_test_filepath("baseline_10klines_2.0.db"), "outpath": "./", - "makeTemporaryEphemerisDatabase": False, - "readTemporaryEphemerisDatabase": None, - "deleteTemporaryEphemerisDatabase": False, "surveyname": "lsst", "outfilestem": "testout", "verbose": True, @@ -47,9 +41,7 @@ def test_PPCommandLineParser(): "output_ephemeris_file": None, } - cmd_dict_2 = PPCommandLineParser( - args(get_test_filepath("testcomet.txt"), False, get_test_filepath("sqlresults.db"), True) - ) + cmd_dict_2 = PPCommandLineParser(args(get_test_filepath("testcomet.txt"))) expected_2 = { "paramsinput": get_test_filepath("testcolour.txt"), "orbinfile": get_test_filepath("testorb.des"), @@ -57,46 +49,7 @@ def test_PPCommandLineParser(): "configfile": get_test_filepath("test_PPConfig.ini"), "pointing_database": get_test_filepath("baseline_10klines_2.0.db"), "outpath": "./", - "makeTemporaryEphemerisDatabase": False, "complex_physical_parameters": get_test_filepath("testcomet.txt"), - "readTemporaryEphemerisDatabase": get_test_filepath("sqlresults.db"), - "deleteTemporaryEphemerisDatabase": True, - "surveyname": "lsst", - "outfilestem": "testout", - "verbose": True, - "ar_data_path": None, - "output_ephemeris_file": None, - } - - cmd_dict_3 = PPCommandLineParser(args(False, os.path.join(tmp_path, "test.db"), None, True)) - expected_3 = { - "paramsinput": get_test_filepath("testcolour.txt"), - "orbinfile": get_test_filepath("testorb.des"), - "oifoutput": get_test_filepath("oiftestoutput.txt"), - "configfile": get_test_filepath("test_PPConfig.ini"), - "pointing_database": get_test_filepath("baseline_10klines_2.0.db"), - "outpath": "./", - "makeTemporaryEphemerisDatabase": os.path.join(tmp_path, "test.db"), - "readTemporaryEphemerisDatabase": None, - "deleteTemporaryEphemerisDatabase": True, - "surveyname": "lsst", - "outfilestem": "testout", - "verbose": True, - "ar_data_path": None, - "output_ephemeris_file": None, - } - - cmd_dict_4 = PPCommandLineParser(args(False, "default", None, True)) - expected_4 = { - "paramsinput": get_test_filepath("testcolour.txt"), - "orbinfile": get_test_filepath("testorb.des"), - "oifoutput": get_test_filepath("oiftestoutput.txt"), - "configfile": get_test_filepath("test_PPConfig.ini"), - "pointing_database": get_test_filepath("baseline_10klines_2.0.db"), - "outpath": "./", - "makeTemporaryEphemerisDatabase": os.path.join(tmp_path, "temp_oiftestoutput.db"), - "readTemporaryEphemerisDatabase": None, - "deleteTemporaryEphemerisDatabase": True, "surveyname": "lsst", "outfilestem": "testout", "verbose": True, @@ -108,14 +61,12 @@ def test_PPCommandLineParser(): pass with pytest.raises(SystemExit) as e: - _ = PPCommandLineParser(args(False, False, None, False, o=tmp_path, t="dummy_file")) + _ = PPCommandLineParser(args(False, o=tmp_path, t="dummy_file")) - _ = PPCommandLineParser(args(False, False, None, False, o=tmp_path, t="dummy_file", f=True)) + _ = PPCommandLineParser(args(False, o=tmp_path, t="dummy_file", f=True)) assert cmd_dict_1 == expected_1 assert cmd_dict_2 == expected_2 - assert cmd_dict_3 == expected_3 - assert cmd_dict_4 == expected_4 assert e.type == SystemExit assert not os.path.isfile(os.path.join(tmp_path, "dummy_file.txt")) diff --git a/tests/sorcha/test_PPConfigParser.py b/tests/sorcha/test_PPConfigParser.py index 12b3c5a7..de2f4f38 100644 --- a/tests/sorcha/test_PPConfigParser.py +++ b/tests/sorcha/test_PPConfigParser.py @@ -242,9 +242,6 @@ def test_PPPrintConfigsToLog(tmp_path): "configfile": "test_PPConfig.ini", "pointing_database": "./baseline_10klines_2.0.db", "outpath": "./", - "makeTemporaryEphemerisDatabase": False, - "readTemporaryEphemerisDatabase": None, - "deleteTemporaryEphemerisDatabase": False, "surveyname": "lsst", "outfilestem": "testout", "verbose": True, diff --git a/tests/sorcha/test_PPMakeTemporaryEphemerisDatabase.py b/tests/sorcha/test_PPMakeTemporaryEphemerisDatabase.py deleted file mode 100755 index a0c7372a..00000000 --- a/tests/sorcha/test_PPMakeTemporaryEphemerisDatabase.py +++ /dev/null @@ -1,42 +0,0 @@ -import sqlite3 -import pandas as pd -import os -import pytest - -from sorcha.utilities.dataUtilitiesForTests import get_test_filepath - - -@pytest.fixture -def setup_and_teardown_for_PPMakeTemporaryEphemerisDatabase(): - yield - - temp_path = os.path.dirname(get_test_filepath("oiftestoutput.txt")) - stem_name = "testdb_PPIntermDB.db" - - os.remove(os.path.join(temp_path, stem_name)) - - -def test_PPMakeTemporaryEphemerisDatabase(setup_and_teardown_for_PPMakeTemporaryEphemerisDatabase): - from sorcha.modules.PPMakeTemporaryEphemerisDatabase import PPMakeTemporaryEphemerisDatabase - from sorcha.readers.OIFReader import read_full_oif_table - - temp_path = os.path.dirname(get_test_filepath("oiftestoutput.txt")) - stem_name = "testdb_PPIntermDB.db" - daba = PPMakeTemporaryEphemerisDatabase( - get_test_filepath("oiftestoutput.txt"), os.path.join(temp_path, stem_name), "whitespace" - ) - - cnx = sqlite3.connect(daba) - cur = cnx.cursor() - - cur.execute("select * from interm") - col_names = list(map(lambda x: x[0], cur.description)) - - oif_database = pd.DataFrame(cur.fetchall(), columns=col_names) - - oif_file = read_full_oif_table(get_test_filepath("oiftestoutput.txt"), "whitespace") - pd.testing.assert_frame_equal(oif_file, oif_database) - - cnx.close() - - return diff --git a/tests/sorcha/test_sorchaArguments.py b/tests/sorcha/test_sorchaArguments.py index 16c6f8aa..3ed6d4b8 100644 --- a/tests/sorcha/test_sorchaArguments.py +++ b/tests/sorcha/test_sorchaArguments.py @@ -9,9 +9,6 @@ "oifoutput": get_demo_filepath("example_oif_output.txt"), "configfile": get_demo_filepath("PPConfig_test.ini"), "outpath": "./data/out", - "makeTemporaryEphemerisDatabase": False, - "readTemporaryEphemerisDatabase": False, - "deleteTemporaryEphemerisDatabase": False, "surveyname": "LSST", "outfilestem": f"out_end2end", "verbose": False,