home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 207283854

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
207283854 MDU6SXNzdWUyMDcyODM4NTQ= 1265 variable length of a dimension in DataArray 6897215 closed 0     7 2017-02-13T17:22:38Z 2020-12-26T15:05:59Z 2020-12-26T15:05:59Z NONE      

I am having the following issue, say I have this code where I find eigenvalues of some system composed of the variables A, B, C, and D.

In my example the number of eigenvalues (num_eigs) is constant.

However, in general this number is not constant. Is there a way in xarray to handle this issue?

``` import numpy as np import xarray as xr A = np.linspace(0, 40, 10) B = np.linspace(0, 1, 20) C = np.linspace(0, 1, 30) D = np.linspace(-3, 3, 40)

num_eigs = 4

pretend like this is taking the eigenvalues of a matrix composed with A, B, C, and D

res = np.random.rand(len(A), len(B), len(C), len(D), num_eigs)

now I need to set the last dimension to range(res.shape[-1]))

da = xr.DataArray(res, coords= [('A', A), ('B', B), ('C', C), ('D', D), ('eig', range(res.shape[-1]))]) ```

For those that ask why I would need this: I do numerics in quantum mechanics and create quantum systems with certain parameters. Some of these parameters could be the system size. This would result in different Hamiltonians (a matrix describing the system) and therefore in a different number of eigenvalues.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1265/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 7 rows from issue in issue_comments
Powered by Datasette · Queries took 0.561ms · About: xarray-datasette