# ALMA - Atacama Large Millimeter Array
# (c) European Southern Observatory, 2002
# (c) Associated Universities Inc., 2002
# Copyright by ESO (in the framework of the ALMA collaboration),
# Copyright by AUI (in the framework of the ALMA collaboration),
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
# Warning!
# --------------------------------------------------------------------
# | This is generated code! Do not modify this file. |
# | If you do, all changes will be lost when the file is re-generated. |
# --------------------------------------------------------------------
#
# File SysCalRow.py
#
import pyasdm.SysCalTable
from .Parser import Parser
import pyasdm.utils
from .exceptions.ConversionException import ConversionException
# All of the extended types are imported
from pyasdm.types import *
# this will contain all of the static methods used to get each element of the row
# from an EndianInput instance
_fromBinMethods = {}
from xml.dom import minidom
import copy
[docs]class SysCalRow:
"""
The SysCalRow class is a row of a SysCalTable.
Generated from model's revision -1, branch
"""
# the table to which this row belongs.
_table = None
# whether this row has been added to the table or not.
_hasBeenAdded = False
# internal attribute values appear later, with their getters and setters
def __init__(self, table, row=None):
"""
Create a SysCalRow.
When row is None, create an empty row attached to table, which must be a SysCalTable.
When row is given, copy those values in to the new row. The row argument must be a SysCalRow.
The returned new row is not yet added to table, but it knows about table.
"""
if not isinstance(table, pyasdm.SysCalTable):
raise ValueError("table must be a SysCalTable")
self._table = table
self._hasBeenAdded = False
# initialize attribute values
# intrinsic attributes
self._timeInterval = ArrayTimeInterval()
self._numReceptor = 0
self._numChan = 0
self._tcalFlagExists = False
self._tcalFlag = None
self._tcalSpectrumExists = False
self._tcalSpectrum = [] # this is a list of Temperature [] []
self._trxFlagExists = False
self._trxFlag = None
self._trxSpectrumExists = False
self._trxSpectrum = [] # this is a list of Temperature [] []
self._tskyFlagExists = False
self._tskyFlag = None
self._tskySpectrumExists = False
self._tskySpectrum = [] # this is a list of Temperature [] []
self._tsysFlagExists = False
self._tsysFlag = None
self._tsysSpectrumExists = False
self._tsysSpectrum = [] # this is a list of Temperature [] []
self._tantFlagExists = False
self._tantFlag = None
self._tantSpectrumExists = False
self._tantSpectrum = [] # this is a list of float [] []
self._tantTsysFlagExists = False
self._tantTsysFlag = None
self._tantTsysSpectrumExists = False
self._tantTsysSpectrum = [] # this is a list of float [] []
self._phaseDiffFlagExists = False
self._phaseDiffFlag = None
self._phaseDiffSpectrumExists = False
self._phaseDiffSpectrum = [] # this is a list of float [] []
# extrinsic attributes
self._antennaId = Tag()
self._feedId = 0
self._spectralWindowId = Tag()
if row is not None:
if not isinstance(row, SysCalRow):
raise ValueError("row must be a SysCalRow")
# copy constructor
self._antennaId = Tag(row._antennaId)
self._spectralWindowId = Tag(row._spectralWindowId)
self._timeInterval = ArrayTimeInterval(row._timeInterval)
self._feedId = row._feedId
self._numReceptor = row._numReceptor
self._numChan = row._numChan
# by default set systematically tcalFlag's value to something not None
if row._tcalFlagExists:
self._tcalFlag = row._tcalFlag
self._tcalFlagExists = True
# by default set systematically tcalSpectrum's value to something not None
if row._tcalSpectrumExists:
# tcalSpectrum is a list, make a deep copy
self._tcalSpectrum = copy.deepcopy(row._tcalSpectrum)
self._tcalSpectrumExists = True
# by default set systematically trxFlag's value to something not None
if row._trxFlagExists:
self._trxFlag = row._trxFlag
self._trxFlagExists = True
# by default set systematically trxSpectrum's value to something not None
if row._trxSpectrumExists:
# trxSpectrum is a list, make a deep copy
self._trxSpectrum = copy.deepcopy(row._trxSpectrum)
self._trxSpectrumExists = True
# by default set systematically tskyFlag's value to something not None
if row._tskyFlagExists:
self._tskyFlag = row._tskyFlag
self._tskyFlagExists = True
# by default set systematically tskySpectrum's value to something not None
if row._tskySpectrumExists:
# tskySpectrum is a list, make a deep copy
self._tskySpectrum = copy.deepcopy(row._tskySpectrum)
self._tskySpectrumExists = True
# by default set systematically tsysFlag's value to something not None
if row._tsysFlagExists:
self._tsysFlag = row._tsysFlag
self._tsysFlagExists = True
# by default set systematically tsysSpectrum's value to something not None
if row._tsysSpectrumExists:
# tsysSpectrum is a list, make a deep copy
self._tsysSpectrum = copy.deepcopy(row._tsysSpectrum)
self._tsysSpectrumExists = True
# by default set systematically tantFlag's value to something not None
if row._tantFlagExists:
self._tantFlag = row._tantFlag
self._tantFlagExists = True
# by default set systematically tantSpectrum's value to something not None
if row._tantSpectrumExists:
# tantSpectrum is a list, make a deep copy
self._tantSpectrum = copy.deepcopy(row._tantSpectrum)
self._tantSpectrumExists = True
# by default set systematically tantTsysFlag's value to something not None
if row._tantTsysFlagExists:
self._tantTsysFlag = row._tantTsysFlag
self._tantTsysFlagExists = True
# by default set systematically tantTsysSpectrum's value to something not None
if row._tantTsysSpectrumExists:
# tantTsysSpectrum is a list, make a deep copy
self._tantTsysSpectrum = copy.deepcopy(row._tantTsysSpectrum)
self._tantTsysSpectrumExists = True
# by default set systematically phaseDiffFlag's value to something not None
if row._phaseDiffFlagExists:
self._phaseDiffFlag = row._phaseDiffFlag
self._phaseDiffFlagExists = True
# by default set systematically phaseDiffSpectrum's value to something not None
if row._phaseDiffSpectrumExists:
# phaseDiffSpectrum is a list, make a deep copy
self._phaseDiffSpectrum = copy.deepcopy(row._phaseDiffSpectrum)
self._phaseDiffSpectrumExists = True
[docs] def isAdded(self):
self._hasBeenAdded = True
[docs] def getTable(self):
"""
Return the table to which this row belongs.
"""
return self._table
[docs] def toXML(self):
"""
Return this row in the form of an XML string.
"""
result = ""
result += "<row> \n"
# intrinsic attributes
result += Parser.extendedValueToXML("timeInterval", self._timeInterval)
result += Parser.valueToXML("numReceptor", self._numReceptor)
result += Parser.valueToXML("numChan", self._numChan)
if self._tcalFlagExists:
result += Parser.valueToXML("tcalFlag", self._tcalFlag)
if self._tcalSpectrumExists:
result += Parser.listExtendedValueToXML("tcalSpectrum", self._tcalSpectrum)
if self._trxFlagExists:
result += Parser.valueToXML("trxFlag", self._trxFlag)
if self._trxSpectrumExists:
result += Parser.listExtendedValueToXML("trxSpectrum", self._trxSpectrum)
if self._tskyFlagExists:
result += Parser.valueToXML("tskyFlag", self._tskyFlag)
if self._tskySpectrumExists:
result += Parser.listExtendedValueToXML("tskySpectrum", self._tskySpectrum)
if self._tsysFlagExists:
result += Parser.valueToXML("tsysFlag", self._tsysFlag)
if self._tsysSpectrumExists:
result += Parser.listExtendedValueToXML("tsysSpectrum", self._tsysSpectrum)
if self._tantFlagExists:
result += Parser.valueToXML("tantFlag", self._tantFlag)
if self._tantSpectrumExists:
result += Parser.listValueToXML("tantSpectrum", self._tantSpectrum)
if self._tantTsysFlagExists:
result += Parser.valueToXML("tantTsysFlag", self._tantTsysFlag)
if self._tantTsysSpectrumExists:
result += Parser.listValueToXML("tantTsysSpectrum", self._tantTsysSpectrum)
if self._phaseDiffFlagExists:
result += Parser.valueToXML("phaseDiffFlag", self._phaseDiffFlag)
if self._phaseDiffSpectrumExists:
result += Parser.listValueToXML(
"phaseDiffSpectrum", self._phaseDiffSpectrum
)
# extrinsic attributes
result += Parser.extendedValueToXML("antennaId", self._antennaId)
result += Parser.valueToXML("feedId", self._feedId)
result += Parser.extendedValueToXML("spectralWindowId", self._spectralWindowId)
# links, if any
result += "</row>\n"
return result
[docs] def setFromXML(self, xmlrow):
"""
Fill the values of this row from an XML string
that was produced by the toXML() method.
If xmlrow is a minidom.Element with a nodeName of row then
it will be used as is. Anything else that is not a string
is an error.
"""
rowdom = None
if isinstance(xmlrow, str):
xmldom = minidom.parseString(xmlrow)
rowdom = xmldom.firstChild
elif isinstance(xmlrow, minidom.Element):
rowdom = xmlrow
else:
raise ConversionException(
"xmlrow is not a string or a minidom.Element", "SysCalTable"
)
if rowdom.nodeName != "row":
raise ConversionException("the argument is not a row", "SysCalTable")
# intrinsic attribute values
timeIntervalNode = rowdom.getElementsByTagName("timeInterval")[0]
self._timeInterval = ArrayTimeInterval(timeIntervalNode.firstChild.data.strip())
numReceptorNode = rowdom.getElementsByTagName("numReceptor")[0]
self._numReceptor = int(numReceptorNode.firstChild.data.strip())
numChanNode = rowdom.getElementsByTagName("numChan")[0]
self._numChan = int(numChanNode.firstChild.data.strip())
tcalFlagNode = rowdom.getElementsByTagName("tcalFlag")
if len(tcalFlagNode) > 0:
self._tcalFlag = bool(tcalFlagNode[0].firstChild.data.strip())
self._tcalFlagExists = True
tcalSpectrumNode = rowdom.getElementsByTagName("tcalSpectrum")
if len(tcalSpectrumNode) > 0:
tcalSpectrumStr = tcalSpectrumNode[0].firstChild.data.strip()
self._tcalSpectrum = Parser.stringListToLists(
tcalSpectrumStr, Temperature, "SysCal", True
)
self._tcalSpectrumExists = True
trxFlagNode = rowdom.getElementsByTagName("trxFlag")
if len(trxFlagNode) > 0:
self._trxFlag = bool(trxFlagNode[0].firstChild.data.strip())
self._trxFlagExists = True
trxSpectrumNode = rowdom.getElementsByTagName("trxSpectrum")
if len(trxSpectrumNode) > 0:
trxSpectrumStr = trxSpectrumNode[0].firstChild.data.strip()
self._trxSpectrum = Parser.stringListToLists(
trxSpectrumStr, Temperature, "SysCal", True
)
self._trxSpectrumExists = True
tskyFlagNode = rowdom.getElementsByTagName("tskyFlag")
if len(tskyFlagNode) > 0:
self._tskyFlag = bool(tskyFlagNode[0].firstChild.data.strip())
self._tskyFlagExists = True
tskySpectrumNode = rowdom.getElementsByTagName("tskySpectrum")
if len(tskySpectrumNode) > 0:
tskySpectrumStr = tskySpectrumNode[0].firstChild.data.strip()
self._tskySpectrum = Parser.stringListToLists(
tskySpectrumStr, Temperature, "SysCal", True
)
self._tskySpectrumExists = True
tsysFlagNode = rowdom.getElementsByTagName("tsysFlag")
if len(tsysFlagNode) > 0:
self._tsysFlag = bool(tsysFlagNode[0].firstChild.data.strip())
self._tsysFlagExists = True
tsysSpectrumNode = rowdom.getElementsByTagName("tsysSpectrum")
if len(tsysSpectrumNode) > 0:
tsysSpectrumStr = tsysSpectrumNode[0].firstChild.data.strip()
self._tsysSpectrum = Parser.stringListToLists(
tsysSpectrumStr, Temperature, "SysCal", True
)
self._tsysSpectrumExists = True
tantFlagNode = rowdom.getElementsByTagName("tantFlag")
if len(tantFlagNode) > 0:
self._tantFlag = bool(tantFlagNode[0].firstChild.data.strip())
self._tantFlagExists = True
tantSpectrumNode = rowdom.getElementsByTagName("tantSpectrum")
if len(tantSpectrumNode) > 0:
tantSpectrumStr = tantSpectrumNode[0].firstChild.data.strip()
self._tantSpectrum = Parser.stringListToLists(
tantSpectrumStr, float, "SysCal", False
)
self._tantSpectrumExists = True
tantTsysFlagNode = rowdom.getElementsByTagName("tantTsysFlag")
if len(tantTsysFlagNode) > 0:
self._tantTsysFlag = bool(tantTsysFlagNode[0].firstChild.data.strip())
self._tantTsysFlagExists = True
tantTsysSpectrumNode = rowdom.getElementsByTagName("tantTsysSpectrum")
if len(tantTsysSpectrumNode) > 0:
tantTsysSpectrumStr = tantTsysSpectrumNode[0].firstChild.data.strip()
self._tantTsysSpectrum = Parser.stringListToLists(
tantTsysSpectrumStr, float, "SysCal", False
)
self._tantTsysSpectrumExists = True
phaseDiffFlagNode = rowdom.getElementsByTagName("phaseDiffFlag")
if len(phaseDiffFlagNode) > 0:
self._phaseDiffFlag = bool(phaseDiffFlagNode[0].firstChild.data.strip())
self._phaseDiffFlagExists = True
phaseDiffSpectrumNode = rowdom.getElementsByTagName("phaseDiffSpectrum")
if len(phaseDiffSpectrumNode) > 0:
phaseDiffSpectrumStr = phaseDiffSpectrumNode[0].firstChild.data.strip()
self._phaseDiffSpectrum = Parser.stringListToLists(
phaseDiffSpectrumStr, float, "SysCal", False
)
self._phaseDiffSpectrumExists = True
# extrinsic attribute values
antennaIdNode = rowdom.getElementsByTagName("antennaId")[0]
self._antennaId = Tag(antennaIdNode.firstChild.data.strip())
feedIdNode = rowdom.getElementsByTagName("feedId")[0]
self._feedId = int(feedIdNode.firstChild.data.strip())
spectralWindowIdNode = rowdom.getElementsByTagName("spectralWindowId")[0]
self._spectralWindowId = Tag(spectralWindowIdNode.firstChild.data.strip())
# from link values, if any
[docs] def toBin(self, eos):
"""
Write this row out to the EndianOutput instance, eos.
"""
self._antennaId.toBin(eos)
self._spectralWindowId.toBin(eos)
self._timeInterval.toBin(eos)
eos.writeInt(self._feedId)
eos.writeInt(self._numReceptor)
eos.writeInt(self._numChan)
eos.writeBool(self._tcalFlagExists)
if self._tcalFlagExists:
eos.writeBool(self._tcalFlag)
eos.writeBool(self._tcalSpectrumExists)
if self._tcalSpectrumExists:
Temperature.listToBin(self._tcalSpectrum, eos)
eos.writeBool(self._trxFlagExists)
if self._trxFlagExists:
eos.writeBool(self._trxFlag)
eos.writeBool(self._trxSpectrumExists)
if self._trxSpectrumExists:
Temperature.listToBin(self._trxSpectrum, eos)
eos.writeBool(self._tskyFlagExists)
if self._tskyFlagExists:
eos.writeBool(self._tskyFlag)
eos.writeBool(self._tskySpectrumExists)
if self._tskySpectrumExists:
Temperature.listToBin(self._tskySpectrum, eos)
eos.writeBool(self._tsysFlagExists)
if self._tsysFlagExists:
eos.writeBool(self._tsysFlag)
eos.writeBool(self._tsysSpectrumExists)
if self._tsysSpectrumExists:
Temperature.listToBin(self._tsysSpectrum, eos)
eos.writeBool(self._tantFlagExists)
if self._tantFlagExists:
eos.writeBool(self._tantFlag)
eos.writeBool(self._tantSpectrumExists)
if self._tantSpectrumExists:
# null array case, unsure if this is possible but this should work
if self._tantSpectrum is None:
eos.writeInt(0)
eos.writeInt(0)
else:
tantSpectrum_dims = pyasdm.utils.getListDims(self._tantSpectrum)
# assumes it really is 2D
eos.writeInt(tantSpectrum_dims[0])
eos.writeInt(tantSpectrum_dims[1])
for i in range(tantSpectrum_dims[0]):
for j in range(tantSpectrum_dims[1]):
eos.writeFloat(self._tantSpectrum[i][j])
eos.writeBool(self._tantTsysFlagExists)
if self._tantTsysFlagExists:
eos.writeBool(self._tantTsysFlag)
eos.writeBool(self._tantTsysSpectrumExists)
if self._tantTsysSpectrumExists:
# null array case, unsure if this is possible but this should work
if self._tantTsysSpectrum is None:
eos.writeInt(0)
eos.writeInt(0)
else:
tantTsysSpectrum_dims = pyasdm.utils.getListDims(self._tantTsysSpectrum)
# assumes it really is 2D
eos.writeInt(tantTsysSpectrum_dims[0])
eos.writeInt(tantTsysSpectrum_dims[1])
for i in range(tantTsysSpectrum_dims[0]):
for j in range(tantTsysSpectrum_dims[1]):
eos.writeFloat(self._tantTsysSpectrum[i][j])
eos.writeBool(self._phaseDiffFlagExists)
if self._phaseDiffFlagExists:
eos.writeBool(self._phaseDiffFlag)
eos.writeBool(self._phaseDiffSpectrumExists)
if self._phaseDiffSpectrumExists:
# null array case, unsure if this is possible but this should work
if self._phaseDiffSpectrum is None:
eos.writeInt(0)
eos.writeInt(0)
else:
phaseDiffSpectrum_dims = pyasdm.utils.getListDims(
self._phaseDiffSpectrum
)
# assumes it really is 2D
eos.writeInt(phaseDiffSpectrum_dims[0])
eos.writeInt(phaseDiffSpectrum_dims[1])
for i in range(phaseDiffSpectrum_dims[0]):
for j in range(phaseDiffSpectrum_dims[1]):
eos.writeFloat(self._phaseDiffSpectrum[i][j])
[docs] @staticmethod
def antennaIdFromBin(row, eis):
"""
Set the antennaId in row from the EndianInput (eis) instance.
"""
row._antennaId = Tag.fromBin(eis)
[docs] @staticmethod
def spectralWindowIdFromBin(row, eis):
"""
Set the spectralWindowId in row from the EndianInput (eis) instance.
"""
row._spectralWindowId = Tag.fromBin(eis)
[docs] @staticmethod
def timeIntervalFromBin(row, eis):
"""
Set the timeInterval in row from the EndianInput (eis) instance.
"""
row._timeInterval = ArrayTimeInterval.fromBin(eis)
[docs] @staticmethod
def feedIdFromBin(row, eis):
"""
Set the feedId in row from the EndianInput (eis) instance.
"""
row._feedId = eis.readInt()
[docs] @staticmethod
def numReceptorFromBin(row, eis):
"""
Set the numReceptor in row from the EndianInput (eis) instance.
"""
row._numReceptor = eis.readInt()
[docs] @staticmethod
def numChanFromBin(row, eis):
"""
Set the numChan in row from the EndianInput (eis) instance.
"""
row._numChan = eis.readInt()
[docs] @staticmethod
def tcalFlagFromBin(row, eis):
"""
Set the optional tcalFlag in row from the EndianInput (eis) instance.
"""
row._tcalFlagExists = eis.readBool()
if row._tcalFlagExists:
row._tcalFlag = eis.readBool()
[docs] @staticmethod
def tcalSpectrumFromBin(row, eis):
"""
Set the optional tcalSpectrum in row from the EndianInput (eis) instance.
"""
row._tcalSpectrumExists = eis.readBool()
if row._tcalSpectrumExists:
row._tcalSpectrum = Temperature.from2DBin(eis)
[docs] @staticmethod
def trxFlagFromBin(row, eis):
"""
Set the optional trxFlag in row from the EndianInput (eis) instance.
"""
row._trxFlagExists = eis.readBool()
if row._trxFlagExists:
row._trxFlag = eis.readBool()
[docs] @staticmethod
def trxSpectrumFromBin(row, eis):
"""
Set the optional trxSpectrum in row from the EndianInput (eis) instance.
"""
row._trxSpectrumExists = eis.readBool()
if row._trxSpectrumExists:
row._trxSpectrum = Temperature.from2DBin(eis)
[docs] @staticmethod
def tskyFlagFromBin(row, eis):
"""
Set the optional tskyFlag in row from the EndianInput (eis) instance.
"""
row._tskyFlagExists = eis.readBool()
if row._tskyFlagExists:
row._tskyFlag = eis.readBool()
[docs] @staticmethod
def tskySpectrumFromBin(row, eis):
"""
Set the optional tskySpectrum in row from the EndianInput (eis) instance.
"""
row._tskySpectrumExists = eis.readBool()
if row._tskySpectrumExists:
row._tskySpectrum = Temperature.from2DBin(eis)
[docs] @staticmethod
def tsysFlagFromBin(row, eis):
"""
Set the optional tsysFlag in row from the EndianInput (eis) instance.
"""
row._tsysFlagExists = eis.readBool()
if row._tsysFlagExists:
row._tsysFlag = eis.readBool()
[docs] @staticmethod
def tsysSpectrumFromBin(row, eis):
"""
Set the optional tsysSpectrum in row from the EndianInput (eis) instance.
"""
row._tsysSpectrumExists = eis.readBool()
if row._tsysSpectrumExists:
row._tsysSpectrum = Temperature.from2DBin(eis)
[docs] @staticmethod
def tantFlagFromBin(row, eis):
"""
Set the optional tantFlag in row from the EndianInput (eis) instance.
"""
row._tantFlagExists = eis.readBool()
if row._tantFlagExists:
row._tantFlag = eis.readBool()
[docs] @staticmethod
def tantSpectrumFromBin(row, eis):
"""
Set the optional tantSpectrum in row from the EndianInput (eis) instance.
"""
row._tantSpectrumExists = eis.readBool()
if row._tantSpectrumExists:
tantSpectrumDim1 = eis.readInt()
tantSpectrumDim2 = eis.readInt()
thisList = []
for i in range(tantSpectrumDim1):
thisList_j = []
for j in range(tantSpectrumDim2):
thisValue = eis.readFloat()
thisList_j.append(thisValue)
thisList.append(thisList_j)
row._tantSpectrum = thisList
[docs] @staticmethod
def tantTsysFlagFromBin(row, eis):
"""
Set the optional tantTsysFlag in row from the EndianInput (eis) instance.
"""
row._tantTsysFlagExists = eis.readBool()
if row._tantTsysFlagExists:
row._tantTsysFlag = eis.readBool()
[docs] @staticmethod
def tantTsysSpectrumFromBin(row, eis):
"""
Set the optional tantTsysSpectrum in row from the EndianInput (eis) instance.
"""
row._tantTsysSpectrumExists = eis.readBool()
if row._tantTsysSpectrumExists:
tantTsysSpectrumDim1 = eis.readInt()
tantTsysSpectrumDim2 = eis.readInt()
thisList = []
for i in range(tantTsysSpectrumDim1):
thisList_j = []
for j in range(tantTsysSpectrumDim2):
thisValue = eis.readFloat()
thisList_j.append(thisValue)
thisList.append(thisList_j)
row._tantTsysSpectrum = thisList
[docs] @staticmethod
def phaseDiffFlagFromBin(row, eis):
"""
Set the optional phaseDiffFlag in row from the EndianInput (eis) instance.
"""
row._phaseDiffFlagExists = eis.readBool()
if row._phaseDiffFlagExists:
row._phaseDiffFlag = eis.readBool()
[docs] @staticmethod
def phaseDiffSpectrumFromBin(row, eis):
"""
Set the optional phaseDiffSpectrum in row from the EndianInput (eis) instance.
"""
row._phaseDiffSpectrumExists = eis.readBool()
if row._phaseDiffSpectrumExists:
phaseDiffSpectrumDim1 = eis.readInt()
phaseDiffSpectrumDim2 = eis.readInt()
thisList = []
for i in range(phaseDiffSpectrumDim1):
thisList_j = []
for j in range(phaseDiffSpectrumDim2):
thisValue = eis.readFloat()
thisList_j.append(thisValue)
thisList.append(thisList_j)
row._phaseDiffSpectrum = thisList
[docs] @staticmethod
def initFromBinMethods():
global _fromBinMethods
if len(_fromBinMethods) > 0:
return
_fromBinMethods["antennaId"] = SysCalRow.antennaIdFromBin
_fromBinMethods["spectralWindowId"] = SysCalRow.spectralWindowIdFromBin
_fromBinMethods["timeInterval"] = SysCalRow.timeIntervalFromBin
_fromBinMethods["feedId"] = SysCalRow.feedIdFromBin
_fromBinMethods["numReceptor"] = SysCalRow.numReceptorFromBin
_fromBinMethods["numChan"] = SysCalRow.numChanFromBin
_fromBinMethods["tcalFlag"] = SysCalRow.tcalFlagFromBin
_fromBinMethods["tcalSpectrum"] = SysCalRow.tcalSpectrumFromBin
_fromBinMethods["trxFlag"] = SysCalRow.trxFlagFromBin
_fromBinMethods["trxSpectrum"] = SysCalRow.trxSpectrumFromBin
_fromBinMethods["tskyFlag"] = SysCalRow.tskyFlagFromBin
_fromBinMethods["tskySpectrum"] = SysCalRow.tskySpectrumFromBin
_fromBinMethods["tsysFlag"] = SysCalRow.tsysFlagFromBin
_fromBinMethods["tsysSpectrum"] = SysCalRow.tsysSpectrumFromBin
_fromBinMethods["tantFlag"] = SysCalRow.tantFlagFromBin
_fromBinMethods["tantSpectrum"] = SysCalRow.tantSpectrumFromBin
_fromBinMethods["tantTsysFlag"] = SysCalRow.tantTsysFlagFromBin
_fromBinMethods["tantTsysSpectrum"] = SysCalRow.tantTsysSpectrumFromBin
_fromBinMethods["phaseDiffFlag"] = SysCalRow.phaseDiffFlagFromBin
_fromBinMethods["phaseDiffSpectrum"] = SysCalRow.phaseDiffSpectrumFromBin
[docs] @staticmethod
def fromBin(eis, table, attributesSeq):
"""
Given an EndianInput instance by the table (which must be a Pointing instance) and
the list of attributes to be found in eis, in order, this constructs a row by
pulling off values from that EndianInput in the expected order.
The new row object is returned.
"""
global _fromBinMethods
row = SysCalRow(table)
for attributeName in attributesSeq:
if attributeName not in _fromBinMethods:
raise ConversionException(
"There is not a method to read an attribute '"
+ attributeName
+ "'.",
" SysCal",
)
method = _fromBinMethods[attributeName]
method(row, eis)
return row
# Intrinsice Table Attributes
# ===> Attribute timeInterval
_timeInterval = ArrayTimeInterval()
[docs] def getTimeInterval(self):
"""
Get timeInterval.
return timeInterval as ArrayTimeInterval
"""
# make sure it is a copy of ArrayTimeInterval
return ArrayTimeInterval(self._timeInterval)
[docs] def setTimeInterval(self, timeInterval):
"""
Set timeInterval with the specified ArrayTimeInterval value.
timeInterval The ArrayTimeInterval value to which timeInterval is to be set.
The value of timeInterval can be anything allowed by the ArrayTimeInterval constructor.
Raises a ValueError If an attempt is made to change a part of the key after is has been added to the table.
"""
if self._hasBeenAdded:
raise ValueError(
"Attempt to change the timeInterval field, which is part of the key, after this row has been added to this table."
)
self._timeInterval = ArrayTimeInterval(timeInterval)
# ===> Attribute numReceptor
_numReceptor = 0
[docs] def getNumReceptor(self):
"""
Get numReceptor.
return numReceptor as int
"""
return self._numReceptor
[docs] def setNumReceptor(self, numReceptor):
"""
Set numReceptor with the specified int value.
numReceptor The int value to which numReceptor is to be set.
"""
self._numReceptor = int(numReceptor)
# ===> Attribute numChan
_numChan = 0
[docs] def getNumChan(self):
"""
Get numChan.
return numChan as int
"""
return self._numChan
[docs] def setNumChan(self, numChan):
"""
Set numChan with the specified int value.
numChan The int value to which numChan is to be set.
"""
self._numChan = int(numChan)
# ===> Attribute tcalFlag, which is optional
_tcalFlagExists = False
_tcalFlag = None
[docs] def isTcalFlagExists(self):
"""
The attribute tcalFlag is optional. Return True if this attribute exists.
return True if and only if the tcalFlag attribute exists.
"""
return self._tcalFlagExists
[docs] def getTcalFlag(self):
"""
Get tcalFlag, which is optional.
return tcalFlag as bool
raises ValueError If tcalFlag does not exist.
"""
if not self._tcalFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tcalFlag
+ " attribute in table SysCal does not exist!"
)
return self._tcalFlag
[docs] def setTcalFlag(self, tcalFlag):
"""
Set tcalFlag with the specified bool value.
tcalFlag The bool value to which tcalFlag is to be set.
"""
self._tcalFlag = bool(tcalFlag)
self._tcalFlagExists = True
[docs] def clearTcalFlag(self):
"""
Mark tcalFlag, which is an optional field, as non-existent.
"""
self._tcalFlagExists = False
# ===> Attribute tcalSpectrum, which is optional
_tcalSpectrumExists = False
_tcalSpectrum = None # this is a 2D list of Temperature
[docs] def isTcalSpectrumExists(self):
"""
The attribute tcalSpectrum is optional. Return True if this attribute exists.
return True if and only if the tcalSpectrum attribute exists.
"""
return self._tcalSpectrumExists
[docs] def getTcalSpectrum(self):
"""
Get tcalSpectrum, which is optional.
return tcalSpectrum as Temperature [] []
raises ValueError If tcalSpectrum does not exist.
"""
if not self._tcalSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tcalSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._tcalSpectrum)
[docs] def setTcalSpectrum(self, tcalSpectrum):
"""
Set tcalSpectrum with the specified Temperature [] [] value.
tcalSpectrum The Temperature [] [] value to which tcalSpectrum is to be set.
The value of tcalSpectrum can be anything allowed by the Temperature [] [] constructor.
"""
# value must be a list
if not isinstance(tcalSpectrum, list):
raise ValueError("The value of tcalSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(tcalSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of tcalSpectrum is not correct")
# the type of the values in the list must be Temperature
# note : this only checks the first value found
if not pyasdm.utils.checkListType(tcalSpectrum, Temperature):
raise ValueError(
"type of the first value in tcalSpectrum is not Temperature as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._tcalSpectrum = copy.deepcopy(tcalSpectrum)
except Exception as exc:
raise ValueError("Invalid tcalSpectrum : " + str(exc))
self._tcalSpectrumExists = True
[docs] def clearTcalSpectrum(self):
"""
Mark tcalSpectrum, which is an optional field, as non-existent.
"""
self._tcalSpectrumExists = False
# ===> Attribute trxFlag, which is optional
_trxFlagExists = False
_trxFlag = None
[docs] def isTrxFlagExists(self):
"""
The attribute trxFlag is optional. Return True if this attribute exists.
return True if and only if the trxFlag attribute exists.
"""
return self._trxFlagExists
[docs] def getTrxFlag(self):
"""
Get trxFlag, which is optional.
return trxFlag as bool
raises ValueError If trxFlag does not exist.
"""
if not self._trxFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ trxFlag
+ " attribute in table SysCal does not exist!"
)
return self._trxFlag
[docs] def setTrxFlag(self, trxFlag):
"""
Set trxFlag with the specified bool value.
trxFlag The bool value to which trxFlag is to be set.
"""
self._trxFlag = bool(trxFlag)
self._trxFlagExists = True
[docs] def clearTrxFlag(self):
"""
Mark trxFlag, which is an optional field, as non-existent.
"""
self._trxFlagExists = False
# ===> Attribute trxSpectrum, which is optional
_trxSpectrumExists = False
_trxSpectrum = None # this is a 2D list of Temperature
[docs] def isTrxSpectrumExists(self):
"""
The attribute trxSpectrum is optional. Return True if this attribute exists.
return True if and only if the trxSpectrum attribute exists.
"""
return self._trxSpectrumExists
[docs] def getTrxSpectrum(self):
"""
Get trxSpectrum, which is optional.
return trxSpectrum as Temperature [] []
raises ValueError If trxSpectrum does not exist.
"""
if not self._trxSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ trxSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._trxSpectrum)
[docs] def setTrxSpectrum(self, trxSpectrum):
"""
Set trxSpectrum with the specified Temperature [] [] value.
trxSpectrum The Temperature [] [] value to which trxSpectrum is to be set.
The value of trxSpectrum can be anything allowed by the Temperature [] [] constructor.
"""
# value must be a list
if not isinstance(trxSpectrum, list):
raise ValueError("The value of trxSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(trxSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of trxSpectrum is not correct")
# the type of the values in the list must be Temperature
# note : this only checks the first value found
if not pyasdm.utils.checkListType(trxSpectrum, Temperature):
raise ValueError(
"type of the first value in trxSpectrum is not Temperature as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._trxSpectrum = copy.deepcopy(trxSpectrum)
except Exception as exc:
raise ValueError("Invalid trxSpectrum : " + str(exc))
self._trxSpectrumExists = True
[docs] def clearTrxSpectrum(self):
"""
Mark trxSpectrum, which is an optional field, as non-existent.
"""
self._trxSpectrumExists = False
# ===> Attribute tskyFlag, which is optional
_tskyFlagExists = False
_tskyFlag = None
[docs] def isTskyFlagExists(self):
"""
The attribute tskyFlag is optional. Return True if this attribute exists.
return True if and only if the tskyFlag attribute exists.
"""
return self._tskyFlagExists
[docs] def getTskyFlag(self):
"""
Get tskyFlag, which is optional.
return tskyFlag as bool
raises ValueError If tskyFlag does not exist.
"""
if not self._tskyFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tskyFlag
+ " attribute in table SysCal does not exist!"
)
return self._tskyFlag
[docs] def setTskyFlag(self, tskyFlag):
"""
Set tskyFlag with the specified bool value.
tskyFlag The bool value to which tskyFlag is to be set.
"""
self._tskyFlag = bool(tskyFlag)
self._tskyFlagExists = True
[docs] def clearTskyFlag(self):
"""
Mark tskyFlag, which is an optional field, as non-existent.
"""
self._tskyFlagExists = False
# ===> Attribute tskySpectrum, which is optional
_tskySpectrumExists = False
_tskySpectrum = None # this is a 2D list of Temperature
[docs] def isTskySpectrumExists(self):
"""
The attribute tskySpectrum is optional. Return True if this attribute exists.
return True if and only if the tskySpectrum attribute exists.
"""
return self._tskySpectrumExists
[docs] def getTskySpectrum(self):
"""
Get tskySpectrum, which is optional.
return tskySpectrum as Temperature [] []
raises ValueError If tskySpectrum does not exist.
"""
if not self._tskySpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tskySpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._tskySpectrum)
[docs] def setTskySpectrum(self, tskySpectrum):
"""
Set tskySpectrum with the specified Temperature [] [] value.
tskySpectrum The Temperature [] [] value to which tskySpectrum is to be set.
The value of tskySpectrum can be anything allowed by the Temperature [] [] constructor.
"""
# value must be a list
if not isinstance(tskySpectrum, list):
raise ValueError("The value of tskySpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(tskySpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of tskySpectrum is not correct")
# the type of the values in the list must be Temperature
# note : this only checks the first value found
if not pyasdm.utils.checkListType(tskySpectrum, Temperature):
raise ValueError(
"type of the first value in tskySpectrum is not Temperature as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._tskySpectrum = copy.deepcopy(tskySpectrum)
except Exception as exc:
raise ValueError("Invalid tskySpectrum : " + str(exc))
self._tskySpectrumExists = True
[docs] def clearTskySpectrum(self):
"""
Mark tskySpectrum, which is an optional field, as non-existent.
"""
self._tskySpectrumExists = False
# ===> Attribute tsysFlag, which is optional
_tsysFlagExists = False
_tsysFlag = None
[docs] def isTsysFlagExists(self):
"""
The attribute tsysFlag is optional. Return True if this attribute exists.
return True if and only if the tsysFlag attribute exists.
"""
return self._tsysFlagExists
[docs] def getTsysFlag(self):
"""
Get tsysFlag, which is optional.
return tsysFlag as bool
raises ValueError If tsysFlag does not exist.
"""
if not self._tsysFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tsysFlag
+ " attribute in table SysCal does not exist!"
)
return self._tsysFlag
[docs] def setTsysFlag(self, tsysFlag):
"""
Set tsysFlag with the specified bool value.
tsysFlag The bool value to which tsysFlag is to be set.
"""
self._tsysFlag = bool(tsysFlag)
self._tsysFlagExists = True
[docs] def clearTsysFlag(self):
"""
Mark tsysFlag, which is an optional field, as non-existent.
"""
self._tsysFlagExists = False
# ===> Attribute tsysSpectrum, which is optional
_tsysSpectrumExists = False
_tsysSpectrum = None # this is a 2D list of Temperature
[docs] def isTsysSpectrumExists(self):
"""
The attribute tsysSpectrum is optional. Return True if this attribute exists.
return True if and only if the tsysSpectrum attribute exists.
"""
return self._tsysSpectrumExists
[docs] def getTsysSpectrum(self):
"""
Get tsysSpectrum, which is optional.
return tsysSpectrum as Temperature [] []
raises ValueError If tsysSpectrum does not exist.
"""
if not self._tsysSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tsysSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._tsysSpectrum)
[docs] def setTsysSpectrum(self, tsysSpectrum):
"""
Set tsysSpectrum with the specified Temperature [] [] value.
tsysSpectrum The Temperature [] [] value to which tsysSpectrum is to be set.
The value of tsysSpectrum can be anything allowed by the Temperature [] [] constructor.
"""
# value must be a list
if not isinstance(tsysSpectrum, list):
raise ValueError("The value of tsysSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(tsysSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of tsysSpectrum is not correct")
# the type of the values in the list must be Temperature
# note : this only checks the first value found
if not pyasdm.utils.checkListType(tsysSpectrum, Temperature):
raise ValueError(
"type of the first value in tsysSpectrum is not Temperature as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._tsysSpectrum = copy.deepcopy(tsysSpectrum)
except Exception as exc:
raise ValueError("Invalid tsysSpectrum : " + str(exc))
self._tsysSpectrumExists = True
[docs] def clearTsysSpectrum(self):
"""
Mark tsysSpectrum, which is an optional field, as non-existent.
"""
self._tsysSpectrumExists = False
# ===> Attribute tantFlag, which is optional
_tantFlagExists = False
_tantFlag = None
[docs] def isTantFlagExists(self):
"""
The attribute tantFlag is optional. Return True if this attribute exists.
return True if and only if the tantFlag attribute exists.
"""
return self._tantFlagExists
[docs] def getTantFlag(self):
"""
Get tantFlag, which is optional.
return tantFlag as bool
raises ValueError If tantFlag does not exist.
"""
if not self._tantFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tantFlag
+ " attribute in table SysCal does not exist!"
)
return self._tantFlag
[docs] def setTantFlag(self, tantFlag):
"""
Set tantFlag with the specified bool value.
tantFlag The bool value to which tantFlag is to be set.
"""
self._tantFlag = bool(tantFlag)
self._tantFlagExists = True
[docs] def clearTantFlag(self):
"""
Mark tantFlag, which is an optional field, as non-existent.
"""
self._tantFlagExists = False
# ===> Attribute tantSpectrum, which is optional
_tantSpectrumExists = False
_tantSpectrum = None # this is a 2D list of float
[docs] def isTantSpectrumExists(self):
"""
The attribute tantSpectrum is optional. Return True if this attribute exists.
return True if and only if the tantSpectrum attribute exists.
"""
return self._tantSpectrumExists
[docs] def getTantSpectrum(self):
"""
Get tantSpectrum, which is optional.
return tantSpectrum as float [] []
raises ValueError If tantSpectrum does not exist.
"""
if not self._tantSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tantSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._tantSpectrum)
[docs] def setTantSpectrum(self, tantSpectrum):
"""
Set tantSpectrum with the specified float [] [] value.
tantSpectrum The float [] [] value to which tantSpectrum is to be set.
"""
# value must be a list
if not isinstance(tantSpectrum, list):
raise ValueError("The value of tantSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(tantSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of tantSpectrum is not correct")
# the type of the values in the list must be float
# note : this only checks the first value found
if not pyasdm.utils.checkListType(tantSpectrum, float):
raise ValueError(
"type of the first value in tantSpectrum is not float as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._tantSpectrum = copy.deepcopy(tantSpectrum)
except Exception as exc:
raise ValueError("Invalid tantSpectrum : " + str(exc))
self._tantSpectrumExists = True
[docs] def clearTantSpectrum(self):
"""
Mark tantSpectrum, which is an optional field, as non-existent.
"""
self._tantSpectrumExists = False
# ===> Attribute tantTsysFlag, which is optional
_tantTsysFlagExists = False
_tantTsysFlag = None
[docs] def isTantTsysFlagExists(self):
"""
The attribute tantTsysFlag is optional. Return True if this attribute exists.
return True if and only if the tantTsysFlag attribute exists.
"""
return self._tantTsysFlagExists
[docs] def getTantTsysFlag(self):
"""
Get tantTsysFlag, which is optional.
return tantTsysFlag as bool
raises ValueError If tantTsysFlag does not exist.
"""
if not self._tantTsysFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tantTsysFlag
+ " attribute in table SysCal does not exist!"
)
return self._tantTsysFlag
[docs] def setTantTsysFlag(self, tantTsysFlag):
"""
Set tantTsysFlag with the specified bool value.
tantTsysFlag The bool value to which tantTsysFlag is to be set.
"""
self._tantTsysFlag = bool(tantTsysFlag)
self._tantTsysFlagExists = True
[docs] def clearTantTsysFlag(self):
"""
Mark tantTsysFlag, which is an optional field, as non-existent.
"""
self._tantTsysFlagExists = False
# ===> Attribute tantTsysSpectrum, which is optional
_tantTsysSpectrumExists = False
_tantTsysSpectrum = None # this is a 2D list of float
[docs] def isTantTsysSpectrumExists(self):
"""
The attribute tantTsysSpectrum is optional. Return True if this attribute exists.
return True if and only if the tantTsysSpectrum attribute exists.
"""
return self._tantTsysSpectrumExists
[docs] def getTantTsysSpectrum(self):
"""
Get tantTsysSpectrum, which is optional.
return tantTsysSpectrum as float [] []
raises ValueError If tantTsysSpectrum does not exist.
"""
if not self._tantTsysSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ tantTsysSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._tantTsysSpectrum)
[docs] def setTantTsysSpectrum(self, tantTsysSpectrum):
"""
Set tantTsysSpectrum with the specified float [] [] value.
tantTsysSpectrum The float [] [] value to which tantTsysSpectrum is to be set.
"""
# value must be a list
if not isinstance(tantTsysSpectrum, list):
raise ValueError("The value of tantTsysSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(tantTsysSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of tantTsysSpectrum is not correct")
# the type of the values in the list must be float
# note : this only checks the first value found
if not pyasdm.utils.checkListType(tantTsysSpectrum, float):
raise ValueError(
"type of the first value in tantTsysSpectrum is not float as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._tantTsysSpectrum = copy.deepcopy(tantTsysSpectrum)
except Exception as exc:
raise ValueError("Invalid tantTsysSpectrum : " + str(exc))
self._tantTsysSpectrumExists = True
[docs] def clearTantTsysSpectrum(self):
"""
Mark tantTsysSpectrum, which is an optional field, as non-existent.
"""
self._tantTsysSpectrumExists = False
# ===> Attribute phaseDiffFlag, which is optional
_phaseDiffFlagExists = False
_phaseDiffFlag = None
[docs] def isPhaseDiffFlagExists(self):
"""
The attribute phaseDiffFlag is optional. Return True if this attribute exists.
return True if and only if the phaseDiffFlag attribute exists.
"""
return self._phaseDiffFlagExists
[docs] def getPhaseDiffFlag(self):
"""
Get phaseDiffFlag, which is optional.
return phaseDiffFlag as bool
raises ValueError If phaseDiffFlag does not exist.
"""
if not self._phaseDiffFlagExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ phaseDiffFlag
+ " attribute in table SysCal does not exist!"
)
return self._phaseDiffFlag
[docs] def setPhaseDiffFlag(self, phaseDiffFlag):
"""
Set phaseDiffFlag with the specified bool value.
phaseDiffFlag The bool value to which phaseDiffFlag is to be set.
"""
self._phaseDiffFlag = bool(phaseDiffFlag)
self._phaseDiffFlagExists = True
[docs] def clearPhaseDiffFlag(self):
"""
Mark phaseDiffFlag, which is an optional field, as non-existent.
"""
self._phaseDiffFlagExists = False
# ===> Attribute phaseDiffSpectrum, which is optional
_phaseDiffSpectrumExists = False
_phaseDiffSpectrum = None # this is a 2D list of float
[docs] def isPhaseDiffSpectrumExists(self):
"""
The attribute phaseDiffSpectrum is optional. Return True if this attribute exists.
return True if and only if the phaseDiffSpectrum attribute exists.
"""
return self._phaseDiffSpectrumExists
[docs] def getPhaseDiffSpectrum(self):
"""
Get phaseDiffSpectrum, which is optional.
return phaseDiffSpectrum as float [] []
raises ValueError If phaseDiffSpectrum does not exist.
"""
if not self._phaseDiffSpectrumExists:
raise ValueError(
"Attempt to access a non-existent attribute. The "
+ phaseDiffSpectrum
+ " attribute in table SysCal does not exist!"
)
return copy.deepcopy(self._phaseDiffSpectrum)
[docs] def setPhaseDiffSpectrum(self, phaseDiffSpectrum):
"""
Set phaseDiffSpectrum with the specified float [] [] value.
phaseDiffSpectrum The float [] [] value to which phaseDiffSpectrum is to be set.
"""
# value must be a list
if not isinstance(phaseDiffSpectrum, list):
raise ValueError("The value of phaseDiffSpectrum must be a list")
# check the shape
try:
listDims = pyasdm.utils.getListDims(phaseDiffSpectrum)
shapeOK = len(listDims) == 2
if not shapeOK:
raise ValueError("shape of phaseDiffSpectrum is not correct")
# the type of the values in the list must be float
# note : this only checks the first value found
if not pyasdm.utils.checkListType(phaseDiffSpectrum, float):
raise ValueError(
"type of the first value in phaseDiffSpectrum is not float as expected"
)
# finally, (reasonably) safe to just do a deepcopy
self._phaseDiffSpectrum = copy.deepcopy(phaseDiffSpectrum)
except Exception as exc:
raise ValueError("Invalid phaseDiffSpectrum : " + str(exc))
self._phaseDiffSpectrumExists = True
[docs] def clearPhaseDiffSpectrum(self):
"""
Mark phaseDiffSpectrum, which is an optional field, as non-existent.
"""
self._phaseDiffSpectrumExists = False
# Extrinsic Table Attributes
# ===> Attribute antennaId
_antennaId = Tag()
[docs] def getAntennaId(self):
"""
Get antennaId.
return antennaId as Tag
"""
# make sure it is a copy of Tag
return Tag(self._antennaId)
[docs] def setAntennaId(self, antennaId):
"""
Set antennaId with the specified Tag value.
antennaId The Tag value to which antennaId is to be set.
The value of antennaId can be anything allowed by the Tag constructor.
Raises a ValueError If an attempt is made to change a part of the key after is has been added to the table.
"""
if self._hasBeenAdded:
raise ValueError(
"Attempt to change the antennaId field, which is part of the key, after this row has been added to this table."
)
self._antennaId = Tag(antennaId)
# ===> Attribute feedId
_feedId = 0
[docs] def getFeedId(self):
"""
Get feedId.
return feedId as int
"""
return self._feedId
[docs] def setFeedId(self, feedId):
"""
Set feedId with the specified int value.
feedId The int value to which feedId is to be set.
Raises a ValueError If an attempt is made to change a part of the key after is has been added to the table.
"""
if self._hasBeenAdded:
raise ValueError(
"Attempt to change the feedId field, which is part of the key, after this row has been added to this table."
)
self._feedId = int(feedId)
# ===> Attribute spectralWindowId
_spectralWindowId = Tag()
[docs] def getSpectralWindowId(self):
"""
Get spectralWindowId.
return spectralWindowId as Tag
"""
# make sure it is a copy of Tag
return Tag(self._spectralWindowId)
[docs] def setSpectralWindowId(self, spectralWindowId):
"""
Set spectralWindowId with the specified Tag value.
spectralWindowId The Tag value to which spectralWindowId is to be set.
The value of spectralWindowId can be anything allowed by the Tag constructor.
Raises a ValueError If an attempt is made to change a part of the key after is has been added to the table.
"""
if self._hasBeenAdded:
raise ValueError(
"Attempt to change the spectralWindowId field, which is part of the key, after this row has been added to this table."
)
self._spectralWindowId = Tag(spectralWindowId)
# Links
[docs] def getAntennaUsingAntennaId(self):
"""
Returns the row in the Antenna table having Antenna.antennaId == antennaId
"""
return self._table.getContainer().getAntenna().getRowByKey(self._antennaId)
# ===> Slice link from a row of SysCal table to a collection of row of Feed table.
[docs] def getFeeds(self):
"""
Get the collection of rows in the Feed table having feedId == this.feedId
"""
return self._table.getContainer().getFeed().getRowByFeedId(self._feedId)
[docs] def getSpectralWindowUsingSpectralWindowId(self):
"""
Returns the row in the SpectralWindow table having SpectralWindow.spectralWindowId == spectralWindowId
"""
return (
self._table.getContainer()
.getSpectralWindow()
.getRowByKey(self._spectralWindowId)
)
# comparison methods
[docs] def compareNoAutoInc(
self, antennaId, spectralWindowId, timeInterval, feedId, numReceptor, numChan
):
"""
Compare each attribute except the autoincrementable one of this SysCalRow with
the corresponding parameters and return True if there is a match and False otherwise.
"""
# antennaId is a Tag, compare using the equals method.
if not self._antennaId.equals(antennaId):
return False
# spectralWindowId is a Tag, compare using the equals method.
if not self._spectralWindowId.equals(spectralWindowId):
return False
# timeInterval is a ArrayTimeInterval, compare using the equals method.
if not self._timeInterval.equals(timeInterval):
return False
# feedId is a int, compare using the == operator.
if not (self._feedId == feedId):
return False
# numReceptor is a int, compare using the == operator.
if not (self._numReceptor == numReceptor):
return False
# numChan is a int, compare using the == operator.
if not (self._numChan == numChan):
return False
return True
[docs] def equalByRequiredValue(self, otherRow):
"""
Return True if all required attributes of the value part are equal to their homologues
in otherRow and False otherwise.
"""
return self.compareRequiredValue(
otherRow.getNumReceptor(), otherRow.getNumChan()
)
[docs] def compareRequiredValue(self, numReceptor, numChan):
# numReceptor is a int, compare using the == operator.
if not (self._numReceptor == numReceptor):
return False
# numChan is a int, compare using the == operator.
if not (self._numChan == numChan):
return False
return True
# initialize the dictionary that maps fields to init methods
SysCalRow.initFromBinMethods()