Skip to content

PowerSpectrum requires a header when loading a Numpy array (turbustat version 1.3) #254

@ttepperg

Description

@ttepperg

Although the documentation states that the header keyword is optional, when loading a pure Numpy 2D array, the code
fails with:

Traceback (most recent call last):
File "", line 1, in
File "/Users/tepper/Library/Python/3.9/lib/python/site-packages/turbustat/statistics/pspec_bispec/pspec.py", line 44, in init
self.input_data_header(img, header, need_copy=False)
File "/Users/tepper/Library/Python/3.9/lib/python/site-packages/turbustat/statistics/base_statistic.py", line 121, in input_data_header
raise ValueError("When data is given as a numpy array, a FITS "
ValueError: When data is given as a numpy array, a FITS header must be given using the header keyword argument.

Error reproducible with the following code snippet:

import numpy as np
from turbustat.statistics import PowerSpectrum

image = np.zeros((1000,1000))
image[::2,::2] = 1.

pspec = PowerSpectrum(image) # fails

Metadata

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