Skip to content

test for TF equality fails on MacOS #381

@kkappler

Description

@kkappler

Two tests in aurora fail when running on a Mac.

FAILED test_define_frequency_bands.py::TestDefineBandsFromDict::test_can_declare_frequencies_directly_in_config - AssertionError: assert TF( survey='EMTF Synthetic', station='test1', latitude=18.00, longitude=0.00, elevation=0.00 ) == TF( survey='EMTF Synthetic', station='test1', latitude=18.00, ...
FAILED test_fourier_coefficients.py::TestAddFourierCoefficientsToSyntheticData::test_create_then_use_stored_fcs_for_processing - AssertionError: assert TF( survey='EMTF Synthetic', station='test2', latitude=18.00, longitude=0.00, elevation=0.00 ) == TF( survey='EMTF Synthetic', station='test2', latitude=18.00, ...

This appears to be due to unequal values for residual covariance when comparing two supposedly identical TFs. The difference is around 2e-27, and will be ignored for now. How to handle this?

One way is to create a compare_tf_equality method in test_helpers. This method can assert, for example:
np.isclose(tf_cls2.residual_covariance, tf_cls1.residual_covariance, atol=1e-26, rtol=1e-30).all()
and once that is asserted, set
tf_cls2.residual_covariance = tf_cls1.residual_covariance

then equality of other attrs can be asserted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions