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

user_info: extension to matrix as input #95

Open
PeOpPVA opened this issue Aug 30, 2021 · 2 comments
Open

user_info: extension to matrix as input #95

PeOpPVA opened this issue Aug 30, 2021 · 2 comments

Comments

@PeOpPVA
Copy link

PeOpPVA commented Aug 30, 2021

Hi Team!
I would have a question/request: i have a function that requires a matrix as an input for the user_info parameter (a function that depends on x1 and x2). Do you have an example that already includes that case or suggestions how to modify for instance the linear regression as a starting point.
Thx for your help.
Cheers

@jkfindeisen
Copy link
Collaborator

A matrix (2D array) is used as input for example in the 2D Gaussian peak model functions. There the 3D index into the 2D array is simply linearized in a suitable way, e.g. for a 100,000 fits of a 7x7 pixel image patch each with model 2D Gaussian, you simply provide the input data as one big linear array of 4.9 million elements (49x100,000). The 7x7 pixel patch is simply flattened. See the Matlab or Python or C++ 2D fitting examples about it.

You can do the same with the user info. The user info is simply a pointer to a chunk of memory. The interpretation of that memory is up to your model implementation and you could do the same that is done for 2D data also within the user info.

Another example of that are the spline models. The coefficients array for the spline models are actually even higher dimensional (up to four dimensional) and they are given in the user info and processed within the spline models. Again have a look at the Matlab and Python spline examples and then also look into the Spline model implementations.

@PeOpPVA
Copy link
Author

PeOpPVA commented Aug 31, 2021

Great thx for the prompt response

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

No branches or pull requests

2 participants