HeloiseS / hoki

Bridging the gap between observation and theory
https://heloises.github.io/hoki/intro.html
BSD 3-Clause "New" or "Revised" License
47 stars 8 forks source link

[BUG]Csp tests don't pass #31

Closed HeloiseS closed 4 years ago

HeloiseS commented 4 years ago

test_eventrate.py:23: in <module>
    class TestCSPEventRate():
test_eventrate.py:35: in TestCSPEventRate
    return_edges=True)
../eventrate.py:74: in calculate_rate_over_time
    utils._type_check(metallicity, sfh)
E   AttributeError: module 'hoki.csp.utils' has no attribute '_type_check'
____________________________________________________________________________ ERROR collecting hoki/csp/tests/test_spectra.py _____________________________________________________________________________
../utils.py:140: in load_spectra
    spectra = pd.read_pickle(f"{data_folder}/all_spectra-{star}-{imf}.pkl")
../../../../.local/lib/python3.7/site-packages/pandas/io/pickle.py:170: in read_pickle
    f, fh = get_handle(fp_or_buf, "rb", compression=compression, is_text=False)
../../../../.local/lib/python3.7/site-packages/pandas/io/common.py:434: in get_handle
    f = open(path_or_buf, mode)
E   FileNotFoundError: [Errno 2] No such file or directory: '/home/fste075/hoki/hoki/data/spectra/all_spectra-bin-imf135_300.pkl'

During handling of the above exception, another exception occurred:
test_spectra.py:16: in <module>
    class TestCSPSSpectra(object):
test_spectra.py:21: in TestCSPSSpectra
    CSP = CSPSpectra(f"{data_path}/spectra")
../spectra.py:27: in __init__
    self.bpass_spectra = utils._normalise_spectrum(utils.load_spectra(data_folder, binary=binary))
../utils.py:149: in load_spectra
    data = hoki.load.model_output(f"{data_folder}/spectra-{star}-{imf}.z{metallicity}.dat")
../../load.py:206: in model_output
    assert os.path.isfile(path), "HOKI ERROR: This file does not exist, or its path is incorrect."
E   AssertionError: HOKI ERROR: This file does not exist, or its path is incorrect.
-------------------------------------------------------------------------------------------- Captured stdout ---------------------------------------------------------------------------------------------
Allocating memory
Loading metallicity: em5
_____________________________________________________________________________ ERROR collecting hoki/csp/tests/test_utils.py ______________________________________________________________________________
test_utils.py:16: in <module>
    class TestLoadFiles(object):
test_utils.py:25: in TestLoadFiles
    x = utils._load_files(f"{data_path}/supernova", "supernova")
E   AttributeError: module 'hoki.csp.utils' has no attribute '_load_files'
======================================================================================== short test summary info =========================================================================================
ERROR test_eventrate.py - AttributeError: module 'hoki.csp.utils' has no attribute '_type_check'
ERROR test_spectra.py - AssertionError: HOKI ERROR: This file does not exist, or its path is incorrect.
ERROR test_utils.py - AttributeError: module 'hoki.csp.utils' has no attribute '_load_files'
maxbriel commented 4 years ago

The package has been rewritten to take different inputs for the classes and these bugs are no longer present in the refactored code.