• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

spedas / pyspedas / 26171438601

20 May 2026 02:07AM UTC coverage: 90.571% (+0.01%) from 90.557%
26171438601

push

github

jameswilburlewis
Fix crash when a spectrogram is plotted with Y axis interpolation is enabled and Y scaling is linear.
Add regression test for y_interp bug.

0 of 4 new or added lines in 2 files covered. (0.0%)

17831 existing lines in 383 files now uncovered.

44379 of 48999 relevant lines covered (90.57%)

1.43 hits per line

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

77.78
/pyspedas/tplot_tools/tplot_math/derive.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 pyspedas
2✔
7
from pyspedas.tplot_tools import store_data
2✔
8
import numpy as np
2✔
9
import copy
2✔
10
import logging
2✔
11

12
def derive(tvar,newname=None):
2✔
13
    """
14
    Takes the derivative of the tplot variable.
15

16
    Parameters
17
    ----------
18
        tvar : str
19
            Name of tplot variable.
20
        newname : str
21
            Name of new tplot variable.  If not set, then the data in tvar is replaced.
22

23
    Returns
24
    -------
25
        None
26

27
    Examples
28
    --------
29

30
        >>> pyspedas.store_data('b', data={'x':[2,5,8,11,14,17,20], 'y':[[1,1,1,1,1,1],[2,2,5,4,1,1],[100,100,3,50,1,1],[4,4,8,58,1,1],[5,5,9,21,1,1],[6,6,2,2,1,1],[7,7,1,6,1,1]]})
31
        >>> pyspedas.derive('b','dbdt')
32

33
    """
34

UNCOV
35
    a = pyspedas.tplot_tools.data_quants[tvar].differentiate('time')
1✔
UNCOV
36
    if newname is None:
1✔
37
        a.name = tvar
×
38
        a.attrs = copy.deepcopy(pyspedas.tplot_tools.data_quants[tvar].attrs)
×
39
        pyspedas.tplot_tools.data_quants[tvar] = a
×
40
    else:
UNCOV
41
        data = {'x':a.coords['time'], 'y':a.values * 1e09}  # Internal time in units of nanoseconds
1✔
UNCOV
42
        for coord in a.coords:
1✔
UNCOV
43
            if coord != 'time' and coord != 'spec_bins':
1✔
44
                data[coord] = a.coords[coord].values
×
45

UNCOV
46
        store_data(newname, data=data)
1✔
UNCOV
47
        pyspedas.tplot_tools.data_quants[newname].attrs = copy.deepcopy(pyspedas.tplot_tools.data_quants[tvar].attrs)
1✔
48

UNCOV
49
    return
1✔
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