momxml modules

momxml

momxml.observation

momxml.observation.xml(items, project='2015LOFAROBS_new', description=None)[source]

Format a list of items as an XML string that can be uploaded to a MoM project with name project.

momxml.beam

class momxml.beam.Beam(target_source, subband_spec, duration_s=None, tied_array_beams=None, measurement_type='Target')[source]

Represents a beam within an Observation. Beams (Sub Array Pointings) are one of the possible kinds of children of an observation. Pipelines are another kind of observation children. To fully generate its XML, a Beam needs information from its parent Observation.

Parameters

target_source : TargetSource
Contains the name and direction in which to observe.
subband_spec : string or list of int
Sub band specification for this beam. Examples: ‘77..324’, [100, 200]
duration_s : None or number
Duration during which the beam is active. None implies during the entire observation.
measurement_type : ‘Target’ or ‘Calibration’
Gives some intent for the observation.

Examples

>>> from lofarobsxml import TargetSource, Angle
>>> from lofarobsxml.backend import BackendProcessing
>>> target = TargetSource(name      = 'Cyg A',
...                       ra_angle  = Angle(hms  = (19, 59, 28.3566)),
...                       dec_angle = Angle(sdms = ('+', 40, 44, 2.097)))
>>> bm = Beam(target, '77..324')
>>> bm
Beam(parent           = NoneType,
     children         = None,
     duration_s       = None,
     initial_status   = 'opened',
     measurement_type = 'Target',
     name             = 'Cyg A',
     subband_spec     = '77..324',
     target_source    = TargetSource(name      = 'Cyg A',
                                     ra_angle  = Angle(shms = ('+', 19, 59, 28.3566)),
                                     dec_angle = Angle(sdms = ('+', 40, 44, 2.097))),
     tied_array_beams = None)
>>> observation_stub = ObservationSpecificationBase('Observation')
>>> observation_stub.backend = BackendProcessing()
>>> observation_stub.clock_mhz = 200
>>> observation_stub.frequency_range = 'HBA_LOW'
>>> observation_stub.append_child(bm)
>>> print(bm.xml('Project name'))
<lofar:measurement xsi:type="lofar:UVMeasurementType">
<name>Cyg A</name>
<description>Observation</description>
<topology>Observation.0.Cyg_A</topology>
<currentStatus>
  <mom2:openedStatus/>
</currentStatus>
<lofar:uvMeasurementAttributes>
  <measurementType>Target</measurementType>
  <specification>
    <targetName>Cyg A</targetName>
    <ra>299.8681525</ra>
    <dec>40.733915833333334</dec>
    <equinox>J2000</equinox>
    <duration>PT00S</duration>
    <subbandsSpecification>
      <bandWidth unit="MHz">48.4375</bandWidth>
      <centralFrequency unit="MHz">139.1602</centralFrequency>
      <contiguous>false</contiguous>
      <subbands>77..324</subbands>
    </subbandsSpecification>
  </specification>
</lofar:uvMeasurementAttributes>
<resultDataProducts>
  <item>
    <lofar:uvDataProduct>
      <name>Observation.0.Cyg_A.dps</name>
      <topology>Observation.0.Cyg_A.dps</topology>
      <status>no_data</status>
    </lofar:uvDataProduct>
  </item>
</resultDataProducts>
</lofar:measurement>
data_products_label()[source]

Return the name of the data products produced by this beam.

momxml.targetsource

Specification of target sources to use in Observation Beams.

exception momxml.targetsource.NoSimbadCoordinatesError[source]

Raised if the Simbad response does not contain J2000 coordinates.

exception momxml.targetsource.SourceSpecificationError[source]

Raised in case of badly specified TargetSource.

class momxml.targetsource.TargetSource(name='', ra_angle=None, dec_angle=None, reference_frame='J2000')[source]

A target source to be used when specifying a Beam within an Observation.

Parameters

name : non-unicode string
Contains the name of the source.
ra_angle : None or an Angle
J2000 right ascension.
dec_angle : None or an Angle
J2000 declination.
reference_frame : string
Reference frame for the longitudinal (ra/az/lon) and latitudinal (dec/el/lat) coordinates. Examples: ‘J2000’, ‘B1950’, ‘AZELGEO’, ‘AZEL’, ‘GALACTIC’, ‘JMEAN’, JTRUE’, etc... Basically anything supported by Casacore. Default: ‘J2000’

Raises

SourceSpecificationError
In case of badly specified TargetSource.

Examples

>>> TargetSource('Cyg A',
...              ra_angle  = Angle(shms = ('+', 19, 59, 28.3565)),
...              dec_angle = Angle(sdms = ('+', 40, 44, 2.099)) )
TargetSource(name      = 'Cyg A',
             ra_angle  = Angle(shms = ('+', 19, 59, 28.3565)),
             dec_angle = Angle(sdms = ('+', 40, 44, 2.099)))
dec_deg()[source]

Return declination in degrees

Returns

A float.

Examples

>>> TargetSource('Cyg A',
...              ra_angle = Angle(deg = 299.868152),
...              dec_angle = Angle(deg = 40.733916) ).dec_deg()
40.733916
ra_dec_rad()[source]

Returns coordinates as an (ra_rad, dec_rad) pair of floats.

Examples

>>> '(%.6f, %.6f)' % TargetSource('Cyg A',
...                               ra_angle = Angle(deg = 299.868152),
...                               dec_angle = Angle(deg = 40.733916) ).ra_dec_rad()
'(5.233687, 0.710941)'
ra_deg()[source]

Return right ascension in degrees

Returns

A float.

Examples

>>> TargetSource('Cyg A',
...              ra_angle = Angle(deg = 299.868152),
...              dec_angle = Angle(deg = 40.733916) ).ra_deg()
299.868152
validate_and_normalize()[source]

Validates type and contents of data members. This method is called by the constructor.

Returns

A reference to self.

Raises

SourceSpecificationError
In case of a badly specified target source.

Examples

>>> TargetSource('Cyg A',
...              ra_angle = Angle(shms = ('+', 19, 59, 28.3565)),
...              dec_angle = Angle(sdms = ('+', 40, 44, 2.099)) )
TargetSource(name      = 'Cyg A',
             ra_angle  = Angle(shms = ('+', 19, 59, 28.3565)),
             dec_angle = Angle(sdms = ('+', 40, 44, 2.099)))

# >>> TargetSource(u’Cyg A’, # ... ra_angle = Angle(shms = (‘+’, 19, 59, 28.3565)), # ... dec_angle = Angle(sdms = (‘+’, 40, 44, 2.099)) ) # Traceback (most recent call last): # ... # lofarobsxml.targetsource.SourceSpecificationError: Source name may not be a unicode string. >>> TargetSource(‘Cyg A’, ... ra_angle = 3.0, ... dec_angle = Angle(sdms = (‘+’, 40, 44, 2.099)) ) Traceback (most recent call last): ... lofarobsxml.targetsource.SourceSpecificationError: ra_angle must be a lofarobsxml.Angle, not 3.0

>>> TargetSource('Cyg A',
...              ra_angle = Angle(shms = ('+', 19, 59, 28.3565)),
...              dec_angle = -2)
Traceback (most recent call last):
...
lofarobsxml.targetsource.SourceSpecificationError: dec_angle must be a lofarobsxml.Angle, not -2
momxml.targetsource.simbad(source_name, debug=False)[source]

Lookup source_name on simbad and return a TargetSource instance.

Examples

>>> simbad('3C 196')
TargetSource(name      = '3C 196',
             ra_angle  = Angle(shms = ('+', 8, 13, 36.0561)),
             dec_angle = Angle(sdms = ('+', 48, 13, 2.636)))
momxml.targetsource.target_source_from_simbad_response(source_name, simbad_response)[source]

Examples

>>> simbad_response = open('examples/simbad-ngc891.txt').read()
>>> target_source_from_simbad_response('NGC 891', simbad_response)
TargetSource(name      = 'NGC 891',
             ra_angle  = Angle(shms = ('+', 2, 22, 32.907)),
             dec_angle = Angle(sdms = ('+', 42, 20, 53.95)))
>>> simbad_trifid = open('examples/simbad-trifid.txt').read()
>>> target_source_from_simbad_response('Trifid Nebula', simbad_trifid)
TargetSource(name      = 'Trifid Nebula',
             ra_angle  = Angle(shms = ('+', 18, 2, 42.0)),
             dec_angle = Angle(sdms = ('-', 22, 58, 18.0)))
>>> simbad_ncp = open('examples/simbad-ncp.txt').read()
>>> target_source_from_simbad_response('NCP', simbad_ncp)
TargetSource(name      = 'NCP',
             ra_angle  = Angle(shms = ('+', 0, 0, 0.0)),
             dec_angle = Angle(sdms = ('+', 90, 0, 0.0)))

momxml.backend

class momxml.backend.BackendProcessing(channels_per_subband=64, integration_time_seconds=2, correlated_data=True, filtered_data=False, beamformed_data=False, coherent_stokes_data=None, incoherent_stokes_data=None, stokes_integrate_channels=False, coherent_dedispersed_channels=False, tied_array_beams=None, bypass_pff=False, enable_superterp=False, default_template='BeamObservation')[source]

BackendProcessing contains all the settings for the correlator and beamformer hardware.

Parameters

channels_per_subband : int
Number of channels per sub band. Default is 64.
integration_time_seconds : number
Integration time for correlator observations. Typically 1 or 2 seconds, but anything from 0.2 to 99 seconds should be possible.
correlated_data : bool
True if cross-correlation visibilities should be produced.
filtered_data : bool
No idea what this means. Default is False.
beamformed_data : bool

True if beamformed data is to be produced, such as complex voltage, coherent stokes, or incoherent stokes data. If True and coherent_stokes_data is set to Stokes(‘coherent’, polarizations=’XXYY’,

number_collapsed_channels=1, stokes_downsampling_steps=1),

complex voltages are produced.

coherent_stokes_data : None or Stokes instance
Coherent stokes settings.
incoherent_stokes_data : None or Stokes instance
Incoherent stokes settings.
stokes_integrate_channels : bool
Apply frequency averaging. Default False.
coherent_dedispersed_channels : bool
Apply coherent dedispersion? Default False.
tied_array_beams : None or TiedArrayBeams instance
Tied array beam settings.
bypass_pff : bool
If True, skip the correlator’s / beamformer’s polyphase filter entirely. Useful for high time resolution beamformed data. Default: False.
enable_superterp: bool
If True, also beamform the superterp stations and treat them as a separate large station.
default_template: string
Default observation template to use. Possible values are: ‘BeamObservation’ (default), ‘BeamObservationNoStationControl’, and ‘BeamObservationNoPlots’.

Examples

>>> bp = BackendProcessing()
>>> bp
BackendProcessing(beamformed_data               = False,
                  bypass_pff                    = False,
                  channels_per_subband          = 64,
                  coherent_dedispersed_channels = False,
                  coherent_stokes_data          = None,
                  correlated_data               = True,
                  default_template              = 'BeamObservation',
                  enable_superterp              = False,
                  filtered_data                 = False,
                  incoherent_stokes_data        = None,
                  integration_time_seconds      = 2,
                  stokes_integrate_channels     = False,
                  tied_array_beams              = TiedArrayBeams(beams_ra_dec_rad = None,
                                                                 flyseye          = False,
                                                                 nr_tab_rings     = 0,
                                                                 tab_ring_size    = 0))
>>> print(bp.xml())
<correlatedData>true</correlatedData>
<filteredData>false</filteredData>
<beamformedData>false</beamformedData>
<coherentStokesData>false</coherentStokesData>
<incoherentStokesData>false</incoherentStokesData>
<integrationInterval>2</integrationInterval>
<channelsPerSubband>64</channelsPerSubband>
<pencilBeams>
  <flyseye>false</flyseye>
  <pencilBeamList/>
</pencilBeams>
<tiedArrayBeams>
  <flyseye>false</flyseye>
  <nrTabRings>0</nrTabRings>
  <tabRingSize>0.000000</tabRingSize>
  <tiedArrayBeamList/>
</tiedArrayBeams>
<stokes>
  <integrateChannels>false</integrateChannels>
</stokes>
<bypassPff>false</bypassPff>
<enableSuperterp>false</enableSuperterp>

Here is a Fly’s eye example:

>>> channels_per_subband = 16
>>> coherent_stokes_data = Stokes('coherent',
...                               stokes_downsampling_steps = 128)
>>> tied_array_beams     = TiedArrayBeams(flyseye = True,
...                                       beams_ra_dec_rad = None)
>>> bp_fe = BackendProcessing(
...        correlated_data          = False,
...        channels_per_subband     = channels_per_subband,
...        coherent_stokes_data     = coherent_stokes_data,
...        tied_array_beams         = tied_array_beams)
>>> bp_fe
BackendProcessing(beamformed_data               = False,
                  bypass_pff                    = False,
                  channels_per_subband          = 16,
                  coherent_dedispersed_channels = False,
                  coherent_stokes_data          = Stokes(mode                      = 'coherent',
                                                         number_collapsed_channels = 16,
                                                         polarizations             = 'I',
                                                         stokes_downsampling_steps = 128,
                                                         subbands_per_file         = 512),
                  correlated_data               = False,
                  default_template              = 'BeamObservation',
                  enable_superterp              = False,
                  filtered_data                 = False,
                  incoherent_stokes_data        = None,
                  integration_time_seconds      = 2,
                  stokes_integrate_channels     = False,
                  tied_array_beams              = TiedArrayBeams(beams_ra_dec_rad = None,
                                                                 flyseye          = True,
                                                                 nr_tab_rings     = 0,
                                                                 tab_ring_size    = 0))
>>> print(bp_fe.xml())
<correlatedData>false</correlatedData>
<filteredData>false</filteredData>
<beamformedData>false</beamformedData>
<coherentStokesData>true</coherentStokesData>
<incoherentStokesData>false</incoherentStokesData>
<channelsPerSubband>16</channelsPerSubband>
<pencilBeams>
  <flyseye>true</flyseye>
  <pencilBeamList/>
</pencilBeams>
<tiedArrayBeams>
  <flyseye>true</flyseye>
  <nrTabRings>0</nrTabRings>
  <tabRingSize>0.000000</tabRingSize>
  <tiedArrayBeamList/>
</tiedArrayBeams>
<stokes>
  <integrateChannels>false</integrateChannels>
  <subbandsPerFileCS>512</subbandsPerFileCS>
  <numberCollapsedChannelsCS>16</numberCollapsedChannelsCS>
  <stokesDownsamplingStepsCS>128</stokesDownsamplingStepsCS>
  <whichCS>I</whichCS>
</stokes>
<bypassPff>false</bypassPff>
<enableSuperterp>false</enableSuperterp>

And here for coherent stokes beam forming:

>>> tied_array_beams     = TiedArrayBeams(flyseye = False,
...                                       beams_ra_dec_rad = None)
>>> bp_cs = BackendProcessing(
...        correlated_data          = False,
...        channels_per_subband     = channels_per_subband,
...        coherent_stokes_data     = coherent_stokes_data,
...        tied_array_beams         = tied_array_beams)
>>> bp_cs
BackendProcessing(beamformed_data               = False,
                  bypass_pff                    = False,
                  channels_per_subband          = 16,
                  coherent_dedispersed_channels = False,
                  coherent_stokes_data          = Stokes(mode                      = 'coherent',
                                                         number_collapsed_channels = 16,
                                                         polarizations             = 'I',
                                                         stokes_downsampling_steps = 128,
                                                         subbands_per_file         = 512),
                  correlated_data               = False,
                  default_template              = 'BeamObservation',
                  enable_superterp              = False,
                  filtered_data                 = False,
                  incoherent_stokes_data        = None,
                  integration_time_seconds      = 2,
                  stokes_integrate_channels     = False,
                  tied_array_beams              = TiedArrayBeams(beams_ra_dec_rad = None,
                                                                 flyseye          = False,
                                                                 nr_tab_rings     = 0,
                                                                 tab_ring_size    = 0))
>>> print(bp_cs.xml())
<correlatedData>false</correlatedData>
<filteredData>false</filteredData>
<beamformedData>false</beamformedData>
<coherentStokesData>true</coherentStokesData>
<incoherentStokesData>false</incoherentStokesData>
<channelsPerSubband>16</channelsPerSubband>
<pencilBeams>
  <flyseye>false</flyseye>
  <pencilBeamList/>
</pencilBeams>
<tiedArrayBeams>
  <flyseye>false</flyseye>
  <nrTabRings>0</nrTabRings>
  <tabRingSize>0.000000</tabRingSize>
  <tiedArrayBeamList/>
</tiedArrayBeams>
<stokes>
  <integrateChannels>false</integrateChannels>
  <subbandsPerFileCS>512</subbandsPerFileCS>
  <numberCollapsedChannelsCS>16</numberCollapsedChannelsCS>
  <stokesDownsamplingStepsCS>128</stokesDownsamplingStepsCS>
  <whichCS>I</whichCS>
</stokes>
<bypassPff>false</bypassPff>
<enableSuperterp>false</enableSuperterp>
instrument_name()[source]

These names are actually very important to MoM. They specify which default observation screen is displayed. Valid values are ‘Beam Observation’, ‘Interferometer’, and ‘TBB (standalone)’

need_beam_observation()[source]
xml(project_name=None, child_id=None, parent_label=None)[source]
class momxml.backend.Stokes(mode, subbands_per_file=512, number_collapsed_channels=None, stokes_downsampling_steps=1, polarizations='I')[source]

Describes averaging and storage parameters for beam formed observations. This class is not derived from ObservationSpecificationBase because it is really only a helper to BackendProcessing. Use instances of this class as parameters to BackendProcessing for coherent_stokes_data and incoherent_stokes_data.

Parameters

mode : string
Either ‘coherent’ or ‘incoherent’.
subbands_per_file : int
Number of sub bands per output file / storage machine. Use 512 for low data rates, but decrease as necessary to keep the data rate per file (locus node / storage machine) below about 300 MB / s.
number_collapsed_channels : None or int
The number of output channels. If this is smaller than the number of channels for the correlator, the output channels will be averaged. None implies no averaging.
stokes_downsampling_steps : int
Number of time samples to average before writing to disk. Default is 1 (no averaging).
polarizations : string
Either ‘I’, ‘IQUV’, or ‘XXYY’.

Examples

>>> stk = Stokes(mode = 'coherent', polarizations = 'IQUV',
...              stokes_downsampling_steps = 64)
>>> stk
Stokes(mode                      = 'coherent',
       number_collapsed_channels = None,
       polarizations             = 'IQUV',
       stokes_downsampling_steps = 64,
       subbands_per_file         = 512)
>>> print(stk.xml())
Traceback (most recent call last):
...
ValueError: Stokes.xml(): number_collapsed_channels is not set.
>>> stk = Stokes(mode = 'coherent', polarizations = 'IQUV',
...              stokes_downsampling_steps = 64,
...              number_collapsed_channels = 16)
>>> stk
Stokes(mode                      = 'coherent',
       number_collapsed_channels = 16,
       polarizations             = 'IQUV',
       stokes_downsampling_steps = 64,
       subbands_per_file         = 512)
>>> print(stk.xml())
<subbandsPerFileCS>512</subbandsPerFileCS>
<numberCollapsedChannelsCS>16</numberCollapsedChannelsCS>
<stokesDownsamplingStepsCS>64</stokesDownsamplingStepsCS>
<whichCS>IQUV</whichCS>
stokes_suffix()[source]

return CS or IS, depending on whether these are coherent or incoherent stokes settings. coherent stokes settings also need tied array beams / fly’s eye stuff specified.

validate()[source]

Raises a ValueError for every problem found in the settings.

xml(project_name=None)[source]

Produce the xml for the coherent stokes or incoherent stokes settings of the backend.

class momxml.backend.TiedArrayBeams(flyseye=False, beam_offsets=None, beams_ra_dec_rad=None, nr_tab_rings=0, tab_ring_size=0)[source]

Description of Tied Array Beam (TAB) settings.

Parameters

flyseye : bool
If True, store data streams from each station individually.
beams_ra_dec_rad : None or list of pairs of float
The RA, Dec in rad of the phase centres of the TABs in J2000 coordinates.
nr_tab_rings : int
Alternatively, one can specify with how many rings one wants to tile the beam.
tab_ring_size : float
Distance between TAB rings in RADIANS.
beam_offsets : None
Previously, the offsets with repsoect to the phase center. Option is invalid as of 2014-06-14, LOFAR 2.4. Use beams_ra_dec_rad instead.

Examples

>>> tab = TiedArrayBeams()
>>> tab
TiedArrayBeams(beams_ra_dec_rad = None,
               flyseye          = False,
               nr_tab_rings     = 0,
               tab_ring_size    = 0)
>>> print(tab.xml())

<tiedArrayBeams>
  <flyseye>false</flyseye>
  <nrTabRings>0</nrTabRings>
  <tabRingSize>0.000000</tabRingSize>
  <tiedArrayBeamList/>
</tiedArrayBeams>
>>> tab_fe = TiedArrayBeams(flyseye      = True,
...                         beam_offsets = [(0.0, 0.0), (0.1, -0.05)])
Traceback (most recent call last):
...
ValueError: Relative beam_offsets not supported as of LOFAR 2.4 (2014-06-30) use beams_ra_dec_rad instead

Whoops.... that was the old way of specifying. Let’s try again now.

>>> tab_fe = TiedArrayBeams(flyseye = True,
...                         beams_ra_dec_rad = [(3.1, +0.5),
...                                             (3.2, +0.54)])
>>> tab_fe
TiedArrayBeams(beams_ra_dec_rad = [(3.1, 0.5), (3.2, 0.54)],
               flyseye          = True,
               nr_tab_rings     = 0,
               tab_ring_size    = 0)
>>> print(tab_fe.xml())

<tiedArrayBeams>
  <flyseye>true</flyseye>
  <nrTabRings>0</nrTabRings>
  <tabRingSize>0.000000</tabRingSize>
  <tiedArrayBeamList>
    <tiedArrayBeam><coherent>true</coherent><angle1>3.100000</angle1><angle2>0.500000</angle2></tiedArrayBeam>
    <tiedArrayBeam><coherent>true</coherent><angle1>3.200000</angle1><angle2>0.540000</angle2></tiedArrayBeam>
  </tiedArrayBeamList>
</tiedArrayBeams>

momxml.pipelines

The pipelines module contains classes that represent data procesing pipelines. At this moment, only NDPPP is implemented here, but later on, this module will also support calibrator/target pipelines and imaging settings.

class momxml.pipelines.AveragingPipeline(name, ndppp, input_data=None, duration_s=None, start_date=None, flagging_strategy=None, parent=None, children=None, predecessor_label=None, initial_status='opened')[source]

Parameters

flagging_strategy: ‘LBAdefault’, ‘HBAdefault’, or None
NDPPP flagging strategy.
initial_status : string
Either ‘opened’ or ‘approved’

Examples

>>> from lofarobsxml             import TargetSource, Angle
>>> from lofarobsxml.backend     import BackendProcessing
>>> from lofarobsxml.observation import Observation
>>> from lofarobsxml.beam        import Beam
>>> target = TargetSource(name      = 'Cyg A',
...                       ra_angle  = Angle(hms  = (19, 59, 28.3566)),
...                       dec_angle = Angle(sdms = ('+', 40, 44, 2.097)))
>>> bm = Beam(target, '77..324')
>>> obs = Observation('HBA_DUAL_INNER', 'LBA_LOW', (2013, 10, 20, 18, 5, 0),
...                   duration_seconds = 600, name = 'Main observation',
...                   stations  = ['CS001', 'RS106', 'DE601'],
...                   clock_mhz = 200, beam_list = [bm],
...                   backend   = BackendProcessing())
>>> avg = AveragingPipeline(name = 'Avg Pipeline', ndppp = NDPPP())
>>> avg.add_input_data_product(obs.children[0])
>>> obs.append_child(avg)
>>> avg
AveragingPipeline(parent            = Observation('Main observation'),
                  children          = None,
                  default_template  = 'Preprocessing Pipeline',
                  duration_s        = None,
                  flagging_strategy = None,
                  initial_status    = 'opened',
                  input_data        = [Beam(parent           = Observation('Main observation'),
                                           children         = None,
                                           duration_s       = None,
                                           initial_status   = 'opened',
                                           measurement_type = 'Target',
                                           name             = 'Cyg A',
                                           subband_spec     = '77..324',
                                           target_source    = TargetSource(name      = 'Cyg A',
                                                                           ra_angle  = Angle(shms = ('+', 19, 59, 28.3566)),
                                                                           dec_angle = Angle(sdms = ('+', 40, 44, 2.097))),
                                           tied_array_beams = None)],
                  name              = 'Avg Pipeline',
                  ndppp             = NDPPP(avg_freq_step   = 64,
                                            avg_time_step   = 1,
                                            demix_always    = None,
                                            demix_freq_step = 64,
                                            demix_if_needed = None,
                                            demix_time_step = 10,
                                            ignore_target   = None),
                  predecessor_label = None,
                  start_date        = None)
>>> print(avg.xml('Project name'))
<lofar:pipeline xsi:type="lofar:AveragingPipelineType">
  <topology>Main_observation.1.Avg_Pipeline</topology>
  <predecessor_topology>Main_observation</predecessor_topology>
  <name>Avg Pipeline</name>
  <description>Avg Pipeline: "Preprocessing Pipeline"</description>
  <currentStatus>
    <mom2:openedStatus/>
  </currentStatus>
  <averagingPipelineAttributes>
    <defaultTemplate>Preprocessing Pipeline</defaultTemplate>
    <duration></duration>
    <startTime></startTime>
    <endTime></endTime>
    <demixingParameters>
      <averagingFreqStep>64</averagingFreqStep>
      <averagingTimeStep>1</averagingTimeStep>
      <demixFreqStep>64</demixFreqStep>
      <demixTimeStep>10</demixTimeStep>
      <demixAlways></demixAlways>
      <demixIfNeeded></demixIfNeeded>
      <ignoreTarget></ignoreTarget>
    </demixingParameters>
    <flaggingStrategy>HBAdefault</flaggingStrategy>
  </averagingPipelineAttributes>
  <usedDataProducts>
    <item>
      <lofar:uvDataProduct topology="Main_observation.0.Cyg_A.dps">
        <name>Main_observation.0.Cyg_A.dps</name>
      </lofar:uvDataProduct>
    </item>
  </usedDataProducts>
  <resultDataProducts>
    <item>
      <lofar:uvDataProduct>
        <name>Main_observation.1.Avg_Pipeline.dps</name>
        <topology>Main_observation.1.Avg_Pipeline.dps</topology>
        <status>no_data</status>
      </lofar:uvDataProduct>
    </item>
  </resultDataProducts>
</lofar:pipeline>
add_input_data_product(input_sap)[source]
predecessor()[source]
validate()[source]
class momxml.pipelines.NDPPP(avg_freq_step=64, avg_time_step=1, demix_freq_step=64, demix_time_step=10, demix_always=None, demix_if_needed=None, ignore_target=None)[source]

The demixing- and averaging parameters for NDPPP.

Parameters

avg_freq_step : int
How many channels to average.
avg_time_step : int
How many time steps to average.
demix_freq_step : int
Width (in channels) of the window over which demixing is done. This must be a multiple of avg_freq_step.
demix_time_step : int
Length (in time slots) of the demixing window. This must be a multiple of avg_time_step.
demix_always : None or list of strings
Sources to always demix. Valid source names are: [‘CasA’, ‘CygA’, ‘TauA’, ‘HydraA’, ‘VirA’, ‘HerA’].
ignore_target : None or bool
See imagoing cookbook documentation. None implies observatory default.

Examples

>>> dmx = NDPPP(16, 2, demix_freq_step=64, demix_time_step=10,
...             demix_always=['CygA', 'CasA'])
>>> dmx
NDPPP(avg_freq_step   = 16,
      avg_time_step   = 2,
      demix_always    = ['CygA', 'CasA'],
      demix_freq_step = 64,
      demix_if_needed = None,
      demix_time_step = 10,
      ignore_target   = None)
>>> print(dmx.xml())

<demixingParameters>
  <averagingFreqStep>16</averagingFreqStep>
  <averagingTimeStep>2</averagingTimeStep>
  <demixFreqStep>64</demixFreqStep>
  <demixTimeStep>10</demixTimeStep>
  <demixAlways>[CygA,CasA]</demixAlways>
  <demixIfNeeded></demixIfNeeded>
  <ignoreTarget></ignoreTarget>
</demixingParameters>

Of course, several consistency checks are made: >>> NDPPP(16, 2, demix_freq_step=64, demix_time_step=5, ... demix_always=[‘CygA’, ‘CasA’]) Traceback (most recent call last): ... ValueError: NDPPP.demix_time_step(5) is not a multiple of NDPPP.avg_time_step(2) >>> NDPPP(16, 2.5, demix_freq_step=64, demix_time_step=5, ... demix_always=[‘CygA’, ‘CasA’]) Traceback (most recent call last): ... TypeError: type(NDPPP.avg_time_step)(2.5) not in [‘int’]

validate()[source]

Raise a ValueError or TypeError if problems with the specification are detected.

xml()[source]

Produce an xml representation of demixing settings.

momxml.angles

Uniform handling of angles.

class momxml.angles.Angle(rad=None, hms=None, shms=None, sdms=None, deg=None)[source]

A simple container for angles. It can be created from various units of angles. Specify exactly one of shms, sdms, rad, or deg.

Parameters

rad : None or float
An angle in radians.
hms : None or tuple
An angle in hours, minutes, and seconds, e.g. (13, 59, 12.4).
shms : None or tuple
A signed angle in hours, minutes, and seconds, e.g. (‘+’, 13, 59, 12.4). The sign is required.
sdms : None or tuple
An angle in degrees, minutes, and seconds, e.g. (‘-‘, 359, 59, 12.4). The sign is required.
deg : None or float
An angle in degrees.

Raises

ValueError
In case of problems with the provided arguments.

Examples

Direct values:

>>> Angle(deg = 360.0)
Angle(rad = 6.283185307179586)
>>> Angle(rad = pi)
Angle(rad = 3.141592653589793)

Hours:

>>> Angle(hms = (3, 15, 30.2))
Angle(rad = 0.8530442163226618)
>>> Angle(shms = ('-', 3, 15, 30.2))
Angle(rad = -0.8530442163226618)

Degrees:

>>> Angle(sdms = ('+', 3, 15, 30.2))
Angle(rad = 0.05686961442151079)
>>> Angle(sdms = ('-', 3, 15, 30.2))
Angle(rad = -0.05686961442151079)

Whoops: >>> Angle(rad = -0.0568696144215, deg = 12) Traceback (most recent call last): ... ValueError: Specify one of hms, shms, sdms, rad, or deg.

as_deg()[source]

Get angle in degrees.

Returns

A float containing the angle in degrees.

Examples

>>> a = Angle (rad = 3.0)
>>> str(a.as_deg())
'171.88733853924697'
as_hours()[source]

Get angle in hours.

Returns

A float containing the angle in hours.

Examples

>>> a = Angle (rad = 3.0)
>>> str(a.as_hours())
'11.459155902616464'
as_rad()[source]

Get angle in radians.

Returns

A float containing the angle in radians.

Examples

>>> a = Angle (rad = 3.0)
>>> a.as_rad()
3.0
as_sdms()[source]

Get the angle in degrees, minutes, and seconds. It does not round off the degrees and minutes based on the seconds. See examples.

Returns

A tuple containing (sign, degrees, minutes, seconds)

Examples

>>> fmt = '%s%02dd %02dm %06.3fs'
>>> fmt % Angle(sdms = ('+', 3, 10, 59.99999)).as_sdms()
'+03d 10m 60.000s'
>>> fmt % Angle(sdms = ('+', 3, 11, 0.0)).as_sdms()
'+03d 10m 60.000s'
>>> fmt % Angle(sdms = ('-', 3, 11, 0.1)).as_sdms()
'-03d 11m 00.100s'
as_shms()[source]

Get the angle in hours, minutes, and seconds. It does not round off the hours and minutes based on the seconds. See examples.

Returns

A tuple containing (sign, hours, minutes, seconds)

Examples

>>> fmt = '%s%02dh %02dm %06.3fs'
>>> fmt % Angle(shms = ('+', 3, 10, 59.99999)).as_shms()
'+03h 10m 60.000s'
>>> fmt % Angle(shms = ('+', 3, 11, 0.0)).as_shms()
'+03h 10m 60.000s'
>>> fmt % Angle(shms = ('-', 3, 11, 0.1)).as_shms()
'-03h 11m 00.100s'
set_deg(deg)[source]

Set the angle in degrees.

Parameters

degrees : float
The angle in degrees.

Returns

A float containing the angle in radians.

Examples

>>> a = Angle(rad = 2.0)
>>> str(a.set_deg(180.0))
'3.141592653589793'
>>> str(a.set_deg(-90.0))
'-1.5707963267948966'
set_rad(rad)[source]

Set the angle in radians.

Parameters

rad : float
The angle in radians.

Returns

A float containing the angle in radians.

Examples

>>> a = Angle(rad = 2.0)
>>> a.set_rad(3.0)
3.0
>>> a.set_rad(-1.2)
-1.2
set_sdms(sign, degrees, minutes, seconds)[source]

Explicitly set angle with sign, degrees, minutes, and seconds.

Parameters

sign : string
One of ‘+’ or ‘-‘
degrees : positive number
Number of degrees. Does not need to be restricted to the [0..360] range. May also be a floating point number.
minutes : positive number
Number of minutes. Does not need to be restricted to [0..60]. May also be floating point.
seconds : positive number
Number of seconds. Does not need to be restricted to [0..60]. May also be floating point.

Returns

A float containing the angle in radians.

Examples

>>> a = Angle(rad = 2.0)
>>> rad = a.set_sdms('-', 2, 30, 45.2)
>>> str(a.as_rad())
'-0.04385236708371975'
set_shms(sign, hours, minutes, seconds)[source]

Explicitly set angle with sign, hours, minutes, and seconds.

Parameters

sign : string
One of ‘+’ or ‘-‘
hours : positive number
Number of hours. Does not need to be restricted to the [0..24] range. May also be a floating point number.
minutes : positive number
Number of minutes. Does not need to be restricted to [0..60]. May also be floating point.
seconds : positive number
Number of seconds. Does not need to be restricted to [0..60]. May also be floating point.

Returns

A float containing the angle in radians.

Examples

>>> a = Angle(rad = 2.0)
>>> rad = a.set_shms('-', 2, 30, 45.2)
>>> str(a.as_rad())
'-0.6577855062557962'
momxml.angles.int_from_sign_char(char)[source]

Returns -1 if char == ‘-‘, +1 if char == ‘+’

Parameters

char: a one-character string
Either ‘+’ or ‘-‘.

Returns

The integer -1 or +1, depending on the value of char.

Raises

ValueError
If char is something other than ‘+’ or ‘-‘.

Examples

>>> int_from_sign_char('+')
1
>>> int_from_sign_char('-')
-1
>>> int_from_sign_char('f')
Traceback (most recent call last):
...
ValueError: char must be either '+' or '-', not 'f'
momxml.angles.sign_char(number)[source]

Returns the sign of number.

Parameters

number : number
The number for which to calculate the sign.

Returns

String ‘+’ if number >= 0.0, ‘-‘ if number < 0.0

Examples

>>> sign_char(3)
'+'
>>> sign_char(0.0)
'+'
>>> sign_char(0)
'+'
>>> sign_char(-1e-30)
'-'
>>> sign_char(-0)
'+'
momxml.angles.signum(number)[source]

Returns the sign of number.

Parameters

number : number
The number for which to calculate the sign.

Returns

Integer +1 if number` >= 0.0, -1 if number < 0.0

Examples

>>> signum(3)
1
>>> signum(0.0)
1
>>> signum(0)
1
>>> signum(-1e-30)
-1
>>> signum(-0)
1

momxml.utilities

Various support functions that did not fit anywhere else.

class momxml.utilities.AutoReprBaseClass[source]

Base class that implements a simplistic __repr__ function. The order in which the members are printed is the same as that in which the arguments are set in bthe constructor body.

exception momxml.utilities.InvalidStationSetError[source]

To be raised if an invalid station set is provided.

momxml.utilities.antenna_field_sort_key(name)[source]

Produce a sort key for station names.

Parameters

name : string
The antenna field’s name.

Examples

>>> antenna_field_sort_key('CS002HBA1')
21
>>> antenna_field_sort_key('CS021LBA')
210
>>> antenna_field_sort_key('RS106HBA')
10600
>>> antenna_field_sort_key('UK608HBA')
60800
momxml.utilities.exclude_conflicting_eu_stations(stations)[source]

The international stations are connected to the same BlueGene IONodes as the HBA1 ear in some core stations. For HBA_ONE, HBA_DUAL_INNER, and HBA_DUAL mode, we need to remove either the core stations, or the eu stations that conflict. This function removes the conflicting eu stations.

Parameters

stations : list of strings
The station names in the observation.

Returns

A list of strings containing only non-conflicting stations, from which the EU stations have been removed.

Examples

>>> exclude_conflicting_eu_stations(['CS001', 'CS002', 'RS407'])
['CS001', 'CS002', 'RS407']
>>> exclude_conflicting_eu_stations(['CS001', 'CS002', 'RS407', 'DE605'])
['CS001', 'CS002', 'RS407', 'DE605']
>>> exclude_conflicting_eu_stations(['CS001', 'CS002', 'CS028', 'RS407',
...                                  'DE601', 'DE605', 'UK608'])
['CS001', 'CS002', 'CS028', 'RS407', 'DE605', 'UK608']
momxml.utilities.exclude_conflicting_nl_stations(stations)[source]

The international stations are connected to the same BlueGene IONodes as the HBA1 ear in some core stations. For HBA_ONE, HBA_DUAL_INNER, and HBA_DUAL mode, we need to remove either the core stations, or the eu stations that conflict. This function removes the conflicting core stations.

Parameters

stations : list of strings
The station names in the observation.

Returns

A list of strings containing only non-conflicting stations, from which the core stations have been removed.

Examples

>>> exclude_conflicting_nl_stations(['CS001', 'CS002', 'RS407'])
['CS001', 'CS002', 'RS407']
>>> exclude_conflicting_nl_stations(['CS001', 'CS002', 'RS407', 'DE605'])
['CS001', 'CS002', 'RS407', 'DE605']
>>> exclude_conflicting_nl_stations(['CS001', 'CS002', 'CS028',
...                                  'RS407', 'DE601', 'DE605', 'UK608'])
['CS002', 'CS028', 'RS407', 'DE601', 'DE605', 'UK608']
momxml.utilities.flatten_list(list_of_lists)[source]

Takes a list of lists and spits out one list with all sub lists concatenated. [[1, 2, 3], [4, 5]] -> [1, 2, 3, 4, 5]

Parameters

list_of_lists : list of lists
The list to flatten.

Returns

A one dimensional list.

Examples

>>> flatten_list([[1, 2, 3], ['a', True], ['b', ['c', 4]]])
[1, 2, 3, 'a', True, 'b', ['c', 4]]
momxml.utilities.indent(string, amount)[source]

Indent a multi-line string by the given amount.

string : string
The string to indent.
amount : int
The direction and amount to indent.

Examples

>> indent(‘HinThere’, 2)
Hi There

>> indent(‘HinTherenn’, -1) i here <BLANKLINE> <BLANKLINE>

momxml.utilities.lofar_observer(date=None)[source]

Parameters

date : ephem.Date
The date to set for the ephem.Observer() instance

Returns

An ephem.Observer() instance for the LOFAR core.

Examples

>>> lofar_observer('2013/04/15 12:34:56')
<ephem.Observer date='2013/4/15 12:34:56' epoch='2000/1/1 12:00:00' lon=6:52:11.4 lat=52:54:54.4 elevation=49.343999999999994m horizon=0:00:00.0 temp=15.0C pressure=1010.0mBar>
momxml.utilities.lofar_sidereal_time(date)[source]

Returns an ephem.Angle object with the current sidereal time at LOFAR CS002 LBA. The CS002 LBA position in ITRF2005 coordinates at epoch 2009.5.

Examples

>>> type(lofar_sidereal_time(ephem.Observer().date))
<class 'ephem.Angle'>
>>> lofar           = ephem.Observer()
>>> lofar.long      = +6.869837540*pi/180
>>> lofar.lat       = +52.915122495*pi/180
>>> lofar.elevation = +49.344
>>> lofar.date      = ephem.Observer().date
>>> abs(lofar.sidereal_time() - lofar_sidereal_time(lofar.date))
0.0
momxml.utilities.lower_case(boolean)[source]

Return lower case string representation of a boolean value.

Parameters

boolean : bool
The value to convert to a string.

Examples >>> lower_case(True) ‘true’ >>> lower_case(False) ‘false’

momxml.utilities.next_date_with_lofar_lst(lst_rad, start_date=None)[source]
momxml.utilities.next_sunrise(date, observer=None)[source]

Return an ephem.Date instance with the next sunrise at LOFAR, or any other ephem.Observer, if provided.

Parameters

date : ephem.Date
Date from which to look for sunrise.
observer : None or ephem.Observer
Location for which Sunrise is computed. Default is LOFAR core if None is provided.

Returns

An ephem.Date instance.

Examples

>>> print(next_sunrise('2013/04/03 12:00:00'))
2013/4/4 04:58:56
momxml.utilities.next_sunset(date, observer=None)[source]

Return an ephem.Date instance with the next sunset at LOFAR, or any other ephem.Observer, if provided.

Parameters

date : ephem.Date
Date from which to look for sunrise.
observer : None or ephem.Observer
Location for which Sunrise is computed. Default is LOFAR core if None is provided.

Returns

An ephem.Date instance.

Examples

>>> print(next_sunset('2013/04/03 12:00:00'))
2013/4/3 18:11:18
momxml.utilities.parse_subband_list(parset_subband_list)[source]

Parse a subband list from a parset or SAS/MAC / MoM spec.

Parameters

parset_subband_list : string
Value of Observation.Beam[0].subbandList

Returns

A list of integers containing the subband numbers.

Raises

ValueError
If a syntax problem is encountered.

Examples

>>> sb_spec = '[154..163,185..194,215..224,245..254,275..284,10*374]'
>>> parse_subband_list(sb_spec)
[154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374]
>>> sb_spec = '[77..87,116..127,155..166,194..205,233..243,272..282]'
>>> parse_subband_list(sb_spec)
[77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282]
>>> parse_subband_list('[]')
[]
>>> parse_subband_list('1,2,10..15,200..202,400')
[1, 2, 10, 11, 12, 13, 14, 15, 200, 201, 202, 400]
momxml.utilities.sort_station_list(stations)[source]

Sort a station list so we first get the CS, then the RS and EU in numerical order.

Parameters

stations : list of strings
The station list to sort.

Examples

>>> sort_station_list(['UK608', 'RS407', 'DE603', 'RS106',
...     'RS205', 'CS026', 'SE607', 'CS501', 'DE605', 'RS509',
...     'CS001'])
['CS001', 'CS026', 'CS501', 'RS106', 'RS205', 'RS407', 'RS509', 'DE603', 'DE605', 'SE607', 'UK608']
>>> sort_station_list(['UK608HBA', 'RS407HBA', 'DE603HBA', 'RS106HBA',
...     'CS026HBA1', 'SE607HBA', 'CS026HBA0', 'CS501HBA0', 'DE605HBA', 'RS509HBA',
...     'CS001HBA1'])
['CS001HBA1', 'CS026HBA0', 'CS026HBA1', 'CS501HBA0', 'RS106HBA', 'RS407HBA', 'RS509HBA', 'DE603HBA', 'DE605HBA', 'SE607HBA', 'UK608HBA']
momxml.utilities.station_list(station_set, include=None, exclude=None)[source]

Provides a sorted list of station names, given a station set name, a list of stations to include, and a list of stations to exclude. Names use upper case letters.

Parameters

station_set : string
One of ‘superterp’, ‘core’, ‘remote’, ‘nl’, ‘all’, or ‘none’, where ‘nl’ is the concatenation of the ‘core’ and ‘remote’ sets, and all is ‘nl’ plus ‘eu’.
include : None or list of strings
List of station names to append to the station set.
exclude : None or list of strings
List of station names to remove from the station set.

Returns

A sorted list of strings containing LOFAR station names.

Examples

>>> station_list('superterp')
['CS002', 'CS003', 'CS004', 'CS005', 'CS006', 'CS007']
>>> len(station_list('core'))
24
>>> station_list('remote')
['RS106', 'RS205', 'RS208', 'RS210', 'RS305', 'RS306', 'RS307', 'RS310', 'RS406', 'RS407', 'RS409', 'RS503', 'RS508', 'RS509']
>>> len(station_list('nl'))
38
>>> (station_list('nl', exclude = station_list('remote')) ==
...  station_list('core'))
True
>>> station_list('eu')
['DE601', 'DE602', 'DE603', 'DE604', 'DE605', 'FR606', 'SE607', 'UK608', 'DE609', 'PL610', 'PL611', 'PL612']
>>> station_list('all')==station_list('nl', include=station_list('eu'))
True
>>> len(unique(station_list('all')))
50
>>> station_list('wsrt')
Traceback (most recent call last):
...
lofarobsxml.utilities.InvalidStationSetError: wsrt is not a valid station set.
momxml.utilities.typecheck(variable, type_class, name=None)[source]

Raise TypeError if variable is not an instance of type_class.

Parameters

variable : any object
The variable that will be type-checked.
type_class : type or list of types
The desired type of variable.
name : string
A descriptive name of the variable, used in the error message.

Examples

>>> typecheck(4.0 , float)
>>> typecheck(None, [int, type(None)])
>>> typecheck(5   , [int, type(None)])
>>> typecheck(4.0, [int, type(None)])
Traceback (most recent call last):
...
TypeError: type(4.0) not in ['int', 'NoneType']
>>> a = 'blaargh'
>>> typecheck(a, int, 'a')
Traceback (most recent call last):
...
TypeError: type(a)('blaargh') not in ['int']
momxml.utilities.unique(sequence)[source]

Return a list containing all unique elements of a sequence.

Parameters

sequence : sequence
List from which to return all unique elements.

Returns

A list.

Examples

>>> sorted(unique([3, 2, 4, 3, 1, 1, 2]))
[1, 2, 3, 4]
momxml.utilities.validate_enumeration(name, value, allowed)[source]

If value of kind name is not in the list of allowed values, raise a ValueError. Very useful to verify if a caller provided a wrong value for a string that is part of an enumeration.

Parameters

name : string
The kind of thing the value could represent.
value : string
The value to be tested.
allowed : list of strings
List of all valid values.

Returns

True if value is in allowed.

Raises

ValueError
If value is not in allowed.

Example

>>> validate_enumeration('station set', 'core',
...                      allowed = ['core', 'remote', 'nl', 'all'])
True
>>> validate_enumeration('station set', 'wsrt',
...                      allowed = ['core', 'remote', 'nl', 'all'])
Traceback (most recent call last):
...
ValueError: 'wsrt' is not a valid station set; choose one of 'core', 'remote', 'nl', 'all'
momxml.utilities.with_auto_repr(cls)[source]

Class decorator that adds a nicer default __repr__ method to a class.

Examples

>>> class Elements(object):
...     def __init__(self, a, b):
...         self.a = a
...         self.b = b
>>> aa = Elements(1, '3')
>>> print(repr(aa)[0:-16])
<lofarobsxml.utilities.Elements object at
>>> Elements = with_auto_repr(Elements)
>>> bb = Elements (1, 'v')
>>> print(repr(bb))
Elements(a = 1,
         b = 'v')

momxml.observationspecificationbase

A base class for classes that generate (part of) the xml needed to enter information into MoM.

class momxml.observationspecificationbase.ObservationSpecificationBase(name, parent=None, children=None, initial_status='opened')[source]

A base class from which to derive instances which can generate specifications for observations and pipelines in formats that MoM, the XML Generator by Alwin de Jong, or users can read.

Parameters

name : string
A free form string labelling the instance.
parent : ObservationSpecificationBase instance
The parent of the curent instance.
children : None or a list of ObservationSpecificationBase
The children of the current instance.
initial_status : string
Either ‘opened’ or ‘approved’

Examples

>>> OSB = ObservationSpecificationBase
append_child(instance)[source]

Append a child to self.children. This method also calls set_parent() on the the child, to ensure that the parent is set correctly.

Parameters

instance : ObservationSpecificationBase
The object to add to self.children.
child_id(instance)[source]

Return the child ID of object instance if it is in self.children

Parameters

instance : ObservationSpecificationBase
The instance for which one wants the position in the self.children list.
label()[source]

Returns an ascii label that reflects the full path of the current instance in the observation set specification.

set_parent(instance)[source]

Set self.parent to instance.

Parameters

instance : ObservationSpecificationBase
The instance of the parent node.
tree_depth()[source]

Return the depth of the current node in the tree. A node without parent is automatically at depth 0.

xml(project_name)[source]

Actually generate the required XML. This method calls two other methods, which may be overridden: xml_prefix() and xml_suffix().

xml_prefix(project_name)[source]

Generate the XML content that goes before the child list. Should return a string. This is one of the two virtual methods. The other one is xml_suffix().

xml_suffix(project_name)[source]

Generate the XML content that goes after the child list. Should return a string. This is one of the two virtual methods. The other one is xml_prefix().