예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
파일: component.py 프로젝트: fbocches/PyXRD
 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
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
    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
예제 #12
0
파일: mixture.py 프로젝트: Python3pkg/PyXRD
    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
예제 #13
0
 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
예제 #14
0
 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
예제 #15
0
 def save_object(self, file): # @ReservedAssignment
     Storable.save_object(self, file, zipped=True)
     type(self).object_pool.change_all_uuids()
     self.needs_saving = False
예제 #16
0
 def json_properties(self):
     props = Storable.json_properties(self)
     props[
         "wavelength_distribution"] = self.wavelength_distribution._serialize_data(
         )
     return props
예제 #17
0
 def json_properties(self):
     props = Storable.json_properties(self)
     props["wavelength_distribution"] = self.wavelength_distribution._serialize_data()
     return props
예제 #18
0
 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)
예제 #19
0
 def json_properties(self):
     props = Storable.json_properties(self)
     props["exclusion_ranges"] = self.exclusion_ranges._serialize_data()
     return props
예제 #20
0
파일: base.py 프로젝트: fbocches/PyXRD
 def json_properties(self):
     props = Storable.json_properties(self)
     props["exclusion_ranges"] = self.exclusion_ranges._serialize_data()
     return props