Skip to content

Feature/haluska2/sina curve ordering #1559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

HaluskaR
Copy link

Summary

  • This PR is a feature add for Sina
  • It does the following:
    • Adds ability to set Sina's curve ordering when exporting Records
    • Sets the default ordering to be oldest-first
    • Implemented at user request to make switching ULTRA workflows to use Sina files easier

Could use ideas for additional useful orderings if any, getting things in the order the ULTRA users expect is the main goal.

@HaluskaR HaluskaR self-assigned this Apr 24, 2025
// Note: the toNode is being used as an intermediary here. As such, we force the CurveOrder to be oldest
// first, aka "don't reorder". If the user wants the curves in a specific order, that's decided at dump time,
// else the Record will have no way to know the "original" order within the library.
auto newLibData = addLibraryData(name, childRecord.toNode(CurveSet::CurveOrder::REGISTRATION_OLDEST_FIRST));
Copy link
Author

Choose a reason for hiding this comment

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

Reviewer context: library data represents a sort of "sub-record", specifically info a library might be responsible for that should be available with the host code's.

@doutriaux1
Copy link
Contributor

@HaluskaR this fails a lot of tests.

@HaluskaR
Copy link
Author

@HaluskaR this fails a lot of tests.

Looks like style checks. @white238 I remember some usage of a stylebot on I believe one of Gabriel's PRs, but my search-fu is failing. Do you mind kicking that off?

@white238
Copy link
Member

/style

@HaluskaR
Copy link
Author

HaluskaR commented May 6, 2025

Anyone else I should request a review from? If not, I'm going to make a push for the curveNames/orderedCurveNames changes

@kennyweiss
Copy link
Member

Anyone else I should request a review from? If not, I'm going to make a push for the curveNames/orderedCurveNames changes

Can @doutriaux1 and @bgunnar5 please give it a first review?

@kennyweiss kennyweiss requested a review from bgunnar5 May 6, 2025 18:06
Copy link
Contributor

@doutriaux1 doutriaux1 left a comment

Choose a reason for hiding this comment

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

@HaluskaR this orders curves within a curveset, do we also want to order curvsets?

otherwise it looks good, you might (or not) want to add the sorting functions I mentioned.

Also can we add a case where the user passes the order in which the curves need to be stored? that would allow them the most flecibility w/o having you implement new requests in the future

@HaluskaR
Copy link
Author

HaluskaR commented May 8, 2025

@HaluskaR this orders curves within a curveset, do we also want to order curvsets?

otherwise it looks good, you might (or not) want to add the sorting functions I mentioned.

Also can we add a case where the user passes the order in which the curves need to be stored? that would allow them the most flecibility w/o having you implement new requests in the future

Great question on the curve set ordering, I was thinking about that...we haven't seen tons of use of separate curve sets thus far so it's hard for me to make the call on what users would expect. My temptation would be to wait to see if there's a need, since I could see the idea of "order by age" being less obvious than for its curves (creation time vs. when an/the independent added vs. when a curve was last added into it).

Custom curve ordering's a good plan, adding that in now. Implementation thoughts from me:

If we have

dependents: "x_vel", "y_vel", "z_vel"

and the user gives us

dependents: "y_vel", "z_vel"

or

dependents: "z_vel", "y_vel", "x_vel", "q_vel"

Reject either, lists need to match exactly, return a bool. Call it applyCustom[In]DependentOrder. It'll take me a sec to add it so let me know if you want something other than the above!

@HaluskaR
Copy link
Author

HaluskaR commented May 8, 2025

@HaluskaR this orders curves within a curveset, do we also want to order curvsets?
otherwise it looks good, you might (or not) want to add the sorting functions I mentioned.
Also can we add a case where the user passes the order in which the curves need to be stored? that would allow them the most flecibility w/o having you implement new requests in the future

Great question on the curve set ordering, I was thinking about that...we haven't seen tons of use of separate curve sets thus far so it's hard for me to make the call on what users would expect. My temptation would be to wait to see if there's a need, since I could see the idea of "order by age" being less obvious than for its curves (creation time vs. when an/the independent added vs. when a curve was last added into it).

Custom curve ordering's a good plan, adding that in now. Implementation thoughts from me:

If we have

dependents: "x_vel", "y_vel", "z_vel"

and the user gives us

dependents: "y_vel", "z_vel"

or

dependents: "z_vel", "y_vel", "x_vel", "q_vel"

Reject either, lists need to match exactly, return a bool. Call it applyCustom[In]DependentOrder. It'll take me a sec to add it so let me know if you want something other than the above!

@doutriaux1 Tagging for the above comment

@HaluskaR
Copy link
Author

/style

@HaluskaR
Copy link
Author

@kennyweiss We're good on reviews from our side.

@doutriaux1
Copy link
Contributor

@HaluskaR don't we need the append PR in first? To double check this will work properly then?

@HaluskaR
Copy link
Author

@HaluskaR don't we need the append PR in first? To double check this will work properly then?

I believe the concern was that the append code was assuming some order in the record it was appending into, but that didn't look to be the case. If it's more that the appended order could introduce new curves that don't fit the dumped order (i.e. we dumped alphabetically to a record ending with the curve zebra_spottings, then appended in the curve apple_juice_consumption, and that would go in AFTER), I do believe that would be the case but would require a change on this PR, as right now any record node Sina's handed is assumed to be stored in oldest_first, so we'd need to shove in some metadata of our own.

This might be a bit of a YMMV if someone's planning to be constantly appending in new curves. In that case, if they want anything other than oldest first, I might consider that an issue for post processing; how can we know when a file's "done" from Sina's end?

Could definitely be overlooking a concern though, let me know!

@doutriaux1
Copy link
Contributor

You maybe right. I sort of remembered something about asking for order that would be different from what's in the file in append mode, but I think you're right for json we will rewrite the whole file anyway so we can change the order and for hdf5 I don't think the order matters. Does the HDF5 dump does anything in particular for the ordering? If not we're probably good, but I'd like to be sure firs.t

@kennyweiss
Copy link
Member

@kennyweiss We're good on reviews from our side.

Thanks -- in that case, could @doutriaux1 and/or @bgunnar5 please approve the PR?

Copy link
Member

@kennyweiss kennyweiss left a comment

Choose a reason for hiding this comment

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

Thanks @HaluskaR !

Please update the RELEASE_NOTES, and mention any API changes that users should be aware of.

{
auto &curveName = curve.getName();
auto existing = curves.find(curveName);
if(existing == curves.end())
{
curves.insert(std::make_pair(curveName, curve));
nameList.emplace_back(curveName);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be push_back since presumably, curveName still belongs to curve ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants