ICSM / pgmuvi

Python gaussian processes for inference on multi-wavelength light curves
https://pgmuvi.readthedocs.io
GNU General Public License v3.0
12 stars 6 forks source link

[BUG] Warning for return statement in `get_periods` method #36

Open sundarjhu opened 10 months ago

sundarjhu commented 10 months ago

Describe the bug

/Volumes/SSD2TBShaanpatiKhan/MovedHomeFolder/sundar/work/pgmuvi/pgmuvi/lightcurve.py:1349: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_new.cpp:248.)
  return torch.as_tensor(periods), torch.as_tensor(weights), torch.as_tensor(scales)  # noqa: E501

While weights is a list of torch.Tensors, periods and scales are lists of np.ndarrays, which seems to be source of the warning.

To Reproduce Fitting a 300-element light curve resulted in this warning.

Fix adding the following lines before the return statement seems to fix things:

periods = np.array(periods)
scales = np.array(scales)