Skip to content

Commit

Permalink
finally realized calibrate_file is a single file
Browse files Browse the repository at this point in the history
process_file is a list of files
  • Loading branch information
rstrub committed Dec 1, 2023
1 parent 4fb394d commit 0a8aee2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 5 additions & 5 deletions hermes_eea/calibration/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def process_file(data_filename: Path) -> list:
"""
log.info(f"Processing file {data_filename}.")
output_files = []

calibrated_file = calibrate_file(data_filename)
output_files.append(calibrated_file)
# data_plot_files = plot_file(data_filename)
# calib_plot_files = plot_file(calibrated_file)
for filename in data_filename:
calibrated_file = calibrate_file(filename)
output_files.append(calibrated_file)
# data_plot_files = plot_file(data_filename)
# calib_plot_files = plot_file(calibrated_file)

# add other tasks below
return output_files
Expand Down
Binary file not shown.
16 changes: 11 additions & 5 deletions hermes_eea/tests/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ def test_calibrate_file_nofile_error():
# This one is less clear as yet...
def test_process_file_nofile_error():
"""Test that if file does not exist it produces the correct error. The file needs to be in the correct format."""
files = []
files.append((Path("hermes_EEA_l0_2032339-000000_v0.bin")))
files.append((Path("hermes_EEA_l0_2032340-000000_v0.bin")))

with pytest.raises(FileNotFoundError):
calib.process_file(Path("hermes_EEA_l0_2032339-000000_v0.bin"))
calib.process_file(files)


# this fills the blank cdf with data
Expand All @@ -86,12 +90,14 @@ def not_test_calibrate_file(level0_file, level1a_filename):
# )

# this also populates the file with data..duplicate of test_calibrate_file
def test_process_file_level0(large_level0_file):
def test_process_file_level0(large_level0_file,small_level0_file):
"""Test that the output filenames are correct and that a file was actually created."""

output_file = calib.process_file(large_level0_file)
assert os.path.basename(output_file[0]) == "hermes_eea_l1_20000101T124114_v1.0.0.cdf"
assert os.path.getsize(output_file[0]) > 3300000
output_files = calib.process_file([large_level0_file, small_level0_file])
assert os.path.basename(output_files[0]) == "hermes_eea_l1_20000101T124114_v1.0.0.cdf"
assert os.path.basename(output_files[1]) == "hermes_eea_l1_20000101T170901_v1.0.0.cdf"
assert os.path.getsize(output_files[0]) == 266568541
assert os.path.getsize(output_files[1]) == 275299

# this populates a level 1, a different file but doesn't really, now it is just a stub
def not_test_process_file_level1(level1_file):
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
'astropy>=5.3.3',
'cdflib',
'hermes_core @ git+https://github.com/HERMES-SOC/hermes_core/',
'ccsdspy @ git+https://github.com/ddasilva/ccsdspy.git'
]
Expand Down

0 comments on commit 0a8aee2

Please sign in to comment.