dingo-gw / dingo

Dingo: Deep inference for gravitational-wave observations
MIT License
55 stars 18 forks source link

Remove import of DingoDataset from dingo.core.utils #157

Closed stephengreen closed 1 year ago

stephengreen commented 1 year ago

Importing DingoDataset from within dingo.core.utils was causing a circular import, since the module containing DingoDataset depended on another utility (to obtain the version).

The offending function was dingo.core.utils.dataset_utils.load_data_from_file. Since this was only called once (by dingo.gw.data.data_preparation.load_raw_data) I refactored the former function into the latter. I also had to remove an associated test. Since this part of the inference code is being used less often in favor of dingo_pipe, I did not create a new test to replace it.

In addition, within dingo.core.utils.dataset_utils, the two functions save_dataset and load_dataset were not being used at all, so I removed them. The final function recursive_check_dicts_are_equal was moved to dingo.core.utils.misc, and so the module could be deleted. All tests run successfully now.

stephengreen commented 1 year ago

Merging now since the code was broken due to the circular import. I did not check that the old inference code continues to work, so it may be worth looking into.