Produced by IDL 7.1.1
Developer Documentation

./toolbox/io
line_index__define.pro

INDEX_FILE
|
+-line_index

All known superclasses:
INDEX_FILE
Last modification date:
Wed Sep 28 13:27:14 2016

Child class of INDEX_FILE, contains special functionality for dealing with spectral line data. This mostly entails the translation of sdfits data into contents of the index file. See UML for all IO Classes, or INDEX UML for just index classes. This class is responsible for establishing the correct class for managing the row section of the index file, the translation between sdfits and index rows, translation from spectra to index rows, and provides the search gateway.

Fields Summary
IF_FILLER
object reference
object dedicating to filling if numbers for sdfits rows

Fields inherited from INDEX_FILE:
string  FILE_NAME
longword integer  FILE_LOADED
string  FILE_PATH
object reference  HEADER
object reference  ROWS
string  ROWS_CLASS
pointer  ROW_LINES
string  VERSION
longword integer  SPROTECT
structure [1] INFO
longword integer  DEBUG

Routine Summary  19 routines

procedure line_index__define

Child class of INDEX_FILE, contains special functionality for dealing with spectral line data.

function LINE_INDEX::init(_EXTRA=_EXTRA)

private

Class Constructor - special formats for spectral line initialized here

procedure LINE_INDEX::cleanup

private

Class Destructor - cleanup resources

function LINE_INDEX::get_row_info_strct()

private

Returns the speciall structure needed for spectral line data

function LINE_INDEX::search_index([start][, finish], [SEARCH=array of longs], [INDEX=long], [PROJECT=string], [FILE=string], [EXTENSION=long], [ROW=long], [SOURCE=string], [PROCEDURE=string], [OBSID=string], [PROCSCAN=string], [PROCTYPE=string], [E2ESCAN=long], [PROCSEQN=long], [SCAN=long], [POLARIZATION=string], [PLNUM=long ], [IFNUM=long ], [FEED=long], [FDNUM=long], [INT=long], [NUMCHN=long], [SIG=string], [CAL=string], [WCALPOS=string], [SAMPLER=string], [AZIMUTH=string], [ELEVATION=string], [LONGITUDE=string], [LATITUDE=string], [TRGTLONG=string], [TRGTLAT=string], SUBREF=SUBREF, [LST=string], [CENTFREQ=string], [RESTFREQ=string], [VELOCITY=string], [FREQINT=string], [FREQRES=string], [DATEOBS=string], [TIMESTAMP=string], [BANDWIDTH=double], [EXPOSURE=double], [TSYS=double], [NSAVE=long], [srow=int], [nrow=int])

This method searches the rows in the index file using the optional keywords.

function LINE_INDEX::parse_extension_rows(rows, proj, file_name, ext, missing, virtuals, start)

Translates raw sdfits rows into the rows to be written to the index file.

procedure LINE_INDEX::update_file, ext_rows, proj, file_name, ext, missing, virtuals, start_row

Appends row info to an index file, given a group of rows from sdfits files.

function LINE_INDEX::get_if_numbers(scan_rows, names, ints, index_start, index_end)

private

Algorithm for assigning if numbers for each row in the index file (zero-based).

function LINE_INDEX::get_integration_numbers(scan_rows, names)

private

Algorithm for determining integration numbers (0-based), given the sdfits rows of a scan.

function LINE_INDEX::get_feed_numbers(scan_rows, names)

private

Algorithm for determining feed numbers (0-based), given the sdfits rows of a scan.

function LINE_INDEX::get_scan_info(scan_number[, file], count=variable, [/quiet])

Returns a structure or array of structures that contains info about the scan number given, such as scan number, procedure name, number of integrations, ifs, etc.

procedure LINE_INDEX::update_with_spectra, spectra, file_name, extension, start_row

Appends row info to an index file, given a group of spectra.

procedure LINE_INDEX::replace_with_spectrum, index, spectrum, file_name, extension, row_num

Replaces a line specified by index number in the index rows section, with information derived from a given spectral line data container, and that specturm's location (sdfits file, ext, row) Used when a row has been rewritten in an sdfits file with a new spectra (via nsave, for example).

function LINE_INDEX::spectrum_to_info(spectrum, index, file_name, extension, row_num)

private

Translates information in a single spectral line data container, along with this data containers location in the sdfits file and index file, into a line in the rows section of the index file

function LINE_INDEX::spectra_to_info(spectra, file_name, extension, start)

private

Translates spectral line data containers directly into the rows to be written to index file.

procedure LINE_INDEX::set_debug_on

Makes object verbose

procedure LINE_INDEX::set_debug_off

Makes object quiet

procedure LINE_INDEX::get_file_properties_in_index, file_name, extensions, num_rows

private

Finds the number and sizes of extensions for a file listed in the index file, according to the index file.

function LINE_INDEX::get_center_frequency(ref_freq, ref_chan, freq_interval, num_chan)

Returns the center frequency using the following equation:

      center_chan = (double(num_chan)/2.

Routine Details

line_index__define

procedure line_index__define

Child class of INDEX_FILE, contains special functionality for dealing with spectral line data. This mostly entails the translation of sdfits data into contents of the index file. See UML for all IO Classes, or INDEX UML for just index classes. This class is responsible for establishing the correct class for managing the row section of the index file, the translation between sdfits and index rows, translation from spectra to index rows, and provides the search gateway.

LINE_INDEX::init private

function LINE_INDEX::init(_EXTRA=_EXTRA)

Class Constructor - special formats for spectral line initialized here

Keywords
_EXTRA
.

LINE_INDEX::cleanup private

procedure LINE_INDEX::cleanup

Class Destructor - cleanup resources

LINE_INDEX::get_row_info_strct private

function LINE_INDEX::get_row_info_strct()

Returns the speciall structure needed for spectral line data

Returns
line_row_info_strct structure

LINE_INDEX::search_index

function LINE_INDEX::search_index([start][, finish], [SEARCH=array of longs], [INDEX=long], [PROJECT=string], [FILE=string], [EXTENSION=long], [ROW=long], [SOURCE=string], [PROCEDURE=string], [OBSID=string], [PROCSCAN=string], [PROCTYPE=string], [E2ESCAN=long], [PROCSEQN=long], [SCAN=long], [POLARIZATION=string], [PLNUM=long ], [IFNUM=long ], [FEED=long], [FDNUM=long], [INT=long], [NUMCHN=long], [SIG=string], [CAL=string], [WCALPOS=string], [SAMPLER=string], [AZIMUTH=string], [ELEVATION=string], [LONGITUDE=string], [LATITUDE=string], [TRGTLONG=string], [TRGTLAT=string], SUBREF=SUBREF, [LST=string], [CENTFREQ=string], [RESTFREQ=string], [VELOCITY=string], [FREQINT=string], [FREQRES=string], [DATEOBS=string], [TIMESTAMP=string], [BANDWIDTH=double], [EXPOSURE=double], [TSYS=double], [NSAVE=long], [srow=int], [nrow=int])

This method searches the rows in the index file using the optional keywords. Not using any keywords returns all rows. Multiple keywords are combined with a logical AND.

Returns
Array of longs, each element corresponding to a line number of the index file that matches the search

Parameters
start
in, optional
long
where to start the range to search in
finish
in, optional
long
where to stop the range to search in

Keywords
SEARCH
in, optional
array of longs
The row numbers to search, often this is the result of a previous search that you wish to refine.
INDEX
in, optional
long
index (zero-based)
PROJECT
in, optional
string
project name
FILE
in, optional
string
sdfits file
EXTENSION
in, optional
long
sdfits extension number
ROW
in, optional
long
sdfits row number
SOURCE
in, optional
string
source name
PROCEDURE
in, optional
string
procecure
OBSID
in, optional
string
obsid
PROCSCAN
in, optional
string
procscan
PROCTYPE
in, optional
string
proctype
E2ESCAN
in, optional
long
e2e scan numbers (not yet supported)
PROCSEQN
in, optional
long
Procedure sequence number
SCAN
in, optional
long
M&C scan number
POLARIZATION
in, optional
string
polarization
PLNUM
in, optional
long
polarization index (zero-based)
IFNUM
in, optional
long
if number index (zero-based)
FEED
in, optional
long
feed name
FDNUM
in, optional
long
feed index number (zer0-based)
INT
in, optional
long
integraion number (zero-based)
NUMCHN
in, optional
long
total number of channels in the spectrum
SIG
in, optional
string
sig/ref state
CAL
in, optional
string
noise diode cal state
WCALPOS
in, optional
string
calposition
SAMPLER
in, optional
string
backend sampler name
AZIMUTH
in, optional
string
azimuth
ELEVATION
in, optional
string
elevation
LONGITUDE
in, optional
string
longitude axis (ex:ra) value
LATITUDE
in, optional
string
latitude axis (ex:dec) value
TRGTLONG
in, optional
string
target longitude (ex:ra) value
TRGTLAT
in, optional
string
target latitude (ex:ra) value
SUBREF
in
subreflector state (0=moving,1,-1)
LST
in, optional
string
LST
CENTFREQ
in, optional
string
center frequency
RESTFREQ
in, optional
string
rest frequency
VELOCITY
in, optional
string
source velocity
FREQINT
in, optional
string
frequency interval (channel spacing)
FREQRES
in, optional
string
frequency resolution (always > 0.0)
DATEOBS
in, optional
string
date-time string
TIMESTAMP
in, optional
string
the start of the scan
BANDWIDTH
in, optional
double
bandwidth
EXPOSURE
in, optional
double
exposure
TSYS
in, optional
double
Tsys
NSAVE
in, optional
long
nsave index number
srow
in, optional
int
Starting row in index, used after scan_info has been used and the range of rows is known. Must be used with nrow.
nrow
in, optional
int
Number of rows in index after srow, used after scan_info has been used and the range of rows is known. Must be used with nrow.

LINE_INDEX::parse_extension_rows

function LINE_INDEX::parse_extension_rows(rows, proj, file_name, ext, missing, virtuals, start)

Translates raw sdfits rows into the rows to be written to the index file. This is where all the algorithms are implemented for determining if and integration numbers.

Returns
arrays of structures representing lines to be written to index file
Uses
INDEX_FILE::get_row_info_strct LINE_INDEX::get_integreation_number LINE_INDEX::get_if_numbers INDEX_FILE::get_row_value

Parameters
rows
in
array
array of structs representing sdfits rows
proj
in
string
project id shared by all rows
file_name
in
string
file location shared by all rows
ext
in
long
extension location shared by all rows
missing
in
array
string array of columns missing from the sdfits file
virtuals
in
struct
key-value pairs from sdfits extension header (not including col descriptions)
start
in
long
row number that these rows start at 4

LINE_INDEX::update_file

procedure LINE_INDEX::update_file, ext_rows, proj, file_name, ext, missing, virtuals, start_row

Appends row info to an index file, given a group of rows from sdfits files. Used for first loading in an sdfits file

Uses
LINE_INDEX::spectra_to_info LINE_INDEX::update_index_file

Parameters
ext_rows
in
array
array of sdfits rows
proj
in
string
project shared by all rows
file_name
in
string
file location shared by all extensions
ext
in
long
extension location shared by all extensions
missing
in
array
string array of columns missing from the ext_rows param
virtuals
in
struct
keywords from extension header not describing columns
start_row
in
long
where these spectra start in the extension

LINE_INDEX::get_if_numbers private

function LINE_INDEX::get_if_numbers(scan_rows, names, ints, index_start, index_end)

Algorithm for assigning if numbers for each row in the index file (zero-based). First, only first integrations are looked at. Of these, only where the SIG column is True are used. Finally of these, unique combinations of (CRVAL1, CTYPE1, CDELT1, and CRPIX1) columns are used to compute the number of ifs in the scan. These if numbers are assigned to where those unique combinations occur, and the unassigned numbers are 'back filled' using the integration numbers as a guide.

Returns
an array for if numbers of each row in index file for this scan (ex: [0,0,1,1,2,2,0,0,1,1,2,2,,...])
Uses
INDEX_FILE::get_col_variability

Parameters
scan_rows
in
array
array of sdfits rows for just one scan
names
in
struct
structure containing pointers to names of sdfits columns, missing columns, and keywords
ints
in
array
integration numbers for each row
index_start
in
long
the starting index num for these rows
index_end
in
long
the ending index num for these rows

LINE_INDEX::get_integration_numbers private

function LINE_INDEX::get_integration_numbers(scan_rows, names)

Algorithm for determining integration numbers (0-based), given the sdfits rows of a scan. This is simple: just use the DATE-OBS column values.

Returns
an array for integration numbers of each row in index file for this scan (ex: [0,0,1,1,2,2,3,3,...])
Uses
INDEX_FILE::get_col_variability

Parameters
scan_rows
in
array
array of sdfits rows for just one scan
names
in
struct
structure containing pointers to names of sdfits columns, missing columns, and keywords

LINE_INDEX::get_feed_numbers private

function LINE_INDEX::get_feed_numbers(scan_rows, names)

Algorithm for determining feed numbers (0-based), given the sdfits rows of a scan.

Returns
an array for feed numbers of each row in index file for this scan (ex: [0,0,1,1,2,2,3,3,...])
Uses
INDEX_FILE::get_col_variability

Parameters
scan_rows
in
array
array of sdfits rows for just one scan
names
in
struct
structure containing pointers to names of sdfits columns, missing columns, and keywords

LINE_INDEX::get_scan_info

function LINE_INDEX::get_scan_info(scan_number[, file], count=variable, [/quiet])

Returns a structure or array of structures that contains info about the scan number given, such as scan number, procedure name, number of integrations, ifs, etc.. One element in the array for each unique TIMESTAMP value for all rows having that scan number.

Returns
Array of structures containing info on scan, returns -1 on failure.

Parameters
scan_number
in
long
scan number information is queried for
file
in, optional
string
Limit the search for the scan number to a specific file name.

Keywords
count
out
variable
The number of elements of the returned array of scan_info structures.
quiet
in, optional
boolean
When set, suppress most error messages.

LINE_INDEX::update_with_spectra

procedure LINE_INDEX::update_with_spectra, spectra, file_name, extension, start_row

Appends row info to an index file, given a group of spectra. Used for when these spectra have been written to an sdifts file.

Uses
LINE_INDEX::spectra_to_info LINE_INDEX::update_index_file

Parameters
spectra
in
array
array of spectrum data containers
file_name
in
string
file location shared by all extensions
extension
in
long
extension location shared by all extensions
start_row
in
long
where these spectra start in the extension, should be the current number of rows in extension

LINE_INDEX::replace_with_spectrum

procedure LINE_INDEX::replace_with_spectrum, index, spectrum, file_name, extension, row_num

Replaces a line specified by index number in the index rows section, with information derived from a given spectral line data container, and that specturm's location (sdfits file, ext, row) Used when a row has been rewritten in an sdfits file with a new spectra (via nsave, for example).

Uses
LINE_INDEX::spectra_to_info

Parameters
index
.
spectrum
in
array
spectral line data container
file_name
in
string
file location where spectral line was written
extension
in
long
extension location where this spectrum was written
row_num
in
long
row number where this spectrum was written

LINE_INDEX::spectrum_to_info private

function LINE_INDEX::spectrum_to_info(spectrum, index, file_name, extension, row_num)

Translates information in a single spectral line data container, along with this data containers location in the sdfits file and index file, into a line in the rows section of the index file

Returns
structure representing a row in the index file
Uses
INDEX_FILE::get_row_info_strct

Parameters
spectrum
in
struct
spectrum data container
index
in
long
index number that this row will have in index file
file_name
in
string
file that this spectrum is from
extension
in
long
extension that this spectrum are from
row_num
in
long
the row that this spectrum is from

LINE_INDEX::spectra_to_info private

function LINE_INDEX::spectra_to_info(spectra, file_name, extension, start)

Translates spectral line data containers directly into the rows to be written to index file. No specail coding here, since an index file was used to create this data container at some point. This assumes that the spectra have been recenlty appended to the file in param file_name.

Returns
structures representing a row in the index file
Uses
INDEX_FILE::get_row_info_strct LINE_INDEX::spectrum_to_info

Parameters
spectra
in
array
array of spectrum data containers
file_name
in
string
file that these spectra are from
extension
in
long
extension that these spectra are from
start
in
long
the row at which these spectra start in their file-extension location, should be the current number of rows in extension

LINE_INDEX::set_debug_on

procedure LINE_INDEX::set_debug_on

Makes object verbose

LINE_INDEX::set_debug_off

procedure LINE_INDEX::set_debug_off

Makes object quiet

LINE_INDEX::get_file_properties_in_index private

procedure LINE_INDEX::get_file_properties_in_index, file_name, extensions, num_rows

Finds the number and sizes of extensions for a file listed in the index file, according to the index file.

Parameters
file_name
in
string
file whose properties are being queried
extensions
out
variable
number of extensions for this file
num_rows
out
variable
array showing how many rows in each extension for this file

LINE_INDEX::get_center_frequency

function LINE_INDEX::get_center_frequency(ref_freq, ref_chan, freq_interval, num_chan)

Returns the center frequency using the following equation:


    center_chan = (double(num_chan)/2.0)-0.5D
    center_freq = (((center_chan - double(ref_chan))*freq_interval)+ref_freq

 

Parameters
ref_freq
in, required
float
reference frequency
ref_chan
in, required
long
reference channel
freq_interval
in, required
float
frequency interval
num_chan
in, required
long
number of channels


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