Skip to content
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

Attach scaling factor (and scaling uncertainty) to dataset #124

Open
toqduj opened this issue Oct 13, 2022 · 2 comments
Open

Attach scaling factor (and scaling uncertainty) to dataset #124

toqduj opened this issue Oct 13, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@toqduj
Copy link

toqduj commented Oct 13, 2022

I know discussions on this have already started, but for mutliple reasons, it would be good to be able to attach a scaling factor (with its own scaling uncertainty) to a dataset/array.

Doing so would allow:

  • application of simple scaling operations to the scaling factor first, instead of to the array, followed by a later step "apply scaling", which will reset the scaling factor back to 1, but will still maintain a meaningful scaling uncertainty
  • the clear separation of scaling uncertainties from inter-datapoint uncertainties. This helps, as scaling uncertainties can easily be on the order of 10%, whereas inter-datapoint uncertainties can be much, much smaller.
@garryod garryod self-assigned this Oct 17, 2022
@garryod garryod added the enhancement New feature or request label Oct 17, 2022
@garryod
Copy link
Member

garryod commented Oct 17, 2022

Hi Brian,

I like the idea of being able to separate scaling (and the associated uncertainties) from other pixel-wise operations, though doing this in a clean way may prove difficult:

  1. The data array is wrapped in some object like below:
        @dataclass
        class ScalableArray(Generic[T]):
            data: ndarray[Any, T]
            scale_factor: T
    with each method requiring knowledge of the structure of this ScalableArray
  2. Have methods produce some scaling metadata which can be applied to an independent variable to track scaling

It is possible we may be able to create something which looks like 1 but which implements the numpy array interface, though this I cannot say for certain at the moment

@toqduj
Copy link
Author

toqduj commented Oct 17, 2022

Yes, this goes a bit beyond my expertise, but I hope inspiration will strike at some point and you'll come up with something pretty yet robust..

Is it an option to overload the mul and div operations of the scalableArray data class, so that when "other" is an array, it operates on the array, but when it's a scalar, it operates on the scale factor instead? repr can return the array multiplied by its scale factor.

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

No branches or pull requests

2 participants