Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Feb 5, 2025
1 parent a318078 commit ff4f5f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
15 changes: 0 additions & 15 deletions cubids/tests/test_cubids.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,21 +449,6 @@ def _test__get_param_groups(cubids_instance):
# Add assertions here


def _test_round_params(cubids_instance):
"""Test rounding parameters.
Parameters
----------
cubids_instance : CuBIDS
An instance of the CuBIDS class.
"""
param_group_df = pd.DataFrame({"param": [0.123456789]})
config = {"param": {"round": 3}}
modality = "bold"
rounded_params = cubids_instance.round_params(param_group_df, config, modality)
# Add assertions here


def _test_get_sidecar_metadata(cubids_instance):
"""Test getting sidecar metadata.
Expand Down
9 changes: 8 additions & 1 deletion cubids/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,15 @@ def round_params(df, config, modality):
Returns
-------
pandas.DataFrame
DataFrame with the specified columns' values rounded to the requested precision.
Modified DataFrame with the specified columns' values rounded to the requested precision.
Raises
------
ValueError
If the data type of the column is not supported for rounding, such as strings.
"""
df = df.copy() # don't modify DataFrame in place

to_format = config["sidecar_params"][modality]
to_format.update(config["derived_params"][modality])

Expand Down

0 comments on commit ff4f5f8

Please sign in to comment.