def json_properties(self): if self.phase == None or not self.save_links: retval = Storable.json_properties(self) for prop in self.Meta.all_properties: if getattr(prop, "inherit_flag", False): retval[prop.inherit_flag] = False else: retval = Storable.json_properties(self) retval["linked_with_uuid"] = self.linked_with.uuid if self.linked_with is not None else "" return retval
def json_properties(self): if self.phase == None or not self.save_links: retval = Storable.json_properties(self) for prop in self.Meta.all_properties: if prop.inh_name: retval[prop.inh_name] = False else: retval = Storable.json_properties(self) retval["linked_with_uuid"] = self.linked_with.uuid if self.linked_with is not None else "" return retval
def json_properties(self): if self.phase == None or not self.save_links: retval = Storable.json_properties(self) for prop in self.Meta.all_properties: if getattr(prop, "inherit_flag", False): retval[prop.inherit_flag] = False else: retval = Storable.json_properties(self) retval[ "linked_with_uuid"] = self.linked_with.uuid if self.linked_with is not None else "" return retval
def json_properties(self): if self.phase == None or not self.save_links: retval = Storable.json_properties(self) for prop in self.Meta.all_properties: if prop.inh_name: retval[prop.inh_name] = False else: retval = Storable.json_properties(self) retval[ "linked_with_uuid"] = self.linked_with.uuid if self.linked_with is not None else "" return retval
def json_properties(self): retval = Storable.json_properties(self) retval["atom_contents"] = list([[ atom_contents.atom.uuid if atom_contents.atom else None, atom_contents.prop, atom_contents.amount ] for atom_contents in retval["atom_contents"]]) return retval
def json_properties(self): retval = Storable.json_properties(self) retval["atom_contents"] = list([ [ atom_contents.atom.uuid if atom_contents.atom else None, atom_contents.prop, atom_contents.amount ] for atom_contents in retval["atom_contents"] ]) return retval
def json_properties(self): retval = Storable.json_properties(self) if not self.save_links: for prop in self.Meta.all_properties: if prop.inh_name: retval[prop.inh_name] = False retval["based_on_uuid"] = "" else: retval["based_on_uuid"] = self.based_on.uuid if self.based_on else "" return retval
def json_properties(self): retval = Storable.json_properties(self) if retval["prop"]: # Try to replace objects with their uuid's: try: retval["prop"] = [getattr(retval["prop"][0], 'uuid', retval["prop"][0]), retval["prop"][1]] except: logger.exception("Error when trying to interpret UCP JSON properties") pass # ignore return retval
def json_properties(self): retval = Storable.json_properties(self) retval["atom1"] = [ retval["atom1"][0].uuid if retval["atom1"][0] else None, retval["atom1"][1] ] retval["atom2"] = [ retval["atom2"][0].uuid if retval["atom2"][0] else None, retval["atom2"][1] ] return retval
def save_object(self, export=False, **kwargs): for component in self.components: component.export_atom_types = export component.save_links = not export self.save_links = not export retval = Storable.save_object(self, **kwargs) self.save_links = True for component in self.components: component.export_atom_types = False component.save_links = True return retval
def json_properties(self): self.refiner.update_refinement_treestore() retval = Storable.json_properties(self) retval["phase_uuids"] = [[item.uuid if item else "" for item in row] for row in map(list, self.phase_matrix)] retval["specimen_uuids"] = [specimen.uuid if specimen else "" for specimen in self.specimens] retval["phases"] = self.phases retval["fractions"] = self.fractions.tolist() retval["bgshifts"] = self.bgshifts.tolist() retval["scales"] = self.scales.tolist() return retval
def json_properties(self): self.refinement.update_refinement_treestore() retval = Storable.json_properties(self) retval["phase_uuids"] = [[item.uuid if item else "" for item in row] for row in map(list, self.phase_matrix)] retval["specimen_uuids"] = [specimen.uuid if specimen else "" for specimen in self.specimens] retval["phases"] = self.phases retval["fractions"] = self.fractions.tolist() retval["bgshifts"] = self.bgshifts.tolist() retval["scales"] = self.scales.tolist() return retval
def json_properties(self): retval = Storable.json_properties(self) if retval["prop"]: # Try to replace objects with their uuid's: try: retval["prop"] = [ getattr(retval["prop"][0], 'uuid', retval["prop"][0]), retval["prop"][1] ] except any: logger.exception( "Error when trying to interpret UCP JSON properties") pass # ignore return retval
def json_properties(self): retval = Storable.json_properties(self) retval["atom1"] = [retval["atom1"][0].uuid if retval["atom1"][0] else None, retval["atom1"][1]] retval["atom2"] = [retval["atom2"][0].uuid if retval["atom2"][0] else None, retval["atom2"][1]] return retval
def save_object(self, file): # @ReservedAssignment Storable.save_object(self, file, zipped=True) type(self).object_pool.change_all_uuids() self.needs_saving = False
def json_properties(self): props = Storable.json_properties(self) props[ "wavelength_distribution"] = self.wavelength_distribution._serialize_data( ) return props
def json_properties(self): props = Storable.json_properties(self) props["wavelength_distribution"] = self.wavelength_distribution._serialize_data() return props
def load_object(cls, filename, data=None, parent=None): type(cls).object_pool.change_all_uuids() return Storable.load_object(filename, data=data, parent=parent)
def json_properties(self): props = Storable.json_properties(self) props["exclusion_ranges"] = self.exclusion_ranges._serialize_data() return props