Skip to content

Conversation

@davidhassell
Copy link
Collaborator

@davidhassell davidhassell commented Apr 12, 2024

Fixes #759

Notes

The removed .html files were effectively empty, a bug resulting from methods being built as attributes, and vice versa.

@davidhassell davidhassell added the enhancement New feature or request label Apr 12, 2024
@davidhassell davidhassell marked this pull request as draft April 15, 2024 09:57
@davidhassell
Copy link
Collaborator Author

Converting to draft whilst I fix some problems :)

@davidhassell davidhassell marked this pull request as ready for review April 18, 2024 21:40
@davidhassell
Copy link
Collaborator Author

Ready for review :)

@davidhassell davidhassell marked this pull request as draft April 19, 2024 07:17
@davidhassell davidhassell marked this pull request as ready for review April 19, 2024 08:29
@davidhassell
Copy link
Collaborator Author

All good for review - just added a couple of lines that will fix some of Bryan's performance issues, and are in the same area of code as touched by this PR.

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just finishing up on functionality testing, though so far that is all good. Here are my comments from considering the code itself. Mostly these are questions that occurred to me and typo fixes, with one strong preference to move to use an assert statement.

davidhassell and others added 7 commits April 22, 2024 16:42
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality-related comments now (plus a few more code eyeballing related). Overall, it appears to work well but I would advise for the mode API to be updated and consistent across both methods (I think this was the intention as per the original/corresponding Issue, unless I have misinterpreted it).

indices

The indices aspect seems to work fine, though I think it would be beneficial to add some new examples to the docstring to show usage of halo size setting as a positional argument, with and without also setting the mode component.

Ideally we can add test coverage to include the use of both mode and halo settings as positional arguments, since the new testing in test_Field doesn't seem to have any, unless I've missed something.

subspace

It seems like the subspace API is as it was before, so doesn't include the capability to specify the halo, but I thought the intention was to allow that for both methods? I certainly think both should include the mode and halo specification (now under config as per our discussions on here) and in the same manner, for consistency and since, for example with my VISION script, it would be nice to directly do:

model_field_sbb_indices = model_field.subspace(
    1,
    X=cf.wi(obs_X.minimum(), obs_X.maximum()),
    Y=cf.wi(obs_Y.minimum(), obs_Y.maximum()),
    Z=cf.wi(obs_Z.minimum(), obs_Z.maximum()),
)

instead of what I am doing for our spatial bounding box subspace using this branch, namely:

model_field_sbb_indices = model_field.indices(
    1,
    X=cf.wi(obs_X.minimum(), obs_X.maximum()),
    Y=cf.wi(obs_Y.minimum(), obs_Y.maximum()),
    Z=cf.wi(obs_Z.minimum(), obs_Z.maximum()),
)
model_field_sbb = model_field[model_field_sbb_indices]

If we do update the API for subspace in a similar way, testing should really be added for that as well, not just the indices side of things.

@davidhassell
Copy link
Collaborator Author

Hi Sadie,

It seems like the subspace API is as it was before, so doesn't include the capability to specify the halo, but I thought the intention was to allow that for both methods?

subspace does indeed have the new API, but I forgot to update its docstring. Sorry!

davidhassell and others added 5 commits April 23, 2024 09:32
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
@davidhassell
Copy link
Collaborator Author

davidhassell commented Apr 23, 2024

... but I forgot to update its docstring ...

The reason for this is that the docstring you generally see is in cf.subspacefield.py, rather than cf/field.py. I had only updated the latter. This is pointless complexity [*] which we should get rid of for v4.0.0.

[*] i.e. the ability to square-bracket index the subspace attribute (edit)

@davidhassell
Copy link
Collaborator Author

Ideally we can add test coverage to include the use of both mode and halo settings as positional arguments

Done: 0a8b8a0

@davidhassell
Copy link
Collaborator Author

Also added an API test to subspace: 31ec154

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David for addressing my feedback so well. I think everything has been accounted for, and I've checked works and everything has been accordingly, except:

it would be beneficial to add some new examples to the docstring to show usage of halo size setting as a positional argument

for both the indices and subspace docstrings. The config setting with two positional arguments in particular is not yet shown in either case, and even the old lone mode string configuration seems to not be demonstrated for the indices case.

See also the pair of new comments in-line (sorry, I submitted one of two as a separate review before accidentally, so see above too) but overall, I am happy so please merge when you have considered those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow a halo to be added by indices and subspace

2 participants