Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main
push:
branches:
- '*'
- main
tags:
- '*'

Expand Down
Binary file modified examples/cosmic_shear/cosmicshear_sacc.fits
Binary file not shown.
2 changes: 1 addition & 1 deletion src/smokescreen/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
2 changes: 1 addition & 1 deletion src/smokescreen/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v1.5.5"
__version__ = "v1.5.6"
4 changes: 2 additions & 2 deletions src/smokescreen/datavector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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'
Expand Down
16 changes: 8 additions & 8 deletions tests/test_datavector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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 = {
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading