##################### generated by xml-casa (v2) from hsdn_restoredata.xml ##########
##################### e2dc22f8ee4111e4d2034bfb4f05475b ##############################
from __future__ import absolute_import
from casashell.private.stack_manip import find_local as __sf__
from casashell.private.stack_manip import find_frame as _find_frame
from casatools.typecheck import validator as _pc
from casatools.coercetype import coerce as _coerce
from pipeline.hsdn.cli import hsdn_restoredata as _hsdn_restoredata_t
from collections import OrderedDict
import numpy
import sys
import os
import shutil
[docs]def static_var(varname, value):
def decorate(func):
setattr(func, varname, value)
return func
return decorate
class _hsdn_restoredata:
"""
hsdn_restoredata ---- Restore flagged and calibration single dish data from a pipeline run
The hsdn_restoredata task restores flagged and calibrated MeasurementSets
from archived ASDMs and pipeline flagging and calibration date products.
pipeline context defined parameter argument which can be set only in
'interactive mode'
The hsdn_restoredata task restores flagged and calibrated data from archived
ASDMs and pipeline flagging and calibration data products. Pending archive
retrieval support hsdn_restoredata assumes that the required products
are available in the rawdata_dir in the format produced by the
hifa_exportdata task.
hsdn_restoredata assumes that the following entities are available in the raw
data directory
o the ASDMs to be restored
o for each ASDM in the input list
o a compressed tar file of the final flagversions file, e.g.
uid___A002_X30a93d_X43e.ms.flagversions.tar.gz
o a text file containing the applycal instructions, e.g.
uid___A002_X30a93d_X43e.ms.calapply.txt
o a compressed tar file containing the caltables for the parent session,
e.g. uid___A001_X74_X29.session_3.caltables.tar.gz
hsdn_restoredata performs the following operations
o imports the ASDM(s))
o removes the default MS.flagversions directory created by the filler
o restores the final MS.flagversions directory stored by the pipeline
o restores the final set of pipeline flags to the MS
o restores the final calibration state of the MS
o restores the final calibration tables for each MS
o applies the calibration tables to each MS
Output:
results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
the results object for the pipeline task is returned.
--------- parameter descriptions ---------------------------------------------
vis List of raw visibility data files to be restored. Assumed to be
in the directory specified by rawdata_dir.
example: vis=['uid___A002_X30a93d_X43e']
reffile Path to a file containing scaling factors between beams.
The format is equals to jyperk.csv with five fields:
MS name, beam name (instead of antenna name), spectral window id,
polarization string, and the scaling factor.
Example for the file is as follows:
#MS,Beam,Spwid,Polarization,Factor
mg2-20181016165248-181017.ms,NRO-BEAM0,0,I,1.000000000
mg2-20181016165248-181017.ms,NRO-BEAM0,1,I,1.000000000
mg2-20181016165248-181017.ms,NRO-BEAM0,2,I,1.000000000
mg2-20181016165248-181017.ms,NRO-BEAM0,3,I,1.000000000
mg2-20181016165248-181017.ms,NRO-BEAM1,0,I,3.000000000
mg2-20181016165248-181017.ms,NRO-BEAM1,1,I,3.000000000
mg2-20181016165248-181017.ms,NRO-BEAM1,2,I,3.000000000
mg2-20181016165248-181017.ms,NRO-BEAM1,3,I,3.000000000
mg2-20181016165248-181017.ms,NRO-BEAM2,0,I,0.500000000
mg2-20181016165248-181017.ms,NRO-BEAM2,1,I,0.500000000
mg2-20181016165248-181017.ms,NRO-BEAM2,2,I,0.500000000
mg2-20181016165248-181017.ms,NRO-BEAM2,3,I,0.500000000
mg2-20181016165248-181017.ms,NRO-BEAM3,0,I,2.000000000
mg2-20181016165248-181017.ms,NRO-BEAM3,1,I,2.000000000
mg2-20181016165248-181017.ms,NRO-BEAM3,2,I,2.000000000
mg2-20181016165248-181017.ms,NRO-BEAM3,3,I,2.000000000
If no file name is specified or specified file doesn't exist,
all the factors are set to 1.0.
example: reffile='', reffile='nroscalefactor.csv'
infiles List of input MeasurementSets.
example: vis='ngc5921.ms'
caltable Name of output gain calibration tables.
example: caltable='ngc5921.gcal'
products_dir Name of the data products directory. Currently not
used.
example: products_dir='myproductspath'
copytoraw Copy calibration and flagging tables to raw data directory.
example: copytoraw=False
rawdata_dir Name of the raw data directory.
example: rawdata_dir='myrawdatapath'
pipelinemode The pipeline operating mode. In 'automatic' mode the pipeline
determines the values of all context defined pipeline inputs automatically.
In 'interactive' mode the user can set the pipeline context defined
parameters manually. In 'getinputs' mode the user can check the settings
of all pipeline parameters without running the task.
overwrite Overwrite existing files on import
nocopy Disable copying of MS to working directory
createmms Create an MMS
dryrun Run the commands (True) or generate the commands to be run but
do not execute (False).
acceptresults Add the results of the task to the pipeline context (True) or
reject them (False).
--------- examples -----------------------------------------------------------
1. Restore the pipeline results for a single ASDM in a single session
hsdn_restoredata (vis=['mg2-20181016165248-190320.ms'], reffile='nroscalefactor.csv')
"""
_info_group_ = """pipeline"""
_info_desc_ = """Restore flagged and calibration single dish data from a pipeline run"""
__schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'reffile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'infiles': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'caltable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'products_dir': {'type': 'cStr', 'coerce': _coerce.to_str}, 'copytoraw': {'type': 'cBool'}, 'rawdata_dir': {'type': 'cStr', 'coerce': _coerce.to_str}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'overwrite': {'type': 'cBool'}, 'nocopy': {'type': 'cBool'}, 'createmms': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'true', 'false' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
def __init__(self):
self.__stdout = None
self.__stderr = None
self.__root_frame_ = None
def __globals_(self):
if self.__root_frame_ is None:
self.__root_frame_ = _find_frame( )
assert self.__root_frame_ is not None, "could not find CASAshell global frame"
return self.__root_frame_
def __to_string_(self,value):
if type(value) is str:
return "'%s'" % value
else:
return str(value)
def __validate_(self,doc,schema):
return _pc.validate(doc,schema)
def __do_inp_output(self,param_prefix,description_str,formatting_chars):
out = self.__stdout or sys.stdout
description = description_str.split( )
prefix_width = 23 + 16 + 4
output = [ ]
addon = ''
first_addon = True
while len(description) > 0:
## starting a new line.....................................................................
if len(output) == 0:
## for first line add parameter information............................................
if len(param_prefix)-formatting_chars > prefix_width - 1:
output.append(param_prefix)
continue
addon = param_prefix + ' #'
first_addon = True
addon_formatting = formatting_chars
else:
## for subsequent lines space over prefix width........................................
addon = (' ' * prefix_width) + '#'
first_addon = False
addon_formatting = 0
## if first word of description puts us over the screen width, bail........................
if len(addon + description[0]) - addon_formatting + 1 > self.term_width:
## if we're doing the first line make sure it's output.................................
if first_addon: output.append(addon)
break
while len(description) > 0:
## if the next description word puts us over break for the next line...................
if len(addon + description[0]) - addon_formatting + 1 > self.term_width: break
addon = addon + ' ' + description[0]
description.pop(0)
output.append(addon)
out.write('\n'.join(output) + '\n')
#--------- return nonsubparam values ----------------------------------------------
def __rawdata_dir_dflt( self, glb ):
return '../rawdata'
def __rawdata_dir( self, glb ):
if 'rawdata_dir' in glb: return glb['rawdata_dir']
return '../rawdata'
def __vis_dflt( self, glb ):
return [ ]
def __vis( self, glb ):
if 'vis' in glb: return glb['vis']
return [ ]
def __createmms_dflt( self, glb ):
return 'automatic'
def __createmms( self, glb ):
if 'createmms' in glb: return glb['createmms']
return 'automatic'
def __caltable_dflt( self, glb ):
return [ ]
def __caltable( self, glb ):
if 'caltable' in glb: return glb['caltable']
return [ ]
def __copytoraw_dflt( self, glb ):
return True
def __copytoraw( self, glb ):
if 'copytoraw' in glb: return glb['copytoraw']
return True
def __pipelinemode_dflt( self, glb ):
return 'automatic'
def __pipelinemode( self, glb ):
if 'pipelinemode' in glb: return glb['pipelinemode']
return 'automatic'
def __reffile_dflt( self, glb ):
return ''
def __reffile( self, glb ):
if 'reffile' in glb: return glb['reffile']
return ''
def __infiles_dflt( self, glb ):
return [ ]
def __infiles( self, glb ):
if 'infiles' in glb: return glb['infiles']
return [ ]
def __products_dir_dflt( self, glb ):
return '../products'
def __products_dir( self, glb ):
if 'products_dir' in glb: return glb['products_dir']
return '../products'
def __overwrite_dflt( self, glb ):
return False
def __overwrite( self, glb ):
if 'overwrite' in glb: return glb['overwrite']
return False
def __nocopy_dflt( self, glb ):
return False
def __nocopy( self, glb ):
if 'nocopy' in glb: return glb['nocopy']
return False
#--------- return inp/go default --------------------------------------------------
def __acceptresults_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return bool(True)
return None
def __dryrun_dflt( self, glb ):
if self.__pipelinemode( glb ) == "interactive": return bool(False)
return None
#--------- return subparam values -------------------------------------------------
def __infiles( self, glb ):
if 'infiles' in glb: return glb['infiles']
dflt = self.__infiles_dflt( glb )
if dflt is not None: return dflt
return [ ]
def __caltable( self, glb ):
if 'caltable' in glb: return glb['caltable']
dflt = self.__caltable_dflt( glb )
if dflt is not None: return dflt
return [ ]
def __overwrite( self, glb ):
if 'overwrite' in glb: return glb['overwrite']
dflt = self.__overwrite_dflt( glb )
if dflt is not None: return dflt
return False
def __nocopy( self, glb ):
if 'nocopy' in glb: return glb['nocopy']
dflt = self.__nocopy_dflt( glb )
if dflt is not None: return dflt
return False
def __dryrun( self, glb ):
if 'dryrun' in glb: return glb['dryrun']
dflt = self.__dryrun_dflt( glb )
if dflt is not None: return dflt
return False
def __acceptresults( self, glb ):
if 'acceptresults' in glb: return glb['acceptresults']
dflt = self.__acceptresults_dflt( glb )
if dflt is not None: return dflt
return True
#--------- subparam inp output ----------------------------------------------------
def __vis_inp(self):
description = 'List of input visibility data'
value = self.__vis( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'vis': value},{'vis': self.__schema['vis']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('vis',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __reffile_inp(self):
description = 'File of factors to adjust scale between beams'
value = self.__reffile( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'reffile': value},{'reffile': self.__schema['reffile']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('reffile',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __infiles_inp(self):
if self.__infiles_dflt( self.__globals_( ) ) is not None:
description = 'List of input MeasurementSets'
value = self.__infiles( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'infiles': value},{'infiles': self.__schema['infiles']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('infiles',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __caltable_inp(self):
if self.__caltable_dflt( self.__globals_( ) ) is not None:
description = 'List of output caltable(s)'
value = self.__caltable( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'caltable': value},{'caltable': self.__schema['caltable']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('caltable',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __products_dir_inp(self):
description = 'The archived pipeline data products directory'
value = self.__products_dir( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'products_dir': value},{'products_dir': self.__schema['products_dir']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('products_dir',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __copytoraw_inp(self):
description = 'Copy calibration and flagging tables to raw data directory'
value = self.__copytoraw( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'copytoraw': value},{'copytoraw': self.__schema['copytoraw']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('copytoraw',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __rawdata_dir_inp(self):
description = 'The raw data directory'
value = self.__rawdata_dir( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'rawdata_dir': value},{'rawdata_dir': self.__schema['rawdata_dir']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('rawdata_dir',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __pipelinemode_inp(self):
description = 'The pipeline operating mode'
value = self.__pipelinemode( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'pipelinemode': value},{'pipelinemode': self.__schema['pipelinemode']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('\x1B[1m\x1B[47m%-16.16s =\x1B[0m %s%-23s%s' % ('pipelinemode',pre,self.__to_string_(value),post),description,13+len(pre)+len(post))
def __overwrite_inp(self):
if self.__overwrite_dflt( self.__globals_( ) ) is not None:
description = 'Overwrite existing files on import'
value = self.__overwrite( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'overwrite': value},{'overwrite': self.__schema['overwrite']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('overwrite',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __nocopy_inp(self):
if self.__nocopy_dflt( self.__globals_( ) ) is not None:
description = 'Disable copying of MS to working directory'
value = self.__nocopy( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'nocopy': value},{'nocopy': self.__schema['nocopy']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('nocopy',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __createmms_inp(self):
description = 'Create an MMS'
value = self.__createmms( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'createmms': value},{'createmms': self.__schema['createmms']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output('%-16.16s = %s%-23s%s' % ('createmms',pre,self.__to_string_(value),post),description,0+len(pre)+len(post))
def __dryrun_inp(self):
if self.__dryrun_dflt( self.__globals_( ) ) is not None:
description = 'Run the task (False) or display task command (True)'
value = self.__dryrun( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'dryrun': value},{'dryrun': self.__schema['dryrun']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('dryrun',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
def __acceptresults_inp(self):
if self.__acceptresults_dflt( self.__globals_( ) ) is not None:
description = 'Add the results into the pipeline context'
value = self.__acceptresults( self.__globals_( ) )
(pre,post) = ('','') if self.__validate_({'acceptresults': value},{'acceptresults': self.__schema['acceptresults']}) else ('\x1B[91m','\x1B[0m')
self.__do_inp_output(' \x1B[92m%-13.13s =\x1B[0m %s%-23s%s' % ('acceptresults',pre,self.__to_string_(value),post),description,9+len(pre)+len(post))
#--------- global default implementation-------------------------------------------
@static_var('state', __sf__('casa_inp_go_state'))
def set_global_defaults(self):
self.set_global_defaults.state['last'] = self
glb = self.__globals_( )
if 'dryrun' in glb: del glb['dryrun']
if 'pipelinemode' in glb: del glb['pipelinemode']
if 'rawdata_dir' in glb: del glb['rawdata_dir']
if 'createmms' in glb: del glb['createmms']
if 'vis' in glb: del glb['vis']
if 'acceptresults' in glb: del glb['acceptresults']
if 'overwrite' in glb: del glb['overwrite']
if 'caltable' in glb: del glb['caltable']
if 'reffile' in glb: del glb['reffile']
if 'nocopy' in glb: del glb['nocopy']
if 'copytoraw' in glb: del glb['copytoraw']
if 'products_dir' in glb: del glb['products_dir']
if 'infiles' in glb: del glb['infiles']
#--------- inp function -----------------------------------------------------------
def inp(self):
print("# hsdn_restoredata -- %s" % self._info_desc_)
self.term_width, self.term_height = shutil.get_terminal_size(fallback=(80, 24))
self.__vis_inp( )
self.__reffile_inp( )
self.__infiles_inp( )
self.__caltable_inp( )
self.__products_dir_inp( )
self.__copytoraw_inp( )
self.__rawdata_dir_inp( )
self.__pipelinemode_inp( )
self.__overwrite_inp( )
self.__nocopy_inp( )
self.__createmms_inp( )
self.__dryrun_inp( )
self.__acceptresults_inp( )
#--------- tget function ----------------------------------------------------------
@static_var('state', __sf__('casa_inp_go_state'))
def tget(self,file=None):
from casashell.private.stack_manip import find_frame
from runpy import run_path
filename = None
if file is None:
if os.path.isfile("hsdn_restoredata.last"):
filename = "hsdn_restoredata.last"
elif isinstance(file, str):
if os.path.isfile(file):
filename = file
if filename is not None:
glob = find_frame( )
newglob = run_path( filename, init_globals={ } )
for i in newglob:
glob[i] = newglob[i]
self.tget.state['last'] = self
else:
print("could not find last file, setting defaults instead...")
self.set_global_defaults( )
def __call__( self, vis=None, reffile=None, infiles=None, caltable=None, products_dir=None, copytoraw=None, rawdata_dir=None, pipelinemode=None, overwrite=None, nocopy=None, createmms=None, dryrun=None, acceptresults=None ):
def noobj(s):
if s.startswith('<') and s.endswith('>'):
return "None"
else:
return s
_prefile = os.path.realpath('hsdn_restoredata.pre')
_postfile = os.path.realpath('hsdn_restoredata.last')
_return_result_ = None
_arguments = [vis,reffile,infiles,caltable,products_dir,copytoraw,rawdata_dir,pipelinemode,overwrite,nocopy,createmms,dryrun,acceptresults]
_invocation_parameters = OrderedDict( )
if any(map(lambda x: x is not None,_arguments)):
# invoke python style
# set the non sub-parameters that are not None
local_global = { }
if vis is not None: local_global['vis'] = vis
if reffile is not None: local_global['reffile'] = reffile
if products_dir is not None: local_global['products_dir'] = products_dir
if copytoraw is not None: local_global['copytoraw'] = copytoraw
if rawdata_dir is not None: local_global['rawdata_dir'] = rawdata_dir
if pipelinemode is not None: local_global['pipelinemode'] = pipelinemode
if createmms is not None: local_global['createmms'] = createmms
# the invocation parameters for the non-subparameters can now be set - this picks up those defaults
_invocation_parameters['vis'] = self.__vis( local_global )
_invocation_parameters['reffile'] = self.__reffile( local_global )
_invocation_parameters['products_dir'] = self.__products_dir( local_global )
_invocation_parameters['copytoraw'] = self.__copytoraw( local_global )
_invocation_parameters['rawdata_dir'] = self.__rawdata_dir( local_global )
_invocation_parameters['pipelinemode'] = self.__pipelinemode( local_global )
_invocation_parameters['createmms'] = self.__createmms( local_global )
# the sub-parameters can then be set. Use the supplied value if not None, else the function, which gets the appropriate default
_invocation_parameters['infiles'] = self.__infiles( _invocation_parameters ) if infiles is None else infiles
_invocation_parameters['caltable'] = self.__caltable( _invocation_parameters ) if caltable is None else caltable
_invocation_parameters['overwrite'] = self.__overwrite( _invocation_parameters ) if overwrite is None else overwrite
_invocation_parameters['nocopy'] = self.__nocopy( _invocation_parameters ) if nocopy is None else nocopy
_invocation_parameters['dryrun'] = self.__dryrun( _invocation_parameters ) if dryrun is None else dryrun
_invocation_parameters['acceptresults'] = self.__acceptresults( _invocation_parameters ) if acceptresults is None else acceptresults
else:
# invoke with inp/go semantics
_invocation_parameters['vis'] = self.__vis( self.__globals_( ) )
_invocation_parameters['reffile'] = self.__reffile( self.__globals_( ) )
_invocation_parameters['infiles'] = self.__infiles( self.__globals_( ) )
_invocation_parameters['caltable'] = self.__caltable( self.__globals_( ) )
_invocation_parameters['products_dir'] = self.__products_dir( self.__globals_( ) )
_invocation_parameters['copytoraw'] = self.__copytoraw( self.__globals_( ) )
_invocation_parameters['rawdata_dir'] = self.__rawdata_dir( self.__globals_( ) )
_invocation_parameters['pipelinemode'] = self.__pipelinemode( self.__globals_( ) )
_invocation_parameters['overwrite'] = self.__overwrite( self.__globals_( ) )
_invocation_parameters['nocopy'] = self.__nocopy( self.__globals_( ) )
_invocation_parameters['createmms'] = self.__createmms( self.__globals_( ) )
_invocation_parameters['dryrun'] = self.__dryrun( self.__globals_( ) )
_invocation_parameters['acceptresults'] = self.__acceptresults( self.__globals_( ) )
try:
with open(_prefile,'w') as _f:
for _i in _invocation_parameters:
_f.write("%-13s = %s\n" % (_i,noobj(repr(_invocation_parameters[_i]))))
_f.write("#hsdn_restoredata( ")
count = 0
for _i in _invocation_parameters:
_f.write("%s=%s" % (_i,noobj(repr(_invocation_parameters[_i]))))
count += 1
if count < len(_invocation_parameters): _f.write(",")
_f.write(" )\n")
except: pass
try:
_return_result_ = _hsdn_restoredata_t( _invocation_parameters['vis'],_invocation_parameters['reffile'],_invocation_parameters['infiles'],_invocation_parameters['caltable'],_invocation_parameters['products_dir'],_invocation_parameters['copytoraw'],_invocation_parameters['rawdata_dir'],_invocation_parameters['pipelinemode'],_invocation_parameters['overwrite'],_invocation_parameters['nocopy'],_invocation_parameters['createmms'],_invocation_parameters['dryrun'],_invocation_parameters['acceptresults'] )
except Exception as e:
from traceback import format_exc
from casatasks import casalog
casalog.origin('hsdn_restoredata')
casalog.post("Exception Reported: Error in hsdn_restoredata: %s" % str(e),'SEVERE')
casalog.post(format_exc( ))
_return_result_ = False
try:
os.rename(_prefile,_postfile)
except: pass
return _return_result_
hsdn_restoredata = _hsdn_restoredata( )