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

Non uniformely spaced interpolation grid #1147

Open
terliuk opened this issue Mar 29, 2023 · 1 comment
Open

Non uniformely spaced interpolation grid #1147

terliuk opened this issue Mar 29, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@terliuk
Copy link
Contributor

terliuk commented Mar 29, 2023

**Describe **
In current implementation of interpolation maps with grids, we allow setting either list of points or np.linspace arguments

straxen/straxen/itp_map.py

Lines 121 to 129 in 25e70e3

elif isinstance(csys[0][0], str):
# Support for specifying coordinate system as a gridspec
grid = [np.linspace(left, right, points)
for _, (left, right, points) in csys]
csys = np.array(np.meshgrid(*grid, indexing='ij'))
axes = np.roll(np.arange(len(grid) + 1), -1)
csys = np.transpose(csys, axes)
csys = np.array(csys).reshape((-1, len(grid)))
self.dimensions = len(grid)
,
this prevents us from giving non-uniform binning, or mix of uniform and not uniform.

For example, something like :

{...
    'coordinate_system' : [ 
          ["a", [0.0, 10.0, 101] ] , 
          ["b", [0.0, 10., 20., 30.,40.,41, 42, 43, 44, 45, 46, 47,48,49, 50] ] 
     ],  
...}

where for b i give interpolation centers. Such way, we can make a variably spaced interpolation, what can help to reduce size of maps. For example, when there is a predominantly smooth parameter with a rapidly changing values in limited regions (R, Z, energy etc) .

@terliuk terliuk added the enhancement New feature or request label Mar 29, 2023
@terliuk terliuk changed the title Non uniformely spaced grids Non uniformely spaced interpolation grid Mar 29, 2023
@dachengx dachengx self-assigned this Mar 30, 2023
@dachengx
Copy link
Collaborator

dachengx commented Apr 2, 2023

Hey @terliuk. Nice idea! To avoid misunderstandings. Would you please provide a map with your mentioned coordinate_system for testing? Thanks!

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