diff --git a/CEP/Pipeline/recipes/sip/bin/msss_imager_pipeline.py b/CEP/Pipeline/recipes/sip/bin/msss_imager_pipeline.py index 8a58a2f1b3aec4c00e764f9da7d2b0994cf13c4e..5fe2a93ad9171819f742bd6ad6b6fbbadd9bfd2b 100755 --- a/CEP/Pipeline/recipes/sip/bin/msss_imager_pipeline.py +++ b/CEP/Pipeline/recipes/sip/bin/msss_imager_pipeline.py @@ -213,11 +213,8 @@ class msss_imager_pipeline(control): # ***************************************************************** # (4) Get parameters awimager from the prepare_parset and inputs - # TODO: remove this ugly hack 5201 - aw_image_mapfile, maxbaseline, cellsize_mapfile = self._aw_imager( - concat_ms_map_path, - idx_loop, - sourcedb_map_path, + aw_image_mapfile, maxbaseline = self._aw_imager(concat_ms_map_path, + idx_loop, sourcedb_map_path, skip=False) # ***************************************************************** @@ -245,8 +242,7 @@ class msss_imager_pipeline(control): full_parset.getString('prefix') + full_parset.fullModuleName('DataProducts') ), - product_type="SkyImage", - cellsize_mapfile=cellsize_mapfile) # TODO: remove this ugly hack 5201 + product_type="SkyImage") return 0 @@ -449,8 +445,6 @@ class msss_imager_pipeline(control): output_mapfile = self._write_datamap_to_file(None, "awimager", "output map for awimager recipe") - cellsize_mapfile = self._write_datamap_to_file(None, "cellsize", - "output map for cellsizes of produced images") mask_patch_size = self.parset.getInt("Imaging.mask_patch_size") auto_imaging_specs = self.parset.getBool("Imaging.auto_imaging_specs") @@ -466,10 +460,9 @@ class msss_imager_pipeline(control): mask_patch_size=mask_patch_size, sourcedb_path=sky_path, working_directory=self.scratch_directory, - autogenerate_parameters=auto_imaging_specs, - cellsize_mapfile=cellsize_mapfile) + autogenerate_parameters=auto_imaging_specs) - return output_mapfile, max_baseline, cellsize_mapfile + return output_mapfile, max_baseline @xml_node def _prepare_phase(self, input_ms_map_path, target_mapfile, @@ -598,10 +591,10 @@ class msss_imager_pipeline(control): def _write_datamap_to_file(self, datamap, mapfile_name, message=""): """ - Write the suplied map to the mapfile directory in the jobs dir with - the filename suplied in mapfile_name. - Return the full path of the created file. - If suplied data is None then the file is touched if not existing and + Write the suplied the suplied map to the mapfile. + directory in the jobs dir with the filename suplied in mapfile_name. + Return the full path to the created file. + If suplied data is None then the file is touched if not existing, but existing files are kept as is """ diff --git a/CEP/Pipeline/recipes/sip/helpers/metadata.py b/CEP/Pipeline/recipes/sip/helpers/metadata.py index fb8ccf884ec3ad683b71bcfd67fa280ced1d4ebb..5910d7bd749297fb2f85b3d82688afad855f5c42 100644 --- a/CEP/Pipeline/recipes/sip/helpers/metadata.py +++ b/CEP/Pipeline/recipes/sip/helpers/metadata.py @@ -245,6 +245,9 @@ class SkyImage(DataProduct): coord = image.coordinates() beaminfo = image.imageinfo()['restoringbeam'] npix = image.shape()[2] # Assume square dimensions + dircrd = image.coordinates()["direction"] + radec_cellsz_rad = dircrd.get_increment()[0] # [ra, dec] (ind. for lofar) + self._data.update({ 'numberOfAxes' : image.ndim(), 'coordinateTypes' : coord._names, @@ -257,7 +260,8 @@ class SkyImage(DataProduct): 'LOFAR_QUALITY', 'QUALITY_MEASURE', 'RMS_NOISE_I' )['VALUE'], 'rmsNoiseUnit' : image.unit(), - 'npix' : npix + 'npix' : npix, + 'cellsize' : str(radec_cellsz_rad) + "rad" }) if 'direction' in coord._names: direction = coord.get_coordinate('direction') diff --git a/CEP/Pipeline/recipes/sip/master/get_metadata.py b/CEP/Pipeline/recipes/sip/master/get_metadata.py index abd83b9decc1571e557ece1d48807e3338984c01..4aa3da68e64d713de152310524004b00f036314a 100644 --- a/CEP/Pipeline/recipes/sip/master/get_metadata.py +++ b/CEP/Pipeline/recipes/sip/master/get_metadata.py @@ -44,11 +44,6 @@ class get_metadata(BaseRecipe, RemoteCommandRecipeMixIn): '--parset-prefix', help="Prefix for each key in the output parset file", default='' - ), - 'cellsize_mapfile': ingredient.StringField( # TODO: remove this ugly hack 5201 - '--cellsize_mapfile', - help="optional mapfile with cellsizes of produced skyimages", - default='' ) } @@ -97,17 +92,9 @@ class get_metadata(BaseRecipe, RemoteCommandRecipeMixIn): ) ) self._schedule_jobs(jobs) - - # # TODO: remove this ugly hack 5201 - if (product_type is "SkyImage"): - cellsize_map = DataMap.load(self.inputs["cellsize_mapfile"]) - cellsize_map.iterator = DataMap.SkipIterator - - for job, inp, cellsize in zip(jobs, data, cellsize_map): + for job, inp in zip(jobs, data): if job.results['returncode'] != 0: inp.skip = True - elif(product_type is "SkyImage"): # TODO: remove this ugly hack 5201 - job.results["cellsize"] = cellsize.file # ******************************************************************** # 4. validate performance @@ -138,7 +125,8 @@ class get_metadata(BaseRecipe, RemoteCommandRecipeMixIn): try: create_directory(os.path.dirname(self.inputs['parset_file'])) parset.writeFile(self.inputs['parset_file']) - self.logger.info("Wrote meta data to: " + self.inputs['parset_file']) + self.logger.info("Wrote meta data to: " + + self.inputs['parset_file']) except RuntimeError, err: self.logger.error("Failed to write meta-data: %s" % str(err)) return 1 diff --git a/CEP/Pipeline/recipes/sip/master/imager_awimager.py b/CEP/Pipeline/recipes/sip/master/imager_awimager.py index c286e36fd93fa8a0ce98972d666b82df27bfd3fd..f1ee8234db90d3febf7d443417e62e5b55323a9f 100644 --- a/CEP/Pipeline/recipes/sip/master/imager_awimager.py +++ b/CEP/Pipeline/recipes/sip/master/imager_awimager.py @@ -65,17 +65,10 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn): help="Turns on the autogeneration of: cellsize, image-size. MSSS like" "functionality" ), - 'cellsize_mapfile': ingredient.StringField( - '--cellsize-mapfile', - default=True, - help="location of the output mapfile containing the cellsize of" - "produced images" - ), # TODO: remove this ugly hack 5201 } outputs = { 'mapfile': ingredient.StringField(), - 'cellsize_mapfile': ingredient.StringField() # TODO: remove this ugly hack 5201 } def go(self): @@ -110,9 +103,6 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn): w.skip = x.skip = y.skip = ( w.skip or x.skip or y.skip ) - - # create a copy of the output map to store cellsizes - cellsize_map = copy.deepcopy(output_map) sourcedb_map.iterator = input_map.iterator = output_map.iterator = \ DataMap.SkipIterator @@ -144,26 +134,15 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn): # ********************************************************************* # 3. Check output of the node scripts - for job, output_item, cellsize_item in zip(jobs, output_map, - cellsize_map): # TODO: remove this ugly hack 5201 + for job, output_item in zip(jobs, output_map): # job == None on skipped job if not "image" in job.results: output_item.file = "failed" output_item.skip = True - # Reuse the mapfile structure to return structured information - # This is temporary code: It should be send within the casa/ - # hd5f image. - cellsize_item.file = "failed" - cellsize_item.skip = True else: output_item.file = job.results["image"] output_item.skip = False - # Reuse the mapfile structure to return structured information - # This is temporary code: It should be send within the casa/ - # hd5f image. - cellsize_item.file = job.results["cellsize"] - cellsize_item.skip = False # Check if there are finished runs succesfull_runs = None @@ -184,15 +163,10 @@ class imager_awimager(BaseRecipe, RemoteCommandRecipeMixIn): self.logger.error("Failed awimager node run detected. continue with" "successful tasks.") - # store the datamapfile to file # TODO: remove this ugly hack 5201 self._store_data_map(self.inputs['mapfile'], output_map, "mapfile containing produces awimages") - self._store_data_map(self.inputs['cellsize_mapfile'], cellsize_map, - "mapfile containing cellsize of produces awimages") self.outputs["mapfile"] = self.inputs['mapfile'] - # TODO: remove this ugly hack 5201 - self.outputs["cellsize_mapfile"] = self.inputs['cellsize_mapfile'] return 0 diff --git a/CEP/Pipeline/recipes/sip/nodes/imager_awimager.py b/CEP/Pipeline/recipes/sip/nodes/imager_awimager.py index 97c024e0e2f8bf450810fce4b04fa0f7dd265166..d479ce34b6e773593cb28d05d6aec8859fa15812 100644 --- a/CEP/Pipeline/recipes/sip/nodes/imager_awimager.py +++ b/CEP/Pipeline/recipes/sip/nodes/imager_awimager.py @@ -54,8 +54,6 @@ class imager_awimager(LOFARnodeTCP): :param autogenerate_parameters: Turns on the autogeneration of: cellsize, npix, wprojplanes, wmax :rtype: self.outputs["image"] The path to the output image - :rtype: self.outputs["cellsize"] The cellsize (supplied or calculated) - of the produced image # TODO: remove this ugly hack 5201 """ self.logger.info("Start imager_awimager node run:") log4_cplus_name = "imager_awimager" @@ -155,7 +153,6 @@ class imager_awimager(LOFARnodeTCP): # The actual output image has this extention always, default of # awimager self.outputs["image"] = output_image + ".restored" - self.outputs["cellsize"] = cell_size # TODO: remove this ugly hack 5201 return 0 def _calc_par_from_measurement(self, measurement_set, parset): diff --git a/CEP/Pipeline/visual_studio/Pipeline.v12.suo b/CEP/Pipeline/visual_studio/Pipeline.v12.suo index c872e0ed3cfd6de651b6caa10024800b93ed4bdb..375d48db49fd56249d8906822f2b205ac4e3a83d 100644 Binary files a/CEP/Pipeline/visual_studio/Pipeline.v12.suo and b/CEP/Pipeline/visual_studio/Pipeline.v12.suo differ