SourceTable¶
-
class
SourceTable(container)[source]¶ Bases:
objectThe SourceTable class is an Alma table.
Summary of astromomical source information.
Shown here are the fields found in each row.
The key fields are shown first and used (together) to index a unique row. Key fields are all required and indicated by “Key.” following the description.
Other fields are required unless “optional” is shown for that field.
The field description text here is as found in the model used to generate the code.
Types may be an enumeration or extended pyasdm type. Fields that are python lists are indicated that by “[]” in the type and having the word “Array” at the start of description followed by the expected number of elements in that list in parentheses. Lists (arrays) may be multi-dimensional (lists of lists) and are indicated by [][] … etc as needed to indicate the expected number of dimensions. Multi-dimenstional lists will show the expected number of elements for each dimension also in the parenthese after “Array”.
The use of “auto-incrementable” indicates that that field is auto-generated when the table is created and that field is set, as necessary, to create a unique key for the specific row being added, by incrementing that value from the previous highest value needed for the rest of the elements of the key on that row. Such a field can not be set independently, it is only set when the row is added to the table by that auto-increment mechanism.
-
sourceId¶ identifies a collection of rows in the table. auto-incrementable, key.
- Type
int
-
timeInterval¶ the time interval of validity of the row’s content. key.
- Type
-
code¶ indicates the nature of the source.
- Type
str
-
properMotion¶ Array(2) the proper motion of the source.
- Type
AngularRate []
-
sourceName¶ the name of the source.
- Type
str
-
directionCode¶ identifies the direction reference frame associated to direction. Optional.
-
directionEquinox¶ the equinox associated to the direction reference frame (if required). Optional.
- Type
-
calibrationGroup¶ the calibration group number. Optional.
- Type
int
-
catalog¶ the name of the catalog. Optional.
- Type
str
-
numLines¶ the number of line transitions. Optional.
- Type
int
-
transition¶ Array(numLines) the names of the transitions. Optional.
- Type
str []
-
restFrequency¶ Array(numLines) the rest frequencies (one value per transition line). Optional.
- Type
Frequency []
-
sourceModel¶ identifies the source model. Optional.
- Type
-
frequencyRefCode¶ the frequency reference code. Optional.
-
numFreq¶ the number of frequencies. Optional.
- Type
int
-
numStokes¶ the number of Stokes parameters. Optional.
- Type
int
-
frequency¶ Array(numFreq) the array of frequencies (one value per frequency). Optional.
- Type
Frequency []
-
frequencyInterval¶ Array(numFreq) an array of frequency intervals (one value per interval). Optional.
- Type
Frequency []
-
stokesParameter¶ Array(numStokes) the array of Stokes parameters (one value per parameter). Optional.
- Type
-
flux¶ Array(numFreq, numStokes) the array of flux densities expressed in Jansky (Jy). Optional.
- Type
Flux [] []
-
fluxErr¶ Array(numFreq, numStokes) the array of uncertainties on flux densities. Optional.
- Type
Flux [] []
-
positionAngle¶ Array(numFreq) the major axis position angles (one value per frequency). Optional.
- Type
Angle []
-
positionAngleErr¶ Array(numFreq) the uncertainties on major axis position angles. Optional.
- Type
Angle []
-
size[source]¶ Array(numFreq, 2) the sizes of source (one pair of values per frequency). Optional.
- Type
Angle [] []
-
sizeErr¶ Array(numFreq, 2) the uncertainties on the source sizes (one pair of value per frequency). Optional.
- Type
Angle [] []
-
velRefCode¶ the velocity reference code for velocities: sysVel, rangeVel, deltaVel. Optional.
-
dopplerReferenceSystem¶ the velocity reference code for velocities: sysVel, rangeVel, deltaVel. Optional.
-
dopplerCalcType¶ the velocity reference code for velocities: sysVel, rangeVel, deltaVel. Optional.
- Type
-
parallax¶ Array(numFreq) the sizes of source (one pair of values per frequency). Optional.
- Type
Angle []
Methods Summary
Key(spectralWindowId)Returns a string built by concatenating the ascii representation of the parameters values suffixed with a “_” character.
MIMEXMLPart(byteOrder)Used in both the small XML file as well as the bin file when writing out as binary.
add(x)Append a SourceRow to the SourceTable.
checkAndAdd(x)A method to append a row to its table, used by input conversion methods.
checkPresenceInMemory()Check if the table is present in memory.
fromXML(xmlstr)Populate this table from the content of a XML document that is required to conform to the XML schema defined for a Source (SourceTable.xsd).
get()Get all rows.
getContainer()Return the container to which this table belongs.
getDeltaVelEqTolerance()A getter for the tolerance on deltaVel Returns the tolerance as a Speed
getDirectionEqTolerance()A getter for the tolerance on direction Returns the tolerance as a Angle
getDopplerVelocityEqTolerance()A getter for the tolerance on dopplerVelocity Returns the tolerance as a Speed
getEntity()Returns the table’s entity.
getFluxEqTolerance()A getter for the tolerance on flux Returns the tolerance as a Flux
getFluxErrEqTolerance()A getter for the tolerance on fluxErr Returns the tolerance as a Flux
getFrequencyEqTolerance()A getter for the tolerance on frequency Returns the tolerance as a Frequency
getFrequencyIntervalEqTolerance()A getter for the tolerance on frequencyInterval Returns the tolerance as a Frequency
getKeyName()Return the list of field names that make up key key as a list of strings.
getName()Return the name of this table.
getParallaxEqTolerance()A getter for the tolerance on parallax Returns the tolerance as a Angle
getPositionAngleEqTolerance()A getter for the tolerance on positionAngle Returns the tolerance as a Angle
getPositionAngleErrEqTolerance()A getter for the tolerance on positionAngleErr Returns the tolerance as a Angle
getPositionEqTolerance()A getter for the tolerance on position Returns the tolerance as a Length
getProperMotionEqTolerance()A getter for the tolerance on properMotion Returns the tolerance as a AngularRate
getRangeVelEqTolerance()A getter for the tolerance on rangeVel Returns the tolerance as a Speed
getRestFrequencyEqTolerance()A getter for the tolerance on restFrequency Returns the tolerance as a Frequency
getRowByKey(sourceId, timeInterval, …)Returns a SourceRow given a key.
getRowBySourceId(sourceId)Returns a list of rows whose key element sourceId is equal to the parameter sourceId.
getRows()get the rows, synonymous with the get method.
getSizeEqTolerance()A getter for the tolerance on size Returns the tolerance as a Angle
getSizeErrEqTolerance()A getter for the tolerance on sizeErr Returns the tolerance as a Angle
getSysVelEqTolerance()A getter for the tolerance on sysVel Returns the tolerance as a Speed
getVersion()insertByStartTime(x, rowlist)Insert a SourceRow in a list of SourceRow so that it’s ordered by ascending start time.
lookup(timeInterval, spectralWindowId, code, …)Look up the table for a row whose all attributes except the autoincrementable one are equal to the corresponding parameters of the method.
newRow(timeInterval, spectralWindowId, code, …)Create a new SourceRow initialized to the specified values.
newRowCopy(row)Create a new row using a copy constructor mechanism.
newRowDefault()Create a new row with default values.
setDeltaVelEqTolerance(tolerance)A setter for the tolerance on deltaVel
setDirectionEqTolerance(tolerance)A setter for the tolerance on direction
setDopplerVelocityEqTolerance(tolerance)A setter for the tolerance on dopplerVelocity
setEntity(e)Set the table’s entity The parameter, e, must be an Entity
setFluxEqTolerance(tolerance)A setter for the tolerance on flux
setFluxErrEqTolerance(tolerance)A setter for the tolerance on fluxErr
setFrequencyEqTolerance(tolerance)A setter for the tolerance on frequency
setFrequencyIntervalEqTolerance(tolerance)A setter for the tolerance on frequencyInterval
setFromFile(directory)Reads and parses a file containing a representation of a SourceTable as those produced by the toFile method.
setFromMIME(byteStream)Extracts the binary part of a MIME message and deserialize its content to fill this with the result of the deserialization.
setFromMIMEFile(directory)Set this table from a MIME file.
setFromXMLFile(directory)This is the function used by setFromFile when the file is an XML file Not intended for external use.
setNotPresentInMemory()Set the state to indicate it is not present in memory and needs to be loaded before being used.
setParallaxEqTolerance(tolerance)A setter for the tolerance on parallax
setPositionAngleEqTolerance(tolerance)A setter for the tolerance on positionAngle
setPositionAngleErrEqTolerance(tolerance)A setter for the tolerance on positionAngleErr
setPositionEqTolerance(tolerance)A setter for the tolerance on position
setProperMotionEqTolerance(tolerance)A setter for the tolerance on properMotion
setRangeVelEqTolerance(tolerance)A setter for the tolerance on rangeVel
setRestFrequencyEqTolerance(tolerance)A setter for the tolerance on restFrequency
setSizeEqTolerance(tolerance)A setter for the tolerance on size
setSizeErrEqTolerance(tolerance)A setter for the tolerance on sizeErr
setSysVelEqTolerance(tolerance)A setter for the tolerance on sysVel
setVersion(version)size()Return the number of rows in the table.
toFile(directory)Stores a representation (binary or XML) of this table into a file.
toMIME(mimeFilePath, mimeXMLpart, byteOrder)Write this out to mimeFilePath as a serialized MIME file with a leading XML part and a following binary part.
toXML()Translate this table to an XML representation conforming to the schema defined for Source (SourceTable.xsd).
Methods Documentation
-
Key(spectralWindowId)[source]¶ Returns a string built by concatenating the ascii representation of the parameters values suffixed with a “_” character.
-
MIMEXMLPart(byteOrder)[source]¶ Used in both the small XML file as well as the bin file when writing out as binary. The byte order is set by byteOrder.
-
checkAndAdd(x)[source]¶ A method to append a row to its table, used by input conversion methods. Not indended for external use.
If this table has an autoincrementable attribute then check if x verifies the rule of uniqueness and throw exception if not.
This method is appropriate for an auto-incrementable attribute with a temporal field either with or without additional keywords.
Append x to its table. x The row to be appended. returns x.
-
checkPresenceInMemory()[source]¶ Check if the table is present in memory. If not, load the table from the file using the directory of the container.
-
fromXML(xmlstr)[source]¶ Populate this table from the content of a XML document that is required to conform to the XML schema defined for a Source (SourceTable.xsd).
-
getDeltaVelEqTolerance()[source]¶ A getter for the tolerance on deltaVel Returns the tolerance as a Speed
-
getDirectionEqTolerance()[source]¶ A getter for the tolerance on direction Returns the tolerance as a Angle
-
getDopplerVelocityEqTolerance()[source]¶ A getter for the tolerance on dopplerVelocity Returns the tolerance as a Speed
-
getFluxErrEqTolerance()[source]¶ A getter for the tolerance on fluxErr Returns the tolerance as a Flux
-
getFrequencyEqTolerance()[source]¶ A getter for the tolerance on frequency Returns the tolerance as a Frequency
-
getFrequencyIntervalEqTolerance()[source]¶ A getter for the tolerance on frequencyInterval Returns the tolerance as a Frequency
-
getParallaxEqTolerance()[source]¶ A getter for the tolerance on parallax Returns the tolerance as a Angle
-
getPositionAngleEqTolerance()[source]¶ A getter for the tolerance on positionAngle Returns the tolerance as a Angle
-
getPositionAngleErrEqTolerance()[source]¶ A getter for the tolerance on positionAngleErr Returns the tolerance as a Angle
-
getPositionEqTolerance()[source]¶ A getter for the tolerance on position Returns the tolerance as a Length
-
getProperMotionEqTolerance()[source]¶ A getter for the tolerance on properMotion Returns the tolerance as a AngularRate
-
getRangeVelEqTolerance()[source]¶ A getter for the tolerance on rangeVel Returns the tolerance as a Speed
-
getRestFrequencyEqTolerance()[source]¶ A getter for the tolerance on restFrequency Returns the tolerance as a Frequency
-
getRowByKey(sourceId, timeInterval, spectralWindowId)[source]¶ Returns a SourceRow given a key. return the row having the key whose values are passed as parameters, or None if no row exists for that key.
-
getRowBySourceId(sourceId)[source]¶ Returns a list of rows whose key element sourceId is equal to the parameter sourceId. return a list of SourceRow. A returned list of size 0 means that no row has been found. sourceId is of type int and contains the value of the autoincrementable attribute that is looked up in the table.
-
getSizeErrEqTolerance()[source]¶ A getter for the tolerance on sizeErr Returns the tolerance as a Angle
-
getSysVelEqTolerance()[source]¶ A getter for the tolerance on sysVel Returns the tolerance as a Speed
-
insertByStartTime(x, rowlist)[source]¶ Insert a SourceRow in a list of SourceRow so that it’s ordered by ascending start time.
x The SourceRow to be inserted. rowlist The list where x is to be inserted.
The inserted row is returned. If x already exists in rowlist then it is not added and the row in rowlist is returned.
If a row matching the value of the start time of timeInterval is found in rowlist but the other required parameters do not have the same value then a DuplicateKey exception is raised.
-
lookup(timeInterval, spectralWindowId, code, direction, properMotion, sourceName)[source]¶ Look up the table for a row whose all attributes except the autoincrementable one are equal to the corresponding parameters of the method. return this row if any, None otherwise.
param timeInterval.
param spectralWindowId.
param code.
param direction.
param properMotion.
param sourceName.
-
newRow(timeInterval, spectralWindowId, code, direction, properMotion, sourceName)[source]¶ Create a new SourceRow initialized to the specified values.
The new row is not added to this table, but it does know about it. (the autoincrementable attribute, if any, is not in the parameter list)
-
newRowCopy(row)[source]¶ Create a new row using a copy constructor mechanism.
The method creates a new SourceRow which knows about this table. Each attribute of the created row is a (deep) copy of the corresponding attribute of row. The method does not add the created row to this, it simply parents it to this, a call to the add method has to be done in order to get the row added (very likely after having modified some of its attributes. If row is None then the method returns a new SourceRow with default values for its attributes.
-
newRowDefault()[source]¶ Create a new row with default values. The new row is not added to this table but it knows about it.
-
setFromFile(directory)[source]¶ Reads and parses a file containing a representation of a SourceTable as those produced by the toFile method. This table is populated with the result of the parsing. param directory The name of the directory containing the file te be read and parsed. raises ConversionException If any error occurs while reading the files in the directory or parsing them.
-
setFromMIME(byteStream)[source]¶ Extracts the binary part of a MIME message and deserialize its content to fill this with the result of the deserialization. param byteStream the previously opened io.BufferedReader instance containing the data to be extracted.
It is the responsibility of this method to close byteStream.
-
setFromMIMEFile(directory)[source]¶ Set this table from a MIME file. Used internally by setFromFile. Not intended for external use.
-
setFromXMLFile(directory)[source]¶ This is the function used by setFromFile when the file is an XML file Not intended for external use.
-
setNotPresentInMemory()[source]¶ Set the state to indicate it is not present in memory and needs to be loaded before being used. This is used by the container class when loaded from a file and this table is present with non-zero rows. Tables are loaded on demand when the get function in the container for that table is used.
-
toFile(directory)[source]¶ Stores a representation (binary or XML) of this table into a file.
Depending on the boolean value of its _fileAsBin data member a binary serialization of this (_fileAsBin==True) will be saved in a file “Source.bin” or an XML representation (_fileAsBin==False) will be saved in a file “Source.xml”. The file is always written in a directory whose name is passed as a parameter. param directory The name of directory where the file containing the table’s representation will be saved. raises ConversionException for any errors while writing that file.
-
toMIME(mimeFilePath, mimeXMLpart, byteOrder)[source]¶ Write this out to mimeFilePath as a serialized MIME file with a leading XML part and a following binary part.
The mimeXMLpart is a string that should have already been written to the corresponding small XML file (and is returned by the MIMEXMLPart method here). The byteOrder is a ByteOrder instance that gives the byte order to use when writing the binary data. That instance should have also been used to generate mimeXMLpart.
-