Skip to content

ae9ap9 plotSpectrogram doesn't work with non-default pvars #781

Open
@jtniehof

Description

plotSpectrogram accepts pvars to plot something other than fluence as a function of time and L. But it does all the binning off L and Epoch regardless.

Minimal example to reproduce issue:

import spacepy.ae9ap9
# using data from tests directory
ans = spacepy.ae9ap9.readFile('data/Run1.AE9.CLoutput_mc_fluence_agg_pctile_75.txt')
ans.plotSpectrogram(pvars=['Energy', 'Fluence', 'Lm'])

Error message/Traceback:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~/scm/spacepy/spacepy/ae9ap9.py in plotSpectrogram(self, ecol, pvars, **kwargs)
    272         try:
--> 273             sd['1D_dataset'] = self[varname][goodidx,ecol] #TODO: assumes 1 pitch angle, generalize
    274         except IndexError: #1-D

IndexError: boolean index did not match indexed array along dimension 0; dimension is 121 but corresponding boolean dimension is 21

During handling of the above exception, another exception occurred:

IndexError                                Traceback (most recent call last)
<ipython-input-3-913730e8e3a2> in <module>
----> 1 ans.plotSpectrogram(pvars=['Energy', 'Fluence', 'Lm'])

~/scm/spacepy/spacepy/ae9ap9.py in plotSpectrogram(self, ecol, pvars, **kwargs)
    273             sd['1D_dataset'] = self[varname][goodidx,ecol] #TODO: assumes 1 pitch angle, generalize
    274         except IndexError: #1-D
--> 275             sd['1D_dataset'] = self[varname][goodidx]
    276         bins = [[],[]]
    277         if 'tbins' not in kwargs:

IndexError: boolean index did not match indexed array along dimension 0; dimension is 121 but corresponding boolean dimension is 21

There are likely other issues

OS, Python version, and dependency version information:

Linux-5.15.0-113-generic-x86_64-with-glibc2.35
sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)
numpy=1.21.5
scipy=1.8.0
matplotlib=3.5.1

Version of SpacePy

Current main (581ecbb); 0.7.0a0

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions