diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4fe980b..086326b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ on: - main push: branches: - - '*' + - main tags: - '*' diff --git a/examples/cosmic_shear/cosmicshear_sacc.fits b/examples/cosmic_shear/cosmicshear_sacc.fits index 1a2141a..9b8d578 100644 Binary files a/examples/cosmic_shear/cosmicshear_sacc.fits and b/examples/cosmic_shear/cosmicshear_sacc.fits differ diff --git a/src/smokescreen/__main__.py b/src/smokescreen/__main__.py index 017de11..a3ee13d 100644 --- a/src/smokescreen/__main__.py +++ b/src/smokescreen/__main__.py @@ -95,7 +95,7 @@ def datavector_main(path_to_sacc: Path_fr, smoke.save_concealed_datavector(path_to_output, root_name, output_format=input_format) # Determine extension based on format - ext = '.h5' if input_format == 'hdf5' else '.fits' + ext = '.hdf5' if input_format == 'hdf5' else '.fits' outprintfile = f"{path_to_output}/{root_name}_concealed_data_vector{ext}" print(f"\nConcealed sacc file saved as:\n\t{outprintfile}") diff --git a/src/smokescreen/_version.py b/src/smokescreen/_version.py index 6d9fa95..bd98c14 100644 --- a/src/smokescreen/_version.py +++ b/src/smokescreen/_version.py @@ -1 +1 @@ -__version__ = "v1.5.5" +__version__ = "v1.5.6" diff --git a/src/smokescreen/datavector.py b/src/smokescreen/datavector.py index 1de3f78..99200b2 100644 --- a/src/smokescreen/datavector.py +++ b/src/smokescreen/datavector.py @@ -538,7 +538,7 @@ def save_concealed_datavector(self, path_to_save, file_root, Saves the concealed (blinded) data-vector to a file. Saves the blinded data-vector to a file with the appropriate extension - based on the input format: ``.fits`` for FITS files or ``.h5`` for HDF5 files. + based on the input format: ``.fits`` for FITS files or ``.hdf5`` for HDF5 files. Parameters ---------- @@ -576,7 +576,7 @@ def save_concealed_datavector(self, path_to_save, file_root, # Determine file extension based on format if output_format == 'hdf5': - ext = '.h5' + ext = '.hdf5' save_method = concealed_sacc.save_hdf5 else: # default to FITS ext = '.fits' diff --git a/tests/test_datavector.py b/tests/test_datavector.py index c3b25a7..1b72345 100644 --- a/tests/test_datavector.py +++ b/tests/test_datavector.py @@ -796,7 +796,7 @@ def test_save_concealed_datavector_hdf5(mock_getuser): # Save the blinded data vector to a temporary HDF5 file temp_file_path = "./tests/" temp_file_root = "temp_sacc_hdf5" - temp_file_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.h5" + temp_file_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.hdf5" # Save with output_format='hdf5' to test HDF5 output returned_sacc = sck.save_concealed_datavector(temp_file_path, @@ -807,10 +807,10 @@ def test_save_concealed_datavector_hdf5(mock_getuser): # Check that the return is a sacc object assert isinstance(returned_sacc, sacc.Sacc) - # Check that the file was created with .h5 extension + # Check that the file was created with .hdf5 extension assert os.path.exists(temp_file_name) # Verify it's an HDF5 file by checking extension in path - assert temp_file_name.endswith('.h5') + assert temp_file_name.endswith('.hdf5') # Load the HDF5 file and check that the data vector matches loaded_sacc = sacc.Sacc.load_hdf5(temp_file_name) @@ -829,7 +829,7 @@ def test_save_concealed_datavector_hdf5(mock_getuser): @patch('src.smokescreen.datavector.getpass.getuser', return_value='test_user') def test_save_concealed_datavector_hdf5_from_fits_input(mock_getuser): # Test that when input format is FITS but output format is explicitly set to HDF5, - # the file is saved with .h5 extension + # the file is saved with .hdf5 extension cosmo = COSMO likelihood = "./examples/cosmic_shear/cosmicshear_likelihood.py" syst_dict = { @@ -853,7 +853,7 @@ def test_save_concealed_datavector_hdf5_from_fits_input(mock_getuser): # Save with explicit HDF5 output format temp_file_path = "./tests/" temp_file_root = "temp_sacc_hdf5_from_fits" - temp_file_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.h5" + temp_file_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.hdf5" returned_sacc = sck.save_concealed_datavector(temp_file_path, temp_file_root, @@ -881,7 +881,7 @@ def test_save_concealed_datavector_default_format_uses_input_format(mock_getuser } shift_dict = {"Omega_c": 0.34, "sigma8": 0.85} - # Test with HDF5 input - output should also be HDF5 (.h5) + # Test with HDF5 input - output should also be HDF5 (.hdf5) sacc_data_hdf5, _ = load_sacc_file("./examples/cosmic_shear/cosmicshear_sacc.hdf5") sck = ConcealDataVector(cosmo, likelihood, shift_dict, sacc_data_hdf5, syst_dict, seed=1234) @@ -899,8 +899,8 @@ def test_save_concealed_datavector_default_format_uses_input_format(mock_getuser assert isinstance(returned_sacc, sacc.Sacc) - # Check that the file has .h5 extension (from HDF5 input format) - expected_hdf5_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.h5" + # Check that the file has .hdf5 extension (from HDF5 input format) + expected_hdf5_name = f"{temp_file_path}{temp_file_root}_concealed_data_vector.hdf5" assert os.path.exists(expected_hdf5_name) # Verify it can be loaded as HDF5 diff --git a/tests/test_utils.py b/tests/test_utils.py index 0352dfb..0fb9082 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -109,11 +109,11 @@ def test_load_sacc_file_hdf5_format(self, tmp_path): def test_load_sacc_file_with_h5_extension(self, tmp_path): import sacc as sacc_mod - # Create an HDF5 SACC file with .h5 extension + # Create an HDF5 SACC file with .hdf5 extension sacc_data = sacc_mod.Sacc() sacc_data.add_tracer('misc', 'test') sacc_data.add_data_point('galaxy_shear_cl_ee', ('test', 'test'), 1.0, ell=10) - h5_path = tmp_path / "test.h5" + h5_path = tmp_path / "test.hdf5" sacc_data.save_hdf5(str(h5_path)) # Load using load_sacc_file - should detect as HDF5 regardless of extension