def pre_process(self): b = Ptycho.load_run(self.parameters['ptyr_file'],False) # load in the run but without the data p = b.p existing_scan = copy(p.scans[p.scans.keys()[0]]) p.scans.savu = existing_scan p.scans.savu.data.source = 'savu' p.scans.savu.data.recipe = u.Param() p.scan.illumination = b.probe.storages['S00G00'].data self.p = p
def setup(self): in_datasets, out_datasets = self.get_datasets() self.in_shape = in_datasets[0].get_shape() in_pData, __out_pData = self.get_plugin_datasets() in_pData[0].plugin_data_setup('PROJECTION', self.get_max_frames()) self.in_slice_dirs= np.array(in_pData[0].get_slice_directions()) self.in_core_dirs= np.sort(np.array(in_pData[0].get_core_directions()))# sort them to get in the right order self.b = Ptycho.load_run(self.parameters['ptyr_file'],False) self.p = self.b.p BasePtycho.setup(self)
def pre_process(self): b = Ptycho.load_run(self.parameters['ptyr_file'], False) # load in the run but without the data p = b.p existing_scan = copy(p.scans[p.scans.keys()[0]]) del p.scans[p.scans.keys()[0]] p.scans.savu = existing_scan p.scans.savu.data.source = 'savu' p.scans.savu.data.recipe = u.Param() if self.parameters['mask_file'] is not None: p.scans.savu.data.recipe.mask = h5.File(self.parameters['mask_file'],'r')[self.parameters['mask_entry']][...] else: p.scans.savu.data.recipe.mask = np.ones(self.in_shape[-2:]) p.scan.illumination = b.probe.storages['S00G00'].data self.p = p
def paramtree_from_json(json_file): ''' generates a ptypy param tree from a json file :param json_file: the path the json file :return: a Param based structure. ''' in_dict = json.load(open(json_file)) #, object_hook=byteify) parameters_to_run = u.Param() if in_dict['base_file'] is not None: logging.debug("Basing this scan off of the scan in {}".format( in_dict['base_file'])) previous_scan = Ptycho.load_run( in_dict['base_file'], False) # load in the run but without the data previous_parameters = previous_scan.p parameters_to_run.update(previous_parameters) if in_dict['parameter_tree'] is not None: parameters_to_run.update(in_dict['parameter_tree'], Convert=True) return parameters_to_run