Inputs#

pyxel.load_image(filename)[source]#

Load a 2D image.

Parameters:

filename (str or Path) – Filename to read an image. {.npy, .fits, .txt, .data, .jpg, .jpeg, .bmp, .png, .tiff} are accepted.

Returns:

ndarray – A 2D array.

Raises:
  • FileNotFoundError – If an image is not found.

  • ValueError – When the extension of the filename is unknown or separator is not found.

Examples

>>> from pyxel import load_image
>>> load_image("frame.fits")
array([[-0.66328494, -0.63205819, ...]])
>>> load_image("https://hostname/folder/frame.fits")
array([[-0.66328494, -0.63205819, ...]])
>>> load_image("another_frame.npy")
array([[-1.10136521, -0.93890239, ...]])
>>> load_image("rgb_frame.jpg")
array([[234, 211, ...]])
pyxel.load_header(filename, section=None)[source]#

Load and return header information from a file.

Parameters:
  • filename (str or Path,) – Path to the file from which to load the header.

  • section (int, str or None, optional) – Specifies the section of the file to extract the header.

Returns:

dict or None – A dictionary containing header information

Examples

>>> load_header("image.fits", section="RAW")
CRPIX1  =      1024.6657050959 / Pixel coordinate of reference point
CRPIX2  =      1024.6657050959 / Pixel coordinate of reference point
PC1_1   =                 -1.0 / Coordinate transformation matrix element
pyxel.load_table(filename, header=False, dtype='float')[source]#

Load a table from a file and returns a pandas dataframe. No header is expected in xlsx.

Parameters:
  • filename (str or Path) – Filename to read the table. {.npy, .xlsx, .csv, .txt., .data} are accepted.

  • header (bool, default: False) – Remove the header.

  • dtype

Returns:

DataFrame

Raises:
  • FileNotFoundError – If an image is not found.

  • ValueError – When the extension of the filename is unknown or separator is not found.