Skip to content

Fix Test Failures, Improve Warning Handling, and Update Code for Stability #459

@ShigrafS

Description

@ShigrafS

This PR addresses several issues identified during the recent test run using pytest for the cooler project.

Addressed warnings:

  • Several warnings were issued during the test run, which indicated potential issues or areas where the code could be improved. These warnings include:
    • RuntimeWarnings: These were related to operations like empty slices or invalid values encountered during calculations. Specifically, warnings about "mean of empty slice" and "invalid value encountered in scalar divide" were observed. These are typically caused by computations where the data array or slice is empty or contains NaN or infinite values. The code in cooler/_balance.py (line 119) was adjusted to handle these cases more robustly, ensuring that such warnings are reduced or prevented.
    • ConvergenceWarnings: In some tests, algorithms didn't converge within the allowed iteration limit. For instance, warnings about "iteration limit reached without convergence" were noted in balancing operations. These warnings were seen in cooler/_balance.py (line 113). The code has been reviewed, and some optimization options were added to allow for better convergence or more informative messages when convergence issues occur.
    • UserWarnings: Warnings about non-symmetric matrices when triucheck was set to True were identified in cooler/_reduce.py (line 302). These warnings were caused by operations trying to create symmetric matrices from non-symmetric data. Adjustments were made to ensure that these warnings are avoided or that the behavior is more explicitly controlled (i.e., the triucheck flag is set to False when appropriate).

While these warnings don't immediately cause test failures, addressing them improves the stability and clarity of the code, making it easier to maintain and debug in the future.

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