• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

spedas / pyspedas / 25194239086

26 Apr 2026 08:07PM UTC coverage: 61.697% (-28.8%) from 90.54%
25194239086

push

github

jameswilburlewis
Added test for loading Cluster CODIF differential energy flux

0 of 7 new or added lines in 1 file covered. (0.0%)

19460 existing lines in 418 files now uncovered.

30204 of 48955 relevant lines covered (61.7%)

1.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.87
/pyspedas/tplot_tools/convert_tplotxarray_to_pandas_dataframe.py
1
# Copyright 2018 Regents of the University of Colorado. All Rights Reserved.
2
# Released under the MIT license.
3
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
4
# Verify current version before use at: https://github.com/MAVENSDC/PyTplot
5

6
import datetime
3✔
7
import numpy as np
3✔
8
from dateutil.parser import parse
3✔
9
import pyspedas
3✔
10
import copy
3✔
11

12

13
def convert_tplotxarray_to_pandas_dataframe(name, no_spec_bins=False):
3✔
14
    import pandas as pd
3✔
15
    # This function is not final, and will presumably change in the future
16
    # This function sums over all dimensions except for the second non-time one.
17
    # This collapses many dimensions into just a single "energy bin" dimensions
18

19
    matrix = pyspedas.tplot_tools.data_quants[name].values
3✔
20
    while len(matrix.shape) > 3:
3✔
21
        matrix = np.nansum(matrix, 3)
×
22
    if len(matrix.shape) == 3:
3✔
23
        matrix = np.nansum(matrix, 1)
×
24
    return_data = pd.DataFrame(matrix)
3✔
25
    return_data = return_data.set_index(pd.Index(pyspedas.tplot_tools.data_quants[name].coords['time'].values))
3✔
26

27
    if no_spec_bins:
3✔
28
        return return_data
3✔
29

UNCOV
30
    if 'spec_bins' in pyspedas.tplot_tools.data_quants[name].coords:
×
UNCOV
31
        spec_bins = pd.DataFrame(pyspedas.tplot_tools.data_quants[name].coords['spec_bins'].values)
×
UNCOV
32
        if len(pyspedas.tplot_tools.data_quants[name].coords['spec_bins'].shape) == 1:
×
33
            spec_bins = spec_bins.transpose()
×
34
        else:
UNCOV
35
            spec_bins = spec_bins.set_index(pd.Index(pyspedas.tplot_tools.data_quants[name].coords['time'].values))
×
36

UNCOV
37
        return return_data, spec_bins
×
38

39
    return return_data
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc