Struct fitsio::fitsfile::FitsHdu
[−]
[src]
pub struct FitsHdu { pub info: HduInfo, // some fields omitted }
Struct representing a FITS HDU
Fields
info: HduInfo
Information about the current HDU
Methods
impl FitsHdu
[src]
pub fn name(&self, fits_file: &mut FitsFile) -> Result<String>
[src]
Read the HDU name
pub fn read_key<T: ReadsKey>(
&self,
fits_file: &mut FitsFile,
name: &str
) -> Result<T>
[src]
&self,
fits_file: &mut FitsFile,
name: &str
) -> Result<T>
Read header key
pub fn write_key<T: WritesKey>(
&self,
fits_file: &mut FitsFile,
name: &str,
value: T
) -> Result<()>
[src]
&self,
fits_file: &mut FitsFile,
name: &str,
value: T
) -> Result<()>
Write a fits key to the current header
pub fn read_section<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
start: usize,
end: usize
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
start: usize,
end: usize
) -> Result<Vec<T>>
Read pixels from an image between a start index and end index
The range is exclusive of the upper value
pub fn read_rows<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
start_row: usize,
num_rows: usize
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
start_row: usize,
num_rows: usize
) -> Result<Vec<T>>
Read multiple rows from a fits image
pub fn read_row<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
row: usize
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
row: usize
) -> Result<Vec<T>>
Read a single row from a fits image
pub fn read_region<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
ranges: &[&Range<usize>]
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
ranges: &[&Range<usize>]
) -> Result<Vec<T>>
Read a square region from the chip.
Lower left indicates the starting point of the square, and the upper right defines the pixel beyond the end. The range of pixels included is inclusive of the lower end, and exclusive of the upper end.
pub fn read_image<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile
) -> Result<Vec<T>>
Read a whole image into a new Vec
This reads an entire image into a one-dimensional vector
pub fn write_section<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
start: usize,
end: usize,
data: &[T]
) -> Result<()>
[src]
&self,
fits_file: &mut FitsFile,
start: usize,
end: usize,
data: &[T]
) -> Result<()>
Write raw pixel values to a FITS image
If the length of the dataset exceeds the number of columns, the data wraps around to the next row.
The range is exclusive of the upper value.
pub fn write_region<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
ranges: &[&Range<usize>],
data: &[T]
) -> Result<()>
[src]
&self,
fits_file: &mut FitsFile,
ranges: &[&Range<usize>],
data: &[T]
) -> Result<()>
Write a rectangular region to the fits image
The ranges must have length of 2, and they represent the limits of each axis. The limits are inclusive of the lower bounds, and exclusive of the and upper bounds.
For example, writing with ranges 0..10 and 0..10 wries an 10x10 sized image.
pub fn write_image<T: ReadWriteImage>(
&self,
fits_file: &mut FitsFile,
data: &[T]
) -> Result<()>
[src]
&self,
fits_file: &mut FitsFile,
data: &[T]
) -> Result<()>
Write an entire image to the HDU passed in
Firstly a check is performed, making sure that the amount of data will fit in the image. After this, all of the data is written to the image.
pub fn resize(
self,
fits_file: &mut FitsFile,
new_size: &[usize]
) -> Result<FitsHdu>
[src]
self,
fits_file: &mut FitsFile,
new_size: &[usize]
) -> Result<FitsHdu>
Resize a HDU image
The new_size
parameter defines the new size of the image. Unlike cfitsio, the order
of the dimensions of new_size
follows the C convention, i.e. row-major
order.
pub fn copy_to(
&self,
src_fits_file: &mut FitsFile,
dest_fits_file: &mut FitsFile
) -> Result<()>
[src]
&self,
src_fits_file: &mut FitsFile,
dest_fits_file: &mut FitsFile
) -> Result<()>
Copy an HDU to another open fits file
pub fn insert_column(
self,
fits_file: &mut FitsFile,
position: usize,
description: &ConcreteColumnDescription
) -> Result<FitsHdu>
[src]
self,
fits_file: &mut FitsFile,
position: usize,
description: &ConcreteColumnDescription
) -> Result<FitsHdu>
Insert a column into a fits table
The column location is 0-indexed. It is inserted at that position, and the following columns are shifted back.
pub fn append_column(
self,
fits_file: &mut FitsFile,
description: &ConcreteColumnDescription
) -> Result<FitsHdu>
[src]
self,
fits_file: &mut FitsFile,
description: &ConcreteColumnDescription
) -> Result<FitsHdu>
Add a new column to the end of the table
pub fn delete_column<T: DescribesColumnLocation>(
self,
fits_file: &mut FitsFile,
col_identifier: T
) -> Result<FitsHdu>
[src]
self,
fits_file: &mut FitsFile,
col_identifier: T
) -> Result<FitsHdu>
Remove a column from the fits file
The column can be identified by id or name.
pub fn read_col<T: ReadsCol>(
&self,
fits_file: &mut FitsFile,
name: &str
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
name: &str
) -> Result<Vec<T>>
Read a subset of a fits column
The range is exclusive of the upper value
pub fn read_col_range<T: ReadsCol>(
&self,
fits_file: &mut FitsFile,
name: &str,
range: &Range<usize>
) -> Result<Vec<T>>
[src]
&self,
fits_file: &mut FitsFile,
name: &str,
range: &Range<usize>
) -> Result<Vec<T>>
Read a subset of a fits column
The range is exclusive of the upper value
pub fn write_col_range<T: WritesCol, N: Into<String>>(
&self,
fits_file: &mut FitsFile,
name: N,
col_data: &[T],
rows: &Range<usize>
) -> Result<FitsHdu>
[src]
&self,
fits_file: &mut FitsFile,
name: N,
col_data: &[T],
rows: &Range<usize>
) -> Result<FitsHdu>
Write data to part of a column
The range is exclusive of the upper value
pub fn write_col<T: WritesCol, N: Into<String>>(
&self,
fits_file: &mut FitsFile,
name: N,
col_data: &[T]
) -> Result<FitsHdu>
[src]
&self,
fits_file: &mut FitsFile,
name: N,
col_data: &[T]
) -> Result<FitsHdu>
Write data to an entire column
This default implementation does not check the length of the column first, but if the length of the data array is longer than the length of the table, the table will be extended with extra rows. This is as per the fitsio definition.
ⓘImportant traits for ColumnIterator<'a>pub fn columns<'a>(&self, fits_file: &'a mut FitsFile) -> ColumnIterator<'a>
[src]
Iterate over the columns in a fits file
pub fn delete(self, fits_file: &mut FitsFile) -> Result<()>
[src]
Delete the current HDU from the fits file.
Note this method takes self
by value, and as such the hdu cannot be used after this
method is called.
pub fn read_cell_value<T>(
&self,
fits_file: &mut FitsFile,
name: &str,
idx: usize
) -> Result<T> where
T: ReadsCol,
[src]
&self,
fits_file: &mut FitsFile,
name: &str,
idx: usize
) -> Result<T> where
T: ReadsCol,
Read a single value from a fits table
This will be inefficient if lots of individual values are wanted.
pub fn row<F>(&self, fits_file: &mut FitsFile, idx: usize) -> Result<F> where
F: FitsRow,
[src]
F: FitsRow,
Extract a single row from the file
This method uses returns a FitsRow
, which is provided by the user,
using a derive
implementation from the fitsio-derive
crate,
#[macro_use] extern crate fitsio_derive; extern crate fitsio; use fitsio::fitsfile::FitsRow; #[derive(Default, FitsRow)] struct Row { #[fitsio(colname = "intcol")] intfoo: i32, #[fitsio(colname = "strcol")] foobar: String, } // Pick the 4th row let row: Row = hdu.row(&mut f, 4).unwrap(); assert_eq!(row.intfoo, 16); assert_eq!(row.foobar, "value4");