Produced by IDL 7.1.1
Developer Documentation

./toolbox/io
io_sdfits_writer__define.pro

IO
|
+-IO_SDFITS
  |
  +-IO_SDFITS_LINE
    |
    +-io_sdfits_writer

All known superclasses:
IO_SDFITS_LINE, IO_SDFITS, IO
Last modification date:
Wed Sep 28 13:27:14 2016

IO_SDFITS_WRITER is intended for use by users who wish to write spectral line data to sdfits. See UML for all IO Classes, or IO_SDFITS UML for just the line and continuum sdfits classes.

Routine Summary  26 routines

procedure io_sdfits_writer__define

IO_SDFITS_WRITER is intended for use by users who wish to write spectral line data to sdfits.

function IO_SDFITS_WRITER::init()

private

Class Constructor

procedure IO_SDFITS_WRITER::cleanup

private

Class Destructor

procedure IO_SDFITS_WRITER::set_output_file, file_name

Sets the name of the output file, and if the file exists, creates an sdfits object for it

procedure IO_SDFITS_WRITER::set_file, file_name, file_path=string, index_name=string

Sets the file which this object will exclusively be writing to and reading from.

procedure IO_SDFITS_WRITER::nsave_spectrum, spectrum, nsave[, status]

Writes a single spectrum to the sdfits file, saving an NSAVE number in the index file corresponding to this spectrum

function IO_SDFITS_WRITER::get_nsave_index(nsave)

procedure IO_SDFITS_WRITER::overwrite_spectrum, index, spectrum, status=status

procedure IO_SDFITS_WRITER::write_spectra, spectra, file_name=string

Writes given spectra to an sdfits file.

procedure IO_SDFITS_WRITER::write_rows_to_extension, rows, virtuals, ext, start_row

private

Writes sdfits rows to the output file, managing wether to create new extension, or append to current one

procedure IO_SDFITS_WRITER::update_index_with_spectra, spectra, extension, start_row

private

If these spectra have just been written to the output file-extension, then call this function to update the index file with the latest info

function IO_SDFITS_WRITER::get_uniques_string(arr)

private

Sorts input array, and then reduces sorted array to unique values.

function IO_SDFITS_WRITER::check_spectrum_size_uniformity(spectra)

private

Goes through array of spectrum data containers and checks to see if they all have the same data length.

function IO_SDFITS_WRITER::spectra_to_rows(spectra, virtuals)

private

Translates an array of spectra into sdfits rows

function IO_SDFITS_WRITER::spectrum_to_row(spec, virtuals, [data_mode=long])

private

Translates a spectrum data container into a structure that mirrors the sdfits (v1.

function IO_SDFITS_WRITER::get_sdfits_row_sizes()

private

Returns sizes needed for ASCII columns in sdfits.

function IO_SDFITS_WRITER::define_sdfits_row(data_points)

private

Defines an anonymous structure that can be used with mrdfits to write an sdfits row

function IO_SDFITS_WRITER::buffer_string(str, length)

private

Crops or pads the input string to exactly the length specified

function IO_SDFITS_WRITER::create_obsmode(proc, swstate, swtchsig)

private

Creates sdfits obsmode column value from the procedure, switch state, and switch signal obsmode = 'procedure:switchstate:swtchsig'

function IO_SDFITS_WRITER::coord_types_from_mode(mode)

private

Tranlate coordinate mode to the two values needed for long.

function IO_SDFITS_WRITER::translate_bool_int(bool_int)

private

converts spectrums integer value for columns such as cal or sig to ascii value used in sdfits

function IO_SDFITS_WRITER::pol_to_sdfits(pol)

private

Translates char polarization used by spectrum data container to integer values used by sdfits

function IO_SDFITS_WRITER::frequency_type_to_ctype1(freq_type)

private

Translates spectrum data container representation of frequency type to rep used by sdfits.

procedure IO_SDFITS_WRITER::set_sprotect_on

Sets index file so nsave numbers cannot be overwritten

procedure IO_SDFITS_WRITER::set_sprotect_off

Sets index file so nsave numbers can be overwritten

function IO_SDFITS_WRITER::get_sprotect()

Retrieves the state of nsave protection

Routine Details

io_sdfits_writer__define

procedure io_sdfits_writer__define

IO_SDFITS_WRITER is intended for use by users who wish to write spectral line data to sdfits. See UML for all IO Classes, or IO_SDFITS UML for just the line and continuum sdfits classes.

Inherits
io_sdfits_line

IO_SDFITS_WRITER::init private

function IO_SDFITS_WRITER::init()

Class Constructor

IO_SDFITS_WRITER::cleanup private

procedure IO_SDFITS_WRITER::cleanup

Class Destructor

IO_SDFITS_WRITER::set_output_file

procedure IO_SDFITS_WRITER::set_output_file, file_name

Sets the name of the output file, and if the file exists, creates an sdfits object for it

Uses
IO::file_exists IO_SDFITS::add_fits_obj

Parameters
file_name
in
string
full path name to the file to write to

IO_SDFITS_WRITER::set_file

procedure IO_SDFITS_WRITER::set_file, file_name, file_path=string, index_name=string

Sets the file which this object will exclusively be writing to and reading from. Acts much like IO_SDFITS::set_file in the way it forces creation of a new index file

Uses
IO_SDFITS::set_file_path IO_SDFITS_LINE::set_file IO_SDFITS::set_index_file_name IO_SDFITS::free_fits_objs

Parameters
file_name
in
string
file name (full path or not) of file to use exclusively

Keywords
file_path
in
string
file path where file_name is found
index_name
in
string
name to use for the index file

IO_SDFITS_WRITER::nsave_spectrum

procedure IO_SDFITS_WRITER::nsave_spectrum, spectrum, nsave[, status]

Writes a single spectrum to the sdfits file, saving an NSAVE number in the index file corresponding to this spectrum

Uses
get_nsave_index write_spectra overwrite_spectra

Parameters
spectrum
in, required
struct
the spectral line data container to be written
nsave
in, required
long
the integer identifier to associate with this spectrum
status
in, optional
long
set to 0 or 1 for failure or success

IO_SDFITS_WRITER::get_nsave_index

function IO_SDFITS_WRITER::get_nsave_index(nsave)

Parameters
nsave
.

IO_SDFITS_WRITER::overwrite_spectrum

procedure IO_SDFITS_WRITER::overwrite_spectrum, index, spectrum, status=status

Parameters
index
.
spectrum
.

Keywords
status
.

IO_SDFITS_WRITER::write_spectra

procedure IO_SDFITS_WRITER::write_spectra, spectra, file_name=string

Writes given spectra to an sdfits file. The spectra are translated to their proper form for sdfits, and the rows are written to the output file in extensions based off the data size of each spectrum.

Uses
IO_SDFITS_WRITER::set_output_file IO_SDFITS_WRITER::check_spectrum_size_uniformity IO_SDFITS_WRITER::spectra_to_rows IO_SDFITS_WRITER::write_rows_to_extension IO_SDFITS_WRITER::update_index_with_spectra

Parameters
spectra
in
array
array of spectrum data containers to write to disk

Keywords
file_name
in
string
if passed in, this is the name of the output file

IO_SDFITS_WRITER::write_rows_to_extension private

procedure IO_SDFITS_WRITER::write_rows_to_extension, rows, virtuals, ext, start_row

Writes sdfits rows to the output file, managing wether to create new extension, or append to current one

Parameters
rows
in
array
array of structs mirroring sdfits rows to be written
virtuals
in
struct
structure containing keyword-values of keywords in extension header to be written
ext
out
variable
extension that these rows get written to
start_row
out
variable
row at which these new rows will start getting written to in the extension, equal to the number of rows in extension before new rows are written

IO_SDFITS_WRITER::update_index_with_spectra private

procedure IO_SDFITS_WRITER::update_index_with_spectra, spectra, extension, start_row

If these spectra have just been written to the output file-extension, then call this function to update the index file with the latest info

Uses
IO_SDFITS_WRITER::get_uniques_string INDEX_FILE::is_file_loaded INDEX_FILE::new_file LINE_INDEX::udpate_with_spectra INDEX_FILE::read_file

Parameters
spectra
in
array
array of spectrum data containers that were just written to the output file
extension
in
long
the extension that just got written to
start_row
in
long
the row that the spectra started getting written to, should equal the current number of rows in extension

IO_SDFITS_WRITER::get_uniques_string private

function IO_SDFITS_WRITER::get_uniques_string(arr)

Sorts input array, and then reduces sorted array to unique values. Unique values are then put in a comma separated string

Returns
comma separated string of unique values in input array

Parameters
arr
in
array
array to find uniques of

IO_SDFITS_WRITER::check_spectrum_size_uniformity private

function IO_SDFITS_WRITER::check_spectrum_size_uniformity(spectra)

Goes through array of spectrum data containers and checks to see if they all have the same data length.

Returns
0,1

Parameters
spectra
in
array
array of spectrum data containers

IO_SDFITS_WRITER::spectra_to_rows private

function IO_SDFITS_WRITER::spectra_to_rows(spectra, virtuals)

Translates an array of spectra into sdfits rows

Returns
array of structures that mirror the sdfits rows to be written
Uses
IO_SDFITS_WRITER::define_sdfits_row IO_SDFITS_WRITER::spectrum_to_row

Parameters
spectra
in
array
array of spectrum data containers
virtuals
out
variable
keywords to be written to the file-extension header

IO_SDFITS_WRITER::spectrum_to_row private

function IO_SDFITS_WRITER::spectrum_to_row(spec, virtuals, [data_mode=long])

Translates a spectrum data container into a structure that mirrors the sdfits (v1.2) row to be written

Returns
structure that mirrors the sdfits row to be written
Uses
IO_SDFITS_WRITER::define_sdfits_row IO_SDFITS_WRITER::get_sdfits_row_sizes IO_SDFITS_WRITER::buffer_string IO_SDFITS_WRITER::frequency_type_to_ctype1 IO_SDFITS_WRITER::coord_types_from_mode IO_SDFITS_WRITER::pol_to_sdfits IO_SDFITS_WRITER::create_obsmode IO_SDFITS_WRITER::translate_bool_int makefitsdate

Parameters
spec
in
struct
spectrum data container to translate
virtuals
out
variable
keywords to be written to the sdfits extension header

Keywords
data_mode
in, optional
long
determines what data mode sdfits to be written in (not set uses raw mode)

IO_SDFITS_WRITER::get_sdfits_row_sizes private

function IO_SDFITS_WRITER::get_sdfits_row_sizes()

Returns sizes needed for ASCII columns in sdfits. Problems: this exists here AND in IO_SDFITS_WRITER.

Returns
structure with sizes for ASCII columsn in sdfits

IO_SDFITS_WRITER::define_sdfits_row private

function IO_SDFITS_WRITER::define_sdfits_row(data_points)

Defines an anonymous structure that can be used with mrdfits to write an sdfits row

Returns
anonymous structure that can be used with mrdfits to write an sdfits row
Uses
SDFITS::define_sdfits_row

Parameters
data_points
in
long
the size of the data array in data column

IO_SDFITS_WRITER::buffer_string private

function IO_SDFITS_WRITER::buffer_string(str, length)

Crops or pads the input string to exactly the length specified

Returns
The input string, cropped or padded to specified length

Parameters
str
in
string
string to buffer
length
in
long
length that string should be buffered to

IO_SDFITS_WRITER::create_obsmode private

function IO_SDFITS_WRITER::create_obsmode(proc, swstate, swtchsig)

Creates sdfits obsmode column value from the procedure, switch state, and switch signal obsmode = 'procedure:switchstate:swtchsig'

Returns
obsmode

Parameters
proc
in
string
procedure
swstate
in
string
switch state
swtchsig
in
string
switch signal

IO_SDFITS_WRITER::coord_types_from_mode private

function IO_SDFITS_WRITER::coord_types_from_mode(mode)

Tranlate coordinate mode to the two values needed for long. type and lat. type

Examples
case mode of 'RADEC': value = ['RA ','DEC '] 'GALACTIC': value = ['GLON','GLAT'] 'HADEC': value = ['HA ','DEC '] 'AZEL': value = ['AZ ','EL '] 'OTHER': value = ['OLON','OLAT'] else: value = ['OLON','OLAT'] endcase

Parameters
mode
.

IO_SDFITS_WRITER::translate_bool_int private

function IO_SDFITS_WRITER::translate_bool_int(bool_int)

converts spectrums integer value for columns such as cal or sig to ascii value used in sdfits

Returns
'T' or 'F'

Parameters
bool_int
in
long
0 or 1

IO_SDFITS_WRITER::pol_to_sdfits private

function IO_SDFITS_WRITER::pol_to_sdfits(pol)

Translates char polarization used by spectrum data container to integer values used by sdfits

Returns
integer rep of polarization

Parameters
pol
in
string
char representation of polarization

IO_SDFITS_WRITER::frequency_type_to_ctype1 private

function IO_SDFITS_WRITER::frequency_type_to_ctype1(freq_type)

Translates spectrum data container representation of frequency type to rep used by sdfits. See comments in IO_SDFITS::format_sdfits_freq_type

Returns
sdfits rep of frequency type (ctype1)

Parameters
freq_type
in
string
rep of frequency type

IO_SDFITS_WRITER::set_sprotect_on

procedure IO_SDFITS_WRITER::set_sprotect_on

Sets index file so nsave numbers cannot be overwritten

IO_SDFITS_WRITER::set_sprotect_off

procedure IO_SDFITS_WRITER::set_sprotect_off

Sets index file so nsave numbers can be overwritten

IO_SDFITS_WRITER::get_sprotect

function IO_SDFITS_WRITER::get_sprotect()

Retrieves the state of nsave protection

Returns
0 - nsave numbers cannot be overwritten; 1 - they cannot be overwritten


Produced by IDLdoc 1.6 on Wed Sep 28 13:27:29 2016