Skip to content

[BUG] Can we remove support for PDELibrary with no spatial derivatives or grid? #192

@Jacob-Stevens-Haas

Description

@Jacob-Stevens-Haas

Issue

A PDELibrary with no spatial derivatives is effectively just a CustomLibrary. The situation is only under test in the pytest fixture data_ode_library() - also the only time we create a PDELibrary without a spatial grid. I'm not familiar enough with all the notebooks to know if that's intentional support.

As far as tests go, data_custom_library() is passed as an alternate parametrized fixture every time data_ode_library() is passed. It has the same library terms and behaves the same, but also with three zero features.

Why it matters

This matters because PDELibrary (and in a few other code blocks under if isinstance(feature_library, PDELibrary)) has a lot of boilerplate code dealing with conditions where len(spatial_grid.ndim) < 1. This cruft makes refactoring difficult, e.g. removing redundant code with CustomLibrary by inheritance or composition (e.g. `PDELibrary(library_functions = another_library)).

I'm not trying to do all that, but in order to solve the notebook errors in #185, I've been making axes explicit in all (ok, most) places. I've been simplifying a lot of loops, nesting, and conditionals, and right now I'm working on moving the reshaping step (--> (n_samples, n_features) AFTER the feature library is applied. Currently, the PDELibrary.transform(), WeakPDELibrary.transform(), and utils.remove_random_rows() all include tricky steps to un-reshape the data and re-reshape the data since much of was written to only deal with 2-D arrays (n_time, n_coordinates -> n_samples, n_features). Would love to be able to remove that code (~50 lines) wholesale, but tricky to dance around len(spatial_grid.ndim) < 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions