Skip to content

Conversation

@bhazelton
Copy link
Member

Description

This is following some of the ideas in UVBase._select_along_axis. This could probably be generalized to UVBase, but I wanted to get UVData's version done to work out the ideas before moving it up UVBase. And I wanted to at least get a draft up for @rlbyrne to try out.

Motivation and Context

fixes #1595

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change (documentation changes only)
  • Version change
  • Build or continuous integration change
  • Other

Checklist:

Bug fix checklist:

  • My fix includes a new test that breaks as a result of the bug (if possible).
  • I have updated the CHANGELOG.

@codecov
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.93%. Comparing base (14b7a8b) to head (26ed06f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1606      +/-   ##
==========================================
- Coverage   99.93%   99.93%   -0.01%     
==========================================
  Files          67       67              
  Lines       22688    22670      -18     
==========================================
- Hits        22674    22656      -18     
  Misses         14       14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bhazelton
Copy link
Member Author

bhazelton commented Aug 18, 2025

@kartographer this is a slightly different approach than you took in the Telescope.__add__ method. Before I start thinking about moving it up to UVBase I'd like to get your thoughts about whether there is something that could be done better.

@bhazelton bhazelton force-pushed the add_concat_use_axis branch 3 times, most recently from f6b1427 to 33b50d9 Compare August 19, 2025 23:38
@bhazelton bhazelton requested a review from kartographer August 25, 2025 23:08
@bhazelton bhazelton force-pushed the add_concat_use_axis branch 5 times, most recently from 945b3a6 to 34449d2 Compare September 24, 2025 00:32
@bhazelton bhazelton force-pushed the add_concat_use_axis branch from 34449d2 to a1f87dc Compare December 4, 2025 23:35
Copy link
Contributor

@steven-murray steven-murray left a comment

Choose a reason for hiding this comment

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

Thanks @bhazelton and sorry for the very slow review! I have a few comments. Mostly I think we can make some of these functions a bit more clear in what they are doing. They seem like they will become quite central in how UVxxx objects operate, so we should make them as clear as possible for our own future reference.

It might also be useful to do a quick profiling for these functions, as I expect they might be bottleneck functions in some applications (especially in terms of memory)

return np.asarray(inds)


def flt_ind_str_arr(
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be flt_int_str_arr? And can we just make it float_int_to_str_array?

flt_first: bool = True,
) -> StrArray:
"""
Create a string array built from float and integer arrays for matching.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to have an example like "E.g. for float 3.7 and int 3 this will create an entry in the output array as '3.7_3'"


def _get_param_axis(self, axis_name: str, single_named_axis: bool = False):
"""
Get a mapping of parameters that have a given axis to the axis number.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use "attributes" instead of "parameters" here? I was confused what this function was doing until I realized you were talking about attributes.

Probably this will be even more easily cleared up by including a single simple example.

self,
other,
axis_name: str,
other_inds: IntArray,
Copy link
Contributor

Choose a reason for hiding this comment

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

should this also have a default of None, corresponding to including all entries from the other object?

new_array = np.concatenate(
[
getattr(self, param),
getattr(other, "_" + param).get_from_form(other_form_dict),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we couldn't just use np.take(getattr(other, param), other_inds, axis) here?

Comment on lines +923 to +924
if param not in multi_axis_params:
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not also padding single-axis objects? This is confusing

Comment on lines +951 to +953
order_dict : dict
dict giving the final sort indices for each axis (keys are axes, values
are index arrays for sorting).
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this sorting occurs in multiple functions, might it be better to just have a standalone "arbitrary axis sorting helper"?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parameter scan_number_array is not updated during concatenation

3 participants