Skip to content

Error with the notebook 3a_rpw_tnr_data_tutorial.ipynb #35

@MohamedNedal

Description

@MohamedNedal

Hello, I have followed the installation instructions, and I got the following error while plotting the RPW dynamic spectrum:

# 3a. Plot data "as is" (i.e., without any post-processing or filters)
fig, ax = plt.subplots(figsize=(10, 5))
# Define plot main title
#fig.suptitle("RPW Tuto")
fig.tight_layout()
cbar_ax, kw = cbar.make_axes(ax, shrink=1.4)
# plot AUTO
plot_auto(tnr_data, ax=ax, figure=fig, cbar_ax=cbar_ax)
# Define plot subtitle
ax.set_title('RPW TNR auto-correlation data from ' + filepath.name)
plt.show()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/.conda/envs/solo8/lib/python3.9/site-packages/xarray/core/dataset.py:1340, in Dataset._construct_dataarray(self, name)
   1339 try:
-> 1340     variable = self._variables[name]
   1341 except KeyError:

KeyError: 'VOLTAGE_SPECTRAL_POWER'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
Cell In[5], line 8
      6 cbar_ax, kw = cbar.make_axes(ax, shrink=1.4)
      7 # plot AUTO
----> 8 plot_auto(tnr_data, ax=ax, figure=fig, cbar_ax=cbar_ax)
      9 # Define plot subtitle
     10 ax.set_title('RPW TNR auto-correlation data from ' + filepath.name)

File ~/.conda/envs/solo8/lib/python3.9/site-packages/maser/plot/rpw/tnr.py:21, in plot_auto(data_wrapper, ax, sensor, bands, cbar_ax, **kwargs)
     18 if cbar_ax is None:
     19     cbar_ax, kw = cbar.make_axes(ax)
---> 21 auto = data_wrapper.as_xarray()["VOLTAGE_SPECTRAL_POWER"]
     23 # keep only V1-V2 sensor
     24 v1_v2_auto = auto.where(auto.sensor == sensor, drop=True)

File ~/.conda/envs/solo8/lib/python3.9/site-packages/xarray/core/dataset.py:1431, in Dataset.__getitem__(self, key)
   1429     return self.isel(**key)
   1430 if utils.hashable(key):
-> 1431     return self._construct_dataarray(key)
   1432 if utils.iterable_of_hashable(key):
   1433     return self._copy_listed(key)

File ~/.conda/envs/solo8/lib/python3.9/site-packages/xarray/core/dataset.py:1342, in Dataset._construct_dataarray(self, name)
   1340     variable = self._variables[name]
   1341 except KeyError:
-> 1342     _, name, variable = _get_virtual_variable(self._variables, name, self.dims)
   1344 needed_dims = set(variable.dims)
   1346 coords: dict[Hashable, Variable] = {}

File ~/.conda/envs/solo8/lib/python3.9/site-packages/xarray/core/dataset.py:178, in _get_virtual_variable(variables, key, dim_sizes)
    176 split_key = key.split(".", 1)
    177 if len(split_key) != 2:
--> 178     raise KeyError(key)
    180 ref_name, var_name = split_key
    181 ref_var = variables[ref_name]

KeyError: 'VOLTAGE_SPECTRAL_POWER'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions