|
Developer Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox/io io_sdfits__define.pro
IO | +-io_sdfits
IO_SDFITS is the base class for spectral line and continuum sdfits classes. All the general functionality for reading, writing, navigating sdfits files, and for; translating their info to data containers is placed in this class. See UML for all IO Classes, or IO_SDFITS UML for just the line and continuum sdfits classes.
Fields Summary | |
FILE_PATH |
The path in which index and sdfits files are to be found |
FITS_FILES |
An array of pointers to objects, one for each sdfits file |
INDEX |
Object which manages the index file |
INDEX_SYNCED |
Flag which signals wether index and fits files are in sync |
UPDATE_EXPANDED_FILES |
Flag determining wether index files are updated to keep in sink with an expanded fits file |
ONE_FILE |
Flag for determining if this object is locked into working with just one file |
OBSERVER |
should not be here? |
TCAL_TABLE |
should not be here? |
BACKEND |
should not be here? |
ONLINE |
. |
DEBUG |
Flag that determines the verbosity of object |
Fields inherited from IO: | ||
|
Routine Summary 60 routines |
procedure io_sdfits__define | |
IO_SDFITS is the base class for spectral line and continuum sdfits classes. |
function IO_SDFITS::init() | private |
Class Constructor. |
procedure IO_SDFITS::cleanup | private |
Class cleanup on deletion: cleans up index object and sdfits objects |
procedure IO_SDFITS::set_debug_on | |
The class can be made to verbosly describe what its doing |
procedure IO_SDFITS::set_debug_off | |
The class can be made to be quite |
procedure IO_SDFITS::set_project, dir, _EXTRA=_EXTRA | |
This method looks into the given directory and attempts to load any existing index file. |
procedure IO_SDFITS::set_file, file_name, file_path=string, index_name=string, online=online, _EXTRA=_EXTRA | |
This method can be used to lock the io object into working with only one sdfits file. |
procedure IO_SDFITS::add_file, file_name, /new_index, index_name=index_name | |
This method is the main interface to the sdfits io classes. |
procedure IO_SDFITS::init_index | private |
Creates a new index file using current info (file_path, observer, etc. |
procedure IO_SDFITS::load_index, file_name, file_path=string | |
This method will read an index file, check that the index agrees with the sdfits files on disk, and create fits objects for the files listed in its index. |
procedure IO_SDFITS::read_index, file_name | private |
Calls index file's read_file method |
procedure IO_SDFITS::add_fits_obj, file_name, _EXTRA=_EXTRA | private |
Creates a fits object for the file name passed to it, and adds it to the list of fits objects |
procedure IO_SDFITS::add_fits_objs, file_names | private |
From an array of full path names to sdfits files, create an array of sdfits objects |
procedure IO_SDFITS::create_index_file, index_file_name | private |
Creates a new index file, populating it with information from all the fits object |
function IO_SDFITS::conform_to_index() | private |
Checks to make sure index file that is loaded agrees with this object, and will create new sdfits objects if necessary to conform. |
procedure IO_SDFITS::conform_fits_objs_to_index | private |
Called after loading an index, gets all files in index and calls conform_fits_objs |
procedure IO_SDFITS::conform_fits_objs, file_names | private |
Checks that the list of file names passed to it are all represented by fits objects. |
function IO_SDFITS::get_full_file_name(file_name) | private |
Takes in a file name string and returns the full path, with prepended path if needed. |
procedure IO_SDFITS::set_file_path, file_path | |
Sets the path where index file and all sdfits files are to be found |
function IO_SDFITS::get_file_path() | |
Gets the path where index file and all sdfits files are to be found |
function IO_SDFITS::is_data_loaded() | |
Checks to see if this object has any sdfits files connected to it. |
procedure IO_SDFITS::set_index_file_name, file_name | |
Sets the file name of the index file. |
function IO_SDFITS::get_index_file_name([/full]) | |
Retrieves the file name of the index file. |
function IO_SDFITS::find_fits(file_name) | private |
Given the full path name of an sdfits file, returns the object that represents that file |
function IO_SDFITS::get_fits(file_name) | private |
function IO_SDFITS::get_number_extensions(file_name) | private |
Retrieves the number of extensions for the given sdfits file |
function IO_SDFITS::get_extension_type(ext_num, file_name) | private |
Retrieves the extension type for the given sdfits file and extension |
function IO_SDFITS::get_extension_name(ext_num, file_name) | private |
Retrieves the extension name for the given sdfits file and extension |
function IO_SDFITS::get_ext_num_rows(ext_num, file_name) | private |
Retrieves the number of rows for the given sdfits file and extension |
procedure IO_SDFITS::list[, start][, finish], [sortcol=string], _EXTRA=_EXTRA, /verbose, [/user], [columns=string array] | |
Prints out rows from the index file used by object. |
function IO_SDFITS::get_index(_EXTRA=_EXTRA) | |
Returns indicies of rows in index file that match search. |
function IO_SDFITS::get_scan_info(scan_number) | |
Returns a structure that contains info about the scan number given, such as scan number, procedure name, number of integrations, ifs, etc. |
procedure IO_SDFITS::list_index_header | |
Prints out the header section of the index file used by this object |
function IO_SDFITS::get_index_values(column_name, _EXTRA=_EXTRA) | |
Returns the values contained in the index file column used by this object |
function IO_SDFITS::get_index_files(_EXTRA=_EXTRA, full=full) | |
Returns the unique file names (no path) contained in the index file used by this object |
function IO_SDFITS::get_index_projects(_EXTRA=_EXTRA) | |
Returns the unique project names (no path) contained in the index file used by this object |
function IO_SDFITS::get_index_sources(_EXTRA=_EXTRA) | |
Returns the unique source names (no path) contained in the index file used by this object |
function IO_SDFITS::get_index_procedures(_EXTRA=_EXTRA) | |
Returns the unique procedure names (no path) contained in the index file used by this object |
function IO_SDFITS::get_index_scans(_EXTRA=_EXTRA) | |
Returns the unique scan names (no path) contained in the index file used by this object |
function IO_SDFITS::group_row_info(row_info) | private |
Groups rows from the index table and sorts them by file-extension, since if we read these rows we want to do that efficiently (one file-extension at a time). |
function IO_SDFITS::get_sdfits_rows(row_group) | private |
Deprecated function: given a listing of rows from the same file-extension, this uses an sdfits objects to simply return those rows from the file. |
function IO_SDFITS::get_and_eval_rows(row_group, missing, virtuals) | private |
Given a listing of rows from the same file-extension, this uses an sdfits object to simply return those rows from the file and evaluate what columns are missing and what are the keywords for the extension |
function IO_SDFITS::get_row_value(row, tag_name, virtuals, names, default_value) | private |
Method for attempting to extract a value from an sdfits row. |
function IO_SDFITS::format_sdfits_polarization(pol) | private |
Translates the polarization from the sdfits integer value into a char based value |
function IO_SDFITS::format_sdfits_freq_type(freq_type) | private |
Translates the sdfits string for frequency type to the gbtidl representation CTYPE1 has two parts: First 4 characters are the type of quantity on that axis. |
function IO_SDFITS::format_sdfits_procedure(obsmode) | private |
Deprecated |
procedure IO_SDFITS::parse_sdfits_obsmode, obsmode, proc, swstate, swtchsig | private |
Translates the sdfits value for obsmode into seperate procedure, switch state and switch signal values |
function IO_SDFITS::coord_mode_from_types(long_type, lat_type) | private |
Incomplete: Translates the sdfits values for longitutde and latitude type into a coordinate mode. |
function IO_SDFITS::translate_cal(cal) | private |
Translates sdfits cal string value into 1 or 0 |
function IO_SDFITS::translate_sig(sig) | private |
Translates sdfits sig string value into 1 or 0 |
procedure IO_SDFITS::free_fits_objs | private |
Releases the memory for all the current sdfits objects for this object |
procedure IO_SDFITS::set_debug_for_fits_objs, debug | private |
Sets debug flag for all fits objs |
function IO_SDFITS::are_index_file_indicies_unique() | |
Diagnostic function to determine if index file indicies are unique (as they should be) |
procedure IO_SDFITS::set_more_format_on | |
Sets the object to print rows using the interactive 'more' format |
procedure IO_SDFITS::set_more_format_off | |
Sets the object NOT to print rows using the interactive 'more' format |
procedure IO_SDFITS::list_available_columns | |
Prints the available columns from the rows section for list; these are also the valid search keywords |
procedure IO_SDFITS::set_user_columns, columns | |
Sets what columns should be used for user listing |
procedure IO_SDFITS::list_user_columns | |
Prints the columns currently selected for the user specified listing |
function IO_SDFITS::get_num_index_rows() | |
Retrieves number of records the object is connected to - or how many rows currently in the index file |
function IO_SDFITS::sort_search_results(results, column) | |
Given an integer array representing some rows in the index, sorts this array by a given column name in the index file |
Routine Details |
io_sdfits__define |
procedure io_sdfits__define |
IO_SDFITS is the base class for spectral line and continuum sdfits classes. All the GENERAL functionality for reading, writing, navigating sdfits files, and for; translating their info to data containers is placed in this class. See UML for all IO Classes, or IO_SDFITS UML for just the line and continuum sdfits classes.
IO_SDFITS::init | private |
function IO_SDFITS::init() |
Class Constructor. Initialize the object
IO_SDFITS::cleanup | private |
procedure IO_SDFITS::cleanup |
Class cleanup on deletion: cleans up index object and sdfits objects
IO_SDFITS::set_debug_on |
procedure IO_SDFITS::set_debug_on |
The class can be made to verbosly describe what its doing
IO_SDFITS::set_debug_off |
procedure IO_SDFITS::set_debug_off |
The class can be made to be quite
IO_SDFITS::set_project |
This method looks into the given directory and attempts to load any existing index file. If the file does not exist, all sdfits files in this directory are loaded using the add_file method, and a new index is created. For a complete description, see the flowchart.
path = '/users/me/my_project' io = obj_new('io_sdfits_line') io->set_project, path
Parameters | |
dir |
The path in which all sdfits files and possibly the index file are to be found |
Keywords | |
_EXTRA |
. |
IO_SDFITS::set_file |
procedure IO_SDFITS::set_file, file_name, file_path=string, index_name=string, online=online, _EXTRA=_EXTRA |
This method can be used to lock the io object into working with only one sdfits file. An index file is automatically created (overwrites pre-existing one).
io = obj_new('io_sdfits_cntm') io->set_file, 'TREG_04_01.dcr.raw.fits'
Parameters | |
file_name |
The file name of the sdfits file (no path) |
Keywords | |
file_path |
Where to find the sdfits file |
index_name |
What to call the new index file |
online |
. |
_EXTRA |
. |
IO_SDFITS::add_file |
procedure IO_SDFITS::add_file, file_name, /new_index, index_name=index_name |
This method is the main interface to the sdfits io classes. It is used in turn by set_project and set_file. Most of the logic for keeping the index file in sync with the fits files is coded in this method. For a complete description, see the flowchart.
path = '/users/me/my_project' io = obj_new('io_sdfits_line') io->set_file_path, path io->add_file, 'TREG_O1_04.acs.raw.fits'
Parameters | |
file_name |
Name of sdfits file to add (no path) |
Keywords | |
new_index |
Forces the creation of a new index file (overwrites pre-existing index) |
index_name |
. |
IO_SDFITS::init_index | private |
procedure IO_SDFITS::init_index |
Creates a new index file using current info (file_path, observer, etc.) for index header.
IO_SDFITS::load_index |
procedure IO_SDFITS::load_index, file_name, file_path=string |
This method will read an index file, check that the index agrees with the sdfits files on disk, and create fits objects for the files listed in its index.
path = '/users/me/my_project' io = obj_new('io_sdfits_line') io->load_index, 'my_index', file_path='/users/me/my_project'
Parameters | |
file_name |
Index file name (no path) |
Keywords | |
file_path |
Where to find index file and sdfits files |
IO_SDFITS::read_index | private |
procedure IO_SDFITS::read_index, file_name |
Calls index file's read_file method
Parameters | |
file_name |
full path name to the index file |
IO_SDFITS::add_fits_obj | private |
Creates a fits object for the file name passed to it, and adds it to the list of fits objects
Parameters | |
file_name |
full path name of the sdfits file to add |
Keywords | |
_EXTRA |
. |
IO_SDFITS::add_fits_objs | private |
procedure IO_SDFITS::add_fits_objs, file_names |
From an array of full path names to sdfits files, create an array of sdfits objects
Parameters | |
file_names |
. |
IO_SDFITS::create_index_file | private |
procedure IO_SDFITS::create_index_file, index_file_name |
Creates a new index file, populating it with information from all the fits object
Parameters | |
index_file_name |
full path name to index file |
IO_SDFITS::conform_to_index | private |
function IO_SDFITS::conform_to_index() |
Checks to make sure index file that is loaded agrees with this object, and will create new sdfits objects if necessary to conform.
IO_SDFITS::conform_fits_objs_to_index | private |
procedure IO_SDFITS::conform_fits_objs_to_index |
Called after loading an index, gets all files in index and calls conform_fits_objs
IO_SDFITS::conform_fits_objs | private |
procedure IO_SDFITS::conform_fits_objs, file_names |
Checks that the list of file names passed to it are all represented by fits objects. If not, the fits objects are created from scratch.
Parameters | |
file_names |
array of full path names to sdfits files |
IO_SDFITS::get_full_file_name | private |
function IO_SDFITS::get_full_file_name(file_name) |
Takes in a file name string and returns the full path, with prepended path if needed. If the object has no file path, then the file name is returned unaltered. If the object DOES have a file path, then the passed in file name is checked for backslashes. If there is no backslash, the objects file path is prepended to the file name and passed back.
Parameters | |
file_name |
a file name, can be full path or not. |
IO_SDFITS::set_file_path |
procedure IO_SDFITS::set_file_path, file_path |
Sets the path where index file and all sdfits files are to be found
path = '/users/me/my_project' io = obj_new('io_sdfits_line') io->set_file_path, path
Parameters | |
file_path |
Path where index file and all sdfits files are to be found. |
IO_SDFITS::get_file_path |
function IO_SDFITS::get_file_path() |
Gets the path where index file and all sdfits files are to be found
path = '/users/me/my_project' io = obj_new('io_sdfits_line') io->set_project, path print, io->get_file_path() '/users/me/my_project'
IO_SDFITS::is_data_loaded |
function IO_SDFITS::is_data_loaded() |
Checks to see if this object has any sdfits files connected to it.
IO_SDFITS::set_index_file_name |
procedure IO_SDFITS::set_index_file_name, file_name |
Sets the file name of the index file.
Parameters | |
file_name |
. |
IO_SDFITS::get_index_file_name |
function IO_SDFITS::get_index_file_name([/full]) |
Retrieves the file name of the index file.
Keywords | |
full |
wether to return the full path name of the index file or not |
IO_SDFITS::find_fits | private |
function IO_SDFITS::find_fits(file_name) |
Given the full path name of an sdfits file, returns the object that represents that file
Parameters | |
file_name |
full path name to an sdfits file |
IO_SDFITS::get_fits | private |
function IO_SDFITS::get_fits(file_name) |
Parameters | |
file_name |
full path name to an sdfits file |
IO_SDFITS::get_number_extensions | private |
function IO_SDFITS::get_number_extensions(file_name) |
Retrieves the number of extensions for the given sdfits file
Parameters | |
file_name |
full file name of the sdfits file in question |
IO_SDFITS::get_extension_type | private |
Retrieves the extension type for the given sdfits file and extension
Parameters | |
ext_num |
extension (1-based) |
file_name |
full file name of the sdfits file in question |
IO_SDFITS::get_extension_name | private |
Retrieves the extension name for the given sdfits file and extension
Parameters | |
ext_num |
extension (1-based) |
file_name |
full file name of the sdfits file in question |
IO_SDFITS::get_ext_num_rows | private |
Retrieves the number of rows for the given sdfits file and extension
Parameters | |
ext_num |
extension (1-based) |
file_name |
full file name of the sdfits file in question |
IO_SDFITS::list |
procedure IO_SDFITS::list[, start][, finish], [sortcol=string], _EXTRA=_EXTRA, /verbose, [/user], [columns=string array] |
Prints out rows from the index file used by object. For exact search parameters to enter, see LINE_INDEX::search_index or CNTM_INDEX::search_index
Parameters | |
start |
where to start the range to list |
finish |
where to stop the range to list |
IO_SDFITS::get_index |
function IO_SDFITS::get_index(_EXTRA=_EXTRA) |
Returns indicies of rows in index file that match search. For exact search parameters to enter, see LINE_INDEX::search_index or CNTM_INDEX::search_index
Keywords | |
_EXTRA |
. |
IO_SDFITS::get_scan_info |
function IO_SDFITS::get_scan_info(scan_number) |
Returns a structure that contains info about the scan number given, such as scan number, procedure name, number of integrations, ifs, etc..
Parameters | |
scan_number |
scan number information is queried for |
IO_SDFITS::list_index_header |
procedure IO_SDFITS::list_index_header |
Prints out the header section of the index file used by this object
IO_SDFITS::get_index_values |
function IO_SDFITS::get_index_values(column_name, _EXTRA=_EXTRA) |
Returns the values contained in the index file column used by this object
Parameters | |
column_name |
name of the column to query |
Keywords | |
_EXTRA |
. |
IO_SDFITS::get_index_files |
function IO_SDFITS::get_index_files(_EXTRA=_EXTRA, full=full) |
Returns the unique file names (no path) contained in the index file used by this object
Keywords | |
_EXTRA |
. |
full |
. |
IO_SDFITS::get_index_projects |
function IO_SDFITS::get_index_projects(_EXTRA=_EXTRA) |
Returns the unique project names (no path) contained in the index file used by this object
Keywords | |
_EXTRA |
. |
IO_SDFITS::get_index_sources |
function IO_SDFITS::get_index_sources(_EXTRA=_EXTRA) |
Returns the unique source names (no path) contained in the index file used by this object
Keywords | |
_EXTRA |
. |
IO_SDFITS::get_index_procedures |
function IO_SDFITS::get_index_procedures(_EXTRA=_EXTRA) |
Returns the unique procedure names (no path) contained in the index file used by this object
Keywords | |
_EXTRA |
. |
IO_SDFITS::get_index_scans |
function IO_SDFITS::get_index_scans(_EXTRA=_EXTRA) |
Returns the unique scan names (no path) contained in the index file used by this object
Keywords | |
_EXTRA |
. |
IO_SDFITS::group_row_info | private |
function IO_SDFITS::group_row_info(row_info) |
Groups rows from the index table and sorts them by file-extension, since if we read these rows we want to do that efficiently (one file-extension at a time).
Parameters | |
row_info |
array of structures that mirror rows in the index file |
IO_SDFITS::get_sdfits_rows | private |
function IO_SDFITS::get_sdfits_rows(row_group) |
Deprecated function: given a listing of rows from the same file-extension, this uses an sdfits objects to simply return those rows from the file.
Parameters | |
row_group |
struct that specifies location of rows to be read from a file-extension |
IO_SDFITS::get_and_eval_rows | private |
function IO_SDFITS::get_and_eval_rows(row_group, missing, virtuals) |
Given a listing of rows from the same file-extension, this uses an sdfits object to simply return those rows from the file and evaluate what columns are missing and what are the keywords for the extension
IO_SDFITS::get_row_value | private |
function IO_SDFITS::get_row_value(row, tag_name, virtuals, names, default_value) |
Method for attempting to extract a value from an sdfits row. If the row contains the tag name requested, that value is passed back. If that tag name actually specifies a keyword in the extension-header, and NOT a column, then that value is returned. Finally, if the tag name mathes one of the expected column names that were not found in this extension, the default value is returned.
IO_SDFITS::format_sdfits_polarization | private |
function IO_SDFITS::format_sdfits_polarization(pol) |
Translates the polarization from the sdfits integer value into a char based value
Parameters | |
pol |
. |
IO_SDFITS::format_sdfits_freq_type | private |
function IO_SDFITS::format_sdfits_freq_type(freq_type) |
Translates the sdfits string for frequency type to the gbtidl representation CTYPE1 has two parts: First 4 characters are the type of quantity on that axis. Possible values are: FREQ == frequency. The axis is linear in frequency. VELO == velocity. The axis is linear in velocity. FELO == The axis is linear in frequency, but the quantities describing it are given in velocity units in the optical convention. These all date from a AIPS memo by Eric Griesen from November of 1983. The WCS paper III finally gets it right and eventually we'll have to update SDFITS to do that as Arecibo apparently has done. SDFITS, though, is still stuck in 1983. The second 4 characters describe the reference frame. These come from M&C, which uses these codes: OBS - observed (sky frequencies) GEO - geocentric BAR - barycentric HEL - heliocentric GAL - galactic LSR - Local Standard of Rest (equivalent to Kinematic LSR or LSRK) LSD - Dynamic Local Standard of Rest LGR - Local group CMB - Cosmic Microwave Background There's a "-" as the first character in this second set of 4. For reasons I can't remember, we decided that OBS should be translated to TOPO but everything else was okay as is. The sdfits tool at the moment always sets CTYPE1=FREQ-OBS, but of course other SDFITS files might have other combinations. For the moment, ensure that the first 4 characters are FREQ, and set frequency_type to the characters after the "-", translating "OBS" to "TOPO". Eventually, we'll want to translate VELO and FELO to true FREQ axes in the data container, but I think you should just reject those for now and come back to it later.
Parameters | |
freq_type |
. |
IO_SDFITS::format_sdfits_procedure | private |
function IO_SDFITS::format_sdfits_procedure(obsmode) |
Deprecated
Parameters | |
obsmode |
. |
IO_SDFITS::parse_sdfits_obsmode | private |
procedure IO_SDFITS::parse_sdfits_obsmode, obsmode, proc, swstate, swtchsig |
Translates the sdfits value for obsmode into seperate procedure, switch state and switch signal values
Parameters | |
obsmode |
the obsmode column from sdfits; takes form 'proc:swstate:swtchsig' |
proc |
procedure |
swstate |
switch state |
swtchsig |
switch signal |
IO_SDFITS::coord_mode_from_types | private |
function IO_SDFITS::coord_mode_from_types(long_type, lat_type) |
Incomplete: Translates the sdfits values for longitutde and latitude type into a coordinate mode.
Parameters | |
long_type |
type of longitude coordinate |
lat_type |
type of latitude coordinate |
IO_SDFITS::translate_cal | private |
function IO_SDFITS::translate_cal(cal) |
Translates sdfits cal string value into 1 or 0
Parameters | |
cal |
sdfits sig value |
IO_SDFITS::translate_sig | private |
function IO_SDFITS::translate_sig(sig) |
Translates sdfits sig string value into 1 or 0
Parameters | |
sig |
sdfits sig value |
IO_SDFITS::free_fits_objs | private |
procedure IO_SDFITS::free_fits_objs |
Releases the memory for all the current sdfits objects for this object
IO_SDFITS::set_debug_for_fits_objs | private |
procedure IO_SDFITS::set_debug_for_fits_objs, debug |
Sets debug flag for all fits objs
Parameters | |
debug |
. |
IO_SDFITS::are_index_file_indicies_unique |
function IO_SDFITS::are_index_file_indicies_unique() |
Diagnostic function to determine if index file indicies are unique (as they should be)
IO_SDFITS::set_more_format_on |
procedure IO_SDFITS::set_more_format_on |
Sets the object to print rows using the interactive 'more' format
IO_SDFITS::set_more_format_off |
procedure IO_SDFITS::set_more_format_off |
Sets the object NOT to print rows using the interactive 'more' format
IO_SDFITS::list_available_columns |
procedure IO_SDFITS::list_available_columns |
Prints the available columns from the rows section for list; these are also the valid search keywords
IO_SDFITS::set_user_columns |
procedure IO_SDFITS::set_user_columns, columns |
Sets what columns should be used for user listing
Parameters | |
columns |
array of columns to print on list command |
IO_SDFITS::list_user_columns |
procedure IO_SDFITS::list_user_columns |
Prints the columns currently selected for the user specified listing
IO_SDFITS::get_num_index_rows |
function IO_SDFITS::get_num_index_rows() |
Retrieves number of records the object is connected to - or how many rows currently in the index file
IO_SDFITS::sort_search_results |
Given an integer array representing some rows in the index, sorts this array by a given column name in the index file
Parameters | |
results |
integer array representing some rows in the index file |
column |
must be uniquely identify a column in the index file |