Skip to content

ValueError on DataSet downsample #7

Description

@Nschanche

I have created a DataSet from a TESS tpf that contains DataCubes, ErrorCubes, and several time_indices. When I try to downsample, I get the following error:

ValueError                                Traceback (most recent call last)
Cell In[63], line 1
----> 1 tpf.data_cubes.downsample(100)

File ~/TESS_GI/secret/src/lkdata/dataset.py:565, in DataSet.downsample(self, nframes, level)
    563 """Downsample all contained data and error products."""
    564 downsample = self._batch_wrapper("downsample")
--> 565 return downsample(nframes, level)

File ~/TESS_GI/secret/src/lkdata/dataset.py:553, in DataSet._batch_wrapper.<locals>.new_func(*args, **kwargs)
    551 for key, val in newdata.items():
    552     obj_func = getattr(val, func)
--> 553     newdata[key] = obj_func(*args, **kwargs)
    555 for key, val in newerror.items():
    556     obj_func = getattr(val, func)

File ~/TESS_GI/secret/src/lkdata/mixins.py:222, in AggMixin.downsample(self, nframes, level)
    220 # Find the average spacing of the index
    221 dt = np.median(np.diff(index)) * nframes
--> 222 nbins = int(np.ceil((index.max() - index.min()) / dt) + 1)
    223 # Calculate what bin edges result in this spacing
    224 bins = np.arange(index.min(), index.min() + nbins * dt, dt)

ValueError: cannot convert float NaN to integer

There are a few nans in the time index that were present in the fits file; however, I think DataSet should be able to handle nans (possibly by removing them before the downsample).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions