Skip to content
Snippets Groups Projects
Commit 30c0a51e authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

Task #9091 - First fully functional version. Needs checking for possibly...

Task #9091 - First fully functional version. Needs checking for possibly missing optional types, proper cmake tests, and convenience constants
parent a77aa034
No related branches found
No related tags found
No related merge requests found
...@@ -35,9 +35,8 @@ VERSION = "SIPlib 0.1" ...@@ -35,9 +35,8 @@ VERSION = "SIPlib 0.1"
# To get list of permitted values, e.g. do: print ltasip.StationTypeType.values() # To get list of permitted values, e.g. do: print ltasip.StationTypeType.values()
# But maybe we want to define these as constants in here? # But maybe we want to define these as constants in here?
# todo: find a nice way to define the stations. # todo: find a nice way to define the different stations
# Probably create a Station class for this # -> how to define a full set of existing stations and their different antennafield options without redundancy?
# We should prepare a dictionary with all present
# todo: create docstrings for everything. # todo: create docstrings for everything.
# specify types and explain purpose of the field (-> ask someone with more astronomical background) # specify types and explain purpose of the field (-> ask someone with more astronomical background)
...@@ -51,89 +50,105 @@ VERSION = "SIPlib 0.1" ...@@ -51,89 +50,105 @@ VERSION = "SIPlib 0.1"
# =============================== # ===============================
# Station definitions: # Station definitions:
# todo: This is preliminary! (see above)
# create station
afield = ltasip.AntennaField(name="HBA", location=ltasip.Coordinates("ITRF2005",ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m")))
afield2 = ltasip.AntennaField(name="LBA", location=ltasip.Coordinates("ITRF2005",ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m")))
stationA = ltasip.Station(name="Bielefeld",stationType=ltasip.StationTypeType("International"))
stationA.antennaField.append(afield)
stationA.antennaField.append(afield2)
# create station class Station():
afield = ltasip.AntennaField(name="HBA", location=ltasip.Coordinates("ITRF2005",ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"))) def __init__(self,
afield2 = ltasip.AntennaField(name="LBA", location=ltasip.Coordinates("ITRF2005",ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"),ltasip.Length(2.0, units="m"))) name,
stationB = ltasip.Station(name="Dwingeloo",stationType=ltasip.StationTypeType("Core")) type,
stationB.antennaField.append(afield) antennafield1,
stationB.antennaField.append(afield2) antennafield2=None
):
# create station dict: __afields=[antennafield1.get_pyxb_antennafield()]
STATIONS = dict(stationA=stationA, if antennafield2:
stationB=stationB) __afields.append(antennafield2.get_pyxb_antennafield())
self.__pyxb_station=ltasip.Station(
name=name,
stationType=type,
antennaField=__afields
)
# ############################################################################################# def get_pyxb_station(self):
return self.__pyxb_station
class AntennafieldXYZ():
def __init__(self,
type,
coordinate_system,
coordinate_x,
coordinate_y,
coordinate_z,
coordinate_unit):
self.__pyxb_antennafield=ltasip.AntennaField(
name=type,
location=ltasip.Coordinates(
coordinateSystem=coordinate_system,
x=ltasip.Length(coordinate_x, units=coordinate_unit),
y=ltasip.Length(coordinate_y, units=coordinate_unit),
z=ltasip.Length(coordinate_z, units=coordinate_unit)
)
)
# ============== def get_pyxb_antennafield(self):
# Processes: return self.__pyxb_antennafield
class ProcessMap(): class AntennafieldRadLonLat():
def __init__(self, def __init__(self,
strategyname, type,
strategydescription, coordinate_system,
starttime, coordinate_radius,
duration, coordinate_radiusunit,
observation_source, coordinate_longitude,
observation_id, coordinate_latitude,
process_source, coordinate_lonlatunit,
process_id,
relations,
parset_source=None,
parset_id=None,
): ):
self.__pyxb_antennafield=ltasip.AntennaField(
name=type,
location=ltasip.Coordinates(
coordinateSystem=coordinate_system,
radius=ltasip.Length(coordinate_radius, units=coordinate_radiusunit),
longitude=ltasip.Angle(coordinate_longitude, units=coordinate_lonlatunit),
latitude=ltasip.Angle(coordinate_latitude, units=coordinate_lonlatunit)
)
)
__relations=ltasip.ProcessRelations() def get_pyxb_antennafield(self):
for rel in relations: return self.__pyxb_antennafield
__relations.append(rel.get_pyxb_processrelation())
self.process_map = dict(processIdentifier=ltasip.IdentifierType(source=process_source, identifier=process_id),
observationId=ltasip.IdentifierType(source=observation_source, identifier=observation_id),
relations=__relations,
strategyName=strategyname, strategyDescription=strategydescription, startTime=starttime,
duration=duration)
if parset_id and parset_source:
self.process_map["parset"]=ltasip.IdentifierType(source=parset_source,identifier=parset_id)
def get_dict(self):
return self.process_map
class ProcessRelation(): # todo: This is preliminary! (see above)
def __init__(self, STATION_1 = Station(
identifier_source, name="station1",
identifier, type="Core",
name=None, antennafield1=AntennafieldXYZ(
type="GroupID" type="HBA0",
): coordinate_system="ITRF2005",
coordinate_x=2,coordinate_y=2,coordinate_z=3.0,coordinate_unit="m"),
antennafield2=AntennafieldRadLonLat(
type="HBA1",
coordinate_system="ITRF2005",
coordinate_radius=2,
coordinate_radiusunit="m",
coordinate_longitude=5,
coordinate_latitude=6,
coordinate_lonlatunit="degrees")
)
self.__pyxb_processrelation=ltasip.ProcessRelation( STATION_2 = Station(
relationType=ltasip.ProcessRelationType(type), name="station2",
identifier=ltasip.IdentifierType( type="Remote",
source=identifier_source, antennafield1=AntennafieldXYZ(
identifier=identifier, type="HBA",
name=name) coordinate_system="ITRF2005",
coordinate_x=2,coordinate_y=2,coordinate_z=3.0,coordinate_unit="m"),
) )
def get_pyxb_processrelation(self):
return self.__pyxb_processrelation
class SimpleProcess(): # #############################################################################################
def __init__(self, process_map):
self.pyxb_process = ltasip.Process(**process_map.get_dict())
def get_pyxb_process(self):
return self.pyxb_process
# ============ # ============
...@@ -175,6 +190,7 @@ class ImagingPipeline(): ...@@ -175,6 +190,7 @@ class ImagingPipeline():
def __init__(self, def __init__(self,
pipeline_map, pipeline_map,
imagerintegrationtime, imagerintegrationtime,
imagerintegrationtime_unit,
numberofmajorcycles, numberofmajorcycles,
numberofinstrumentmodels, numberofinstrumentmodels,
numberofcorrelateddataproducts, numberofcorrelateddataproducts,
...@@ -189,7 +205,7 @@ class ImagingPipeline(): ...@@ -189,7 +205,7 @@ class ImagingPipeline():
timeIntegrationStep=timeintegrationstep, timeIntegrationStep=timeintegrationstep,
skyModelDatabase=skymodeldatabase, skyModelDatabase=skymodeldatabase,
demixing=demixing, demixing=demixing,
imagerIntegrationTime=imagerintegrationtime, imagerIntegrationTime=(ltasip.Time(imagerintegrationtime, units=imagerintegrationtime_unit)),
numberOfMajorCycles=numberofmajorcycles, numberOfMajorCycles=numberofmajorcycles,
numberOfInstrumentModels=numberofinstrumentmodels, numberOfInstrumentModels=numberofinstrumentmodels,
numberOfCorrelatedDataProducts=numberofcorrelateddataproducts, numberOfCorrelatedDataProducts=numberofcorrelateddataproducts,
...@@ -233,7 +249,7 @@ class AveragingPipeline(): ...@@ -233,7 +249,7 @@ class AveragingPipeline():
timeintegrationstep, timeintegrationstep,
flagautocorrelations, flagautocorrelations,
demixing): demixing):
self.__pyxb_pipeline=ltasip.CalibrationPipeline( self.__pyxb_pipeline=ltasip.AveragingPipeline(
frequencyIntegrationStep=frequencyintegrationstep, frequencyIntegrationStep=frequencyintegrationstep,
timeIntegrationStep=timeintegrationstep, timeIntegrationStep=timeintegrationstep,
flagAutoCorrelations=flagautocorrelations, flagAutoCorrelations=flagautocorrelations,
...@@ -253,7 +269,7 @@ class PulsarPipeline(): ...@@ -253,7 +269,7 @@ class PulsarPipeline():
pulsars, pulsars,
dosinglepulseanalysis, dosinglepulseanalysis,
convertRawTo8bit, convertRawTo8bit,
subintegrationLength, subintegrationlength,
subintegrationlength_unit, subintegrationlength_unit,
skiprfiexcision, skiprfiexcision,
skipdatafolding, skipdatafolding,
...@@ -263,12 +279,12 @@ class PulsarPipeline(): ...@@ -263,12 +279,12 @@ class PulsarPipeline():
skipdynamicspectrum, skipdynamicspectrum,
skipprefold): skipprefold):
self.__pyxb_dataproduct=ltasip.PulsarPipeline( self.__pyxb_pipeline=ltasip.PulsarPipeline(
pulsarSelection=pulsarselection, pulsarSelection=pulsarselection,
pulsars=pulsars, pulsars=pulsars,
doSinglePulseAnalysis=dosinglepulseanalysis, doSinglePulseAnalysis=dosinglepulseanalysis,
convertRawTo8bit=convertRawTo8bit, convertRawTo8bit=convertRawTo8bit,
subintegrationLength=ltasip.Time(subintegrationLength , units=subintegrationlength_unit), subintegrationLength=ltasip.Time(subintegrationlength , units=subintegrationlength_unit),
skipRFIExcision=skiprfiexcision, skipRFIExcision=skiprfiexcision,
skipDataFolding=skipdatafolding, skipDataFolding=skipdatafolding,
skipOptimizePulsarProfile=skipoptimizepulsarprofile, skipOptimizePulsarProfile=skipoptimizepulsarprofile,
...@@ -459,19 +475,13 @@ class InstrumentModelDataProduct(): ...@@ -459,19 +475,13 @@ class InstrumentModelDataProduct():
return self.__pyxb_dataproduct return self.__pyxb_dataproduct
class TransientBufferBoardDataProduct(): class TransientBufferBoardDataProduct():
def __init__(self, dataproduct_map):
self.__pyxb_dataproduct = ltasip.TransientBufferBoardDataProduct(**dataproduct_map.get_dict())
def get_pyxb_dataproduct(self):
return self.__pyxb_dataproduct
class BeamFormedDataProduct():
def __init__(self, def __init__(self,
dataproduct_map, dataproduct_map,
numberofsamples, numberofsamples,
timestamp, timestamp,
triggertype, triggertype,
triggervalue): triggervalue):
self.__pyxb_dataproduct = ltasip.BeamFormedDataProduct( self.__pyxb_dataproduct = ltasip.TransientBufferBoardDataProduct(
numberOfSamples=numberofsamples, numberOfSamples=numberofsamples,
timeStamp=timestamp, timeStamp=timestamp,
triggerParameters=ltasip.TBBTrigger(type=triggertype,value=triggervalue), triggerParameters=ltasip.TBBTrigger(type=triggertype,value=triggervalue),
...@@ -509,6 +519,26 @@ class PulpDataProduct(): ...@@ -509,6 +519,26 @@ class PulpDataProduct():
return self.__pyxb_dataproduct return self.__pyxb_dataproduct
class BeamFormedDataProduct():
def __init__(self,
dataproduct_map,
#numberofbeams,
beams=None):
__beams=None
if beams:
__beams=ltasip.ArrayBeams()
for beam in beams:
__beams.append(beam.get_pyxb_beam())
self.__pyxb_dataproduct=ltasip.BeamFormedDataProduct(
numberOfBeams=len(beams),
beams=__beams,
**dataproduct_map.get_dict())
def get_pyxb_dataproduct(self):
return self.__pyxb_dataproduct
# ============ # ============
# Coordinates: # Coordinates:
...@@ -604,13 +634,10 @@ class DirectionCoordinate(): ...@@ -604,13 +634,10 @@ class DirectionCoordinate():
def get_pyxb_coordinate(self): def get_pyxb_coordinate(self):
return self.__pyxb_coordinate return self.__pyxb_coordinate
# ###########
# ArrayBeams:
class ArrayBeamMap():
# ########
# Others:
class ArrayBeam():
def __init__(self, def __init__(self,
subarraypointingidentifier_source, subarraypointingidentifier_source,
subarraypointingidentifier, subarraypointingidentifier,
...@@ -626,7 +653,7 @@ class ArrayBeam(): ...@@ -626,7 +653,7 @@ class ArrayBeam():
channelwidth_frequencyunit, channelwidth_frequencyunit,
channelspersubband, channelspersubband,
stokes): stokes):
self.__pyxb_beam=ltasip.ArrayBeam( self.arraybeam_map=dict(
subArrayPointingIdentifier=ltasip.IdentifierType(source=subarraypointingidentifier_source, identifier=subarraypointingidentifier), subArrayPointingIdentifier=ltasip.IdentifierType(source=subarraypointingidentifier_source, identifier=subarraypointingidentifier),
beamNumber=beamnumber, beamNumber=beamnumber,
dispersionMeasure=dispersionmeasure, dispersionMeasure=dispersionmeasure,
...@@ -639,9 +666,289 @@ class ArrayBeam(): ...@@ -639,9 +666,289 @@ class ArrayBeam():
stokes=stokes stokes=stokes
) )
def get_dict(self):
return self.arraybeam_map
class SimpleArrayBeam():
def __init__(self, arraybeam_map):
self.__pyxb_beam=ltasip.ArrayBeam(**arraybeam_map.get_dict())
def get_pyxb_beam(self):
return self.__pyxb_beam
class CoherentStokesBeam():
def __init__(self,
arraybeam_map,
pointing,
offset):
self.__pyxb_beam=ltasip.CoherentStokesBeam(
pointing=pointing,
offset=offset,
**arraybeam_map.get_dict())
def get_pyxb_beam(self):
return self.__pyxb_beam
class IncoherentStokesBeam():
def __init__(self, arraybeam_map):
self.__pyxb_beam=ltasip.IncoherentStokesBeam(**arraybeam_map.get_dict())
def get_pyxb_beam(self):
return self.__pyxb_beam
class FlysEyeBeam():
def __init__(self,
arraybeam_map,
station):
self.__pyxb_beam=ltasip.FlysEyeBeam(
station=station.get_pyxb_station(),
**arraybeam_map.get_dict())
def get_pyxb_beam(self): def get_pyxb_beam(self):
return self.__pyxb_beam return self.__pyxb_beam
# ###################
# Online processings:
class CorrelatorProcessing():
def __init__(self,
integrationinterval,
integrationinterval_unit,
channelwidth_frequency=None,
channelwidth_frequencyunit=None,
channelspersubband=None,
processingtype="Correlator",
):
__channelwidth=None
if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit),
self.__pyxb_rtprocessing=ltasip.Correlator(
integrationInterval=ltasip.Time(integrationinterval,units=integrationinterval_unit),
processingType=processingtype,
# channelWidth=__channelwidth,
channelsPerSubband=channelspersubband
)
# Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth=__channelwidth
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class CoherentStokesProcessing():
def __init__(self,
rawsamplingtime,
rawsamplingtime_unit,
timesamplingdownfactor,
samplingtime,
samplingtime_unit,
stokes,
numberofstations,
stations,
frequencydownsamplingfactor=None,
numberofcollapsedchannels=None,
channelwidth_frequency=None,
channelwidth_frequencyunit=None,
channelspersubband=None,
processingtype="Coherent Stokes",
):
__stations = ltasip.Stations()
for station in stations:
__stations.append(station.get_pyxb_station())
__channelwidth=None
if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit)
self.__pyxb_rtprocessing=ltasip.CoherentStokes(
rawSamplingTime=ltasip.Time(rawsamplingtime, units=rawsamplingtime_unit),
timeDownsamplingFactor=timesamplingdownfactor,
samplingTime=ltasip.Time(samplingtime, units=samplingtime_unit),
frequencyDownsamplingFactor=frequencydownsamplingfactor,
numberOfCollapsedChannels=numberofcollapsedchannels,
stokes=stokes,
numberOfStations=numberofstations,
stations=__stations,
#channelWidth=__channelwidth,
channelsPerSubband=channelspersubband,
processingType=processingtype
)
# Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth=__channelwidth
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
# This is identical to coherent stokes. Redundancy already in the SIP schema...
class IncoherentStokesProcessing():
def __init__(self,
rawsamplingtime,
rawsamplingtime_unit,
timesamplingdownfactor,
samplingtime,
samplingtime_unit,
stokes,
numberofstations,
stations,
frequencydownsamplingfactor=None,
numberofcollapsedchannels=None,
channelwidth_frequency=None,
channelwidth_frequencyunit=None,
channelspersubband=None,
processingtype="Incoherent Stokes",
):
__stations = ltasip.Stations()
for station in stations:
__stations.append(station.get_pyxb_station())
__channelwidth=None
if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit),
self.__pyxb_rtprocessing=ltasip.IncoherentStokes(
rawSamplingTime=ltasip.Time(rawsamplingtime, units=rawsamplingtime_unit),
timeDownsamplingFactor=timesamplingdownfactor,
samplingTime=ltasip.Time(samplingtime, units=samplingtime_unit),
frequencyDownsamplingFactor=frequencydownsamplingfactor,
numberOfCollapsedChannels=numberofcollapsedchannels,
stokes=stokes,
numberOfStations=numberofstations,
stations=__stations,
#channelWidth=__channelwidth,
channelsPerSubband=channelspersubband,
processingType=processingtype
)
# Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth=__channelwidth
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class FlysEyeProcessing():
def __init__(self,
rawsamplingtime,
rawsamplingtime_unit,
timesamplingdownfactor,
samplingtime,
samplingtime_unit,
stokes,
channelwidth_frequency=None,
channelwidth_frequencyunit=None,
channelspersubband=None,
processingtype="Fly's Eye",
):
__channelwidth=None
if channelwidth_frequency and channelwidth_frequencyunit:
__channelwidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit)
self.__pyxb_rtprocessing=ltasip.FlysEye(
rawSamplingTime=ltasip.Time(rawsamplingtime, units=rawsamplingtime_unit),
timeDownsamplingFactor=timesamplingdownfactor,
samplingTime=ltasip.Time(samplingtime, units=samplingtime_unit),
stokes=stokes,
# channelWidth=__channelwidth,
channelsPerSubband=channelspersubband,
processingType=processingtype)
# Somehow this does not work in the constructor:
self.__pyxb_rtprocessing.channelwidth=__channelwidth
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class NonStandardProcessing():
def __init__(self,
channelwidth_frequency,
channelwidth_frequencyunit,
channelspersubband,
processingtype="Non Standard"):
self.__pyxb_rtprocessing=ltasip.NonStandard(
channelsPerSubband=channelspersubband,
processingType=processingtype,
channelWidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit)
)
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
# ==============
# Processes:
class ProcessMap():
def __init__(self,
strategyname,
strategydescription,
starttime,
duration,
observation_source,
observation_id,
process_source,
process_id,
relations,
parset_source=None,
parset_id=None,
):
__relations=ltasip.ProcessRelations()
for rel in relations:
__relations.append(rel.get_pyxb_processrelation())
self.process_map = dict(processIdentifier=ltasip.IdentifierType(source=process_source, identifier=process_id),
observationId=ltasip.IdentifierType(source=observation_source, identifier=observation_id),
relations=__relations,
strategyName=strategyname, strategyDescription=strategydescription, startTime=starttime,
duration=duration)
if parset_id and parset_source:
self.process_map["parset"]=ltasip.IdentifierType(source=parset_source,identifier=parset_id)
def get_dict(self):
return self.process_map
class ProcessRelation():
def __init__(self,
identifier_source,
identifier,
name=None,
type="GroupID"
):
self.__pyxb_processrelation=ltasip.ProcessRelation(
relationType=ltasip.ProcessRelationType(type),
identifier=ltasip.IdentifierType(
source=identifier_source,
identifier=identifier,
name=name)
)
def get_pyxb_processrelation(self):
return self.__pyxb_processrelation
class SimpleProcess():
def __init__(self, process_map):
self.pyxb_process = ltasip.Process(**process_map.get_dict())
def get_pyxb_process(self):
return self.pyxb_process
# ########
# Others:
class PointingRaDec(): class PointingRaDec():
def __init__(self, def __init__(self,
...@@ -719,44 +1026,6 @@ class TabularAxis(): ...@@ -719,44 +1026,6 @@ class TabularAxis():
def get_pyxb_axis(self): def get_pyxb_axis(self):
return self.__pyxb_axis return self.__pyxb_axis
class CorrelatorProcessing():
def __init__(self,
integrationinterval,
integrationinterval_unit,
channelwidth_frequency=None,
channelwidth_frequencyunit=None,
channelspersubband=None,
processingtype="Correlator",
):
self.__pyxb_rtprocessing=ltasip.Correlator(
integrationInterval=ltasip.Time(integrationinterval,units=integrationinterval_unit),
processingType=processingtype,
channelWidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit),
channelsPerSubband=channelspersubband
)
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class CoherentStokesProcessing():
#todo
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class IncoherentStokesProcessing():
#todo
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class FlysEyeProcessing():
#todo
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class NonStandardProcessing():
#todo
def get_pyxb_rtprocessing(self):
return self.__pyxb_rtprocessing
class SubArrayPointing(): class SubArrayPointing():
def __init__(self, def __init__(self,
...@@ -788,7 +1057,7 @@ class SubArrayPointing(): ...@@ -788,7 +1057,7 @@ class SubArrayPointing():
if processing: if processing:
if __processing is None: if __processing is None:
__processing=ltasip.Processing() __processing=ltasip.Processing()
__processing.append(correlatorprocessing.get_pyxb_rtprocessing() __processing.append(processing.get_pyxb_rtprocessing()
) )
...@@ -872,7 +1141,7 @@ class Sip(): ...@@ -872,7 +1141,7 @@ class Sip():
antennaset, antennaset,
timesystem, timesystem,
numberofstations, numberofstations,
stationlist, stations,
numberofsubarraypointings, numberofsubarraypointings,
numberoftbbevents, numberoftbbevents,
numberofcorrelateddataproducts, numberofcorrelateddataproducts,
...@@ -888,8 +1157,8 @@ class Sip(): ...@@ -888,8 +1157,8 @@ class Sip():
): ):
__stations = ltasip.Stations() __stations = ltasip.Stations()
for station in stationlist: for station in stations:
__stations.append(station) __stations.append(station.get_pyxb_station())
__tbbevents=None, __tbbevents=None,
if(transientbufferboardevents): if(transientbufferboardevents):
...@@ -918,13 +1187,19 @@ class Sip(): ...@@ -918,13 +1187,19 @@ class Sip():
numberOfBeamFormedDataProducts=numberofbeamformeddataproducts, numberOfBeamFormedDataProducts=numberofbeamformeddataproducts,
numberOfBitsPerSample=numberofbitspersample, numberOfBitsPerSample=numberofbitspersample,
observationDescription=observationdescription, observationDescription=observationdescription,
channelWidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit), #channelWidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit),
channelsPerSubband=channelspersubband, channelsPerSubband=channelspersubband,
subArrayPointings=__pointings, subArrayPointings=__pointings,
transientBufferBoardEvents=__tbbevents, transientBufferBoardEvents=__tbbevents,
**process_map.get_dict() **process_map.get_dict()
) )
# Somehow this does not work in the constructor:
if channelwidth_frequency and channelwidth_frequencyunit:
obs.channelwidth=ltasip.Frequency(channelwidth_frequency, units=channelwidth_frequencyunit),
self.sip.observation.append(obs) self.sip.observation.append(obs)
return self.get_prettyxml() return self.get_prettyxml()
...@@ -1079,7 +1354,7 @@ def main(): ...@@ -1079,7 +1354,7 @@ def main():
), ),
filecontent=["content_a","content_b"], filecontent=["content_a","content_b"],
datatype="CoherentStokes", datatype="CoherentStokes",
arraybeam=ArrayBeam( arraybeam=SimpleArrayBeam(ArrayBeamMap(
subarraypointingidentifier_source="source", subarraypointingidentifier_source="source",
subarraypointingidentifier="id", subarraypointingidentifier="id",
beamnumber=4, beamnumber=4,
...@@ -1094,10 +1369,46 @@ def main(): ...@@ -1094,10 +1369,46 @@ def main():
channelwidth_frequencyunit="MHz", channelwidth_frequencyunit="MHz",
channelspersubband=5, channelspersubband=5,
stokes=["I","Q"] stokes=["I","Q"]
))
)
) )
# add optional dataproduct item
print "===\nAdding related beamformed dataproduct:\n"
print mysip.add_related_dataproduct(
BeamFormedDataProduct(
dataproduct_map=DataProductMap(
type="Unknown",
source="space",
identifier="fourtytwo",
size=2048,
filename="/home/paulus/test.h5",
fileformat="HDF5",
processsource="someone gave it to me",
processid="SIPlib 0.1"
),
beams=[FlysEyeBeam(
arraybeam_map=ArrayBeamMap(
subarraypointingidentifier_source="source",
subarraypointingidentifier="id",
beamnumber=4,
dispersionmeasure=16,
numberofsubbands=3,
stationsubbands=[1,2,3],
samplingtime=3,
samplingtimeunit="ms",
centralfrequencies="",
centralfrequencies_unit="MHz",
channelwidth_frequency=160,
channelwidth_frequencyunit="MHz",
channelspersubband=5,
stokes=["I","Q"]),
station=STATION_1
)]
) )
) )
# add optional dataproduct item # add optional dataproduct item
print "===\nAdding related sky image dataproduct:\n" print "===\nAdding related sky image dataproduct:\n"
print mysip.add_related_dataproduct( print mysip.add_related_dataproduct(
...@@ -1271,7 +1582,7 @@ def main(): ...@@ -1271,7 +1582,7 @@ def main():
stationselection="Core", stationselection="Core",
antennaset="HBA Zero", antennaset="HBA Zero",
timesystem="UTC", timesystem="UTC",
stationlist=[STATIONS.get("stationA"), STATIONS.get("stationB")], stations=[STATION_1, STATION_2],
numberofstations=5, numberofstations=5,
numberofsubarraypointings=5, numberofsubarraypointings=5,
numberoftbbevents=5, numberoftbbevents=5,
...@@ -1319,16 +1630,55 @@ def main(): ...@@ -1319,16 +1630,55 @@ def main():
relations=[ProcessRelation( relations=[ProcessRelation(
identifier_source="source", identifier_source="source",
identifier="90")], identifier="90")],
correlatorprocessing=CorrelatorProcessing( #correlatorprocessing=CorrelatorProcessing(
integrationinterval=0.5, # integrationinterval=0.5,
integrationinterval_unit="ns", # integrationinterval_unit="ns",
# channelwidth_frequency=160,
# channelwidth_frequencyunit="MHz"
# ),
coherentstokesprocessing=CoherentStokesProcessing(
rawsamplingtime=20,
rawsamplingtime_unit="ns",
timesamplingdownfactor=2,
samplingtime=10,
samplingtime_unit="ns",
stokes=["XX"],
numberofstations=1,
stations=[STATION_2],
frequencydownsamplingfactor=2,
numberofcollapsedchannels=2,
channelwidth_frequency=160, channelwidth_frequency=160,
channelwidth_frequencyunit="MHz" channelwidth_frequencyunit="MHz",
channelspersubband=122
),
incoherentstokesprocessing=IncoherentStokesProcessing(
rawsamplingtime=20,
rawsamplingtime_unit="ns",
timesamplingdownfactor=2,
samplingtime=10,
samplingtime_unit="ns",
stokes=["XX"],
numberofstations=1,
stations=[STATION_1],
frequencydownsamplingfactor=2,
numberofcollapsedchannels=2,
channelwidth_frequency=160,
channelwidth_frequencyunit="MHz",
channelspersubband=122
), ),
# todo coherentstokesprocessing=, flyseyeprocessing=FlysEyeProcessing(
# todo incoherentstokesprocessing=, rawsamplingtime=10,
# todo flyseyeprocessing=, rawsamplingtime_unit="ms",
# todo nonstandardprocessing= timesamplingdownfactor=2,
samplingtime=2,
samplingtime_unit="ms",
stokes=["I"],
),
nonstandardprocessing=NonStandardProcessing(
channelwidth_frequency=160,
channelwidth_frequencyunit="MHz",
channelspersubband=122
)
)], )],
transientbufferboardevents=["event1","event2"] transientbufferboardevents=["event1","event2"]
) )
...@@ -1486,16 +1836,145 @@ def main(): ...@@ -1486,16 +1836,145 @@ def main():
print "===\nAdding imaging pipelinerun:\n" print "===\nAdding imaging pipelinerun:\n"
# todo print mysip.add_pipelinerun(ImagingPipeline()) print mysip.add_pipelinerun(ImagingPipeline(
PipelineMap(
name="long baseline",
version="version",
sourcedata_identifiers=["ID1","ID2"],
sourcedata_source="space",
process_map=ProcessMap(
strategyname="strategy1",
strategydescription="awesome strategy",
starttime="1980-03-23T10:20:15",
duration= "P6Y3M10DT15H",
observation_source="SAS",
observation_id="SAS VIC Tree Id",
process_source="MoM",
process_id="MoM Id",
parset_source="parsource",
parset_id="parid",
relations=[
ProcessRelation(
identifier_source="source",
identifier="90")]
),
),
imagerintegrationtime=10,
imagerintegrationtime_unit="ms",
numberofmajorcycles=5,
numberofinstrumentmodels=5,
numberofcorrelateddataproducts=1,
numberofskyimages=1,
)
)
print "===\nAdding calibration pipelinerun:\n" print "===\nAdding calibration pipelinerun:\n"
# todo print mysip.add_pipelinerun(CalibrationPipeline()) print mysip.add_pipelinerun(
CalibrationPipeline(
PipelineMap(
name="long baseline",
version="version",
sourcedata_identifiers=["ID1","ID2"],
sourcedata_source="space",
process_map=ProcessMap(
strategyname="strategy1",
strategydescription="awesome strategy",
starttime="1980-03-23T10:20:15",
duration= "P6Y3M10DT15H",
observation_source="SAS",
observation_id="SAS VIC Tree Id",
process_source="MoM",
process_id="MoM Id",
parset_source="parsource",
parset_id="parid",
relations=[
ProcessRelation(
identifier_source="source",
identifier="90")]
),
),
skymodeldatabase="db",
numberofinstrumentmodels=1,
numberofcorrelateddataproducts=1,
frequencyintegrationstep=1,
timeintegrationstep=1,
flagautocorrelations=True,
demixing=False
))
print "===\nAdding averaging pipelinerun:\n" print "===\nAdding averaging pipelinerun:\n"
# todo print mysip.add_pipelinerun(AveragingPipeline()) print mysip.add_pipelinerun(
AveragingPipeline(
PipelineMap(
name="long baseline",
version="version",
sourcedata_identifiers=["ID1","ID2"],
sourcedata_source="space",
process_map=ProcessMap(
strategyname="strategy1",
strategydescription="awesome strategy",
starttime="1980-03-23T10:20:15",
duration= "P6Y3M10DT15H",
observation_source="SAS",
observation_id="SAS VIC Tree Id",
process_source="MoM",
process_id="MoM Id",
parset_source="parsource",
parset_id="parid",
relations=[
ProcessRelation(
identifier_source="source",
identifier="90")]
),
),
numberofcorrelateddataproducts=1,
frequencyintegrationstep=1,
timeintegrationstep=1,
flagautocorrelations=True,
demixing=False
))
print "===\nAdding pulsar pipelinerun:\n" print "===\nAdding pulsar pipelinerun:\n"
# todo print mysip.add_pipelinerun(PulsarPipeline()) print mysip.add_pipelinerun(
PulsarPipeline(
PipelineMap(
name="long baseline",
version="version",
sourcedata_identifiers=["ID1","ID2"],
sourcedata_source="space",
process_map=ProcessMap(
strategyname="strategy1",
strategydescription="awesome strategy",
starttime="1980-03-23T10:20:15",
duration= "P6Y3M10DT15H",
observation_source="SAS",
observation_id="SAS VIC Tree Id",
process_source="MoM",
process_id="MoM Id",
parset_source="parsource",
parset_id="parid",
relations=[
ProcessRelation(
identifier_source="source",
identifier="90")]
),
),
pulsarselection="Pulsars in observation specs, file and brightest in SAP and TAB",
pulsars=["J1234+67"],
dosinglepulseanalysis=False,
convertRawTo8bit=True,
subintegrationlength=10,
subintegrationlength_unit='ns',
skiprfiexcision=False,
skipdatafolding=False,
skipoptimizepulsarprofile=True,
skipconvertrawintofoldedpsrfits=False,
runrotationalradiotransientsanalysis=True,
skipdynamicspectrum=False,
skipprefold=True
)
)
#path = os.path.expanduser("~/sip9091.xml") #path = os.path.expanduser("~/sip9091.xml")
#with open(path, 'w+') as f: #with open(path, 'w+') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment