Ejemplo n.º 1
0
    def inspect_lattice(self, project_id=str(), critical_concentration=None):

        info = dict()
        info = json.load(open(project_id, 'r'))

        lattice = Lattice()
        lattice.critical_concentration = int(1e5) * critical_concentration

        i = 0
        while True:
            if os.path.exists('Dataset/Lattices/' + project_id + '/' + str(i)):
                print(str(i))

                # loading state
                lattice.cells = Lattice.load(cells_only=True,
                                             project_id=project_id,
                                             simulation_number=i)

                # inspecting loaded state
                lattice.update_critical()

                lattice.sort_critical()
                lattice.update_maximal_distances(dimension=info['dimension'])

                i += 1

            else:
                break

        json.dump(
            lattice.maximal_distances,
            open(
                'Dataset/Maximal_distances/' + info['project_id'] + '/' +
                str(critical_concentration), 'w'))
Ejemplo n.º 2
0
    def inspect_lattice(self, critical_concentration):
        info = dict()
        info = json.load(open(str(self.id) + self.sub_id + 'info', 'r'))

        lattice = Lattice()
        lattice.critical_concentration = critical_concentration

        i = 0
        while True:
            if os.path.exists(self.id + self.sub_id + 'Lattices/' + str(i)):
                print(str(i))

                lattice.cells = Lattice.load(cells_only=True,
                                             project_id=self.id,
                                             sub_id=self.sub_id,
                                             simulation_number=i,
                                             implementation=True)

                lattice.update_critical()

                lattice.update_maximal_distances(dimension=info['dimension'],
                                                 check_area=False)

                i += 1

            else:
                break

        json.dump(
            lattice.maximal_distances['concentrated'],
            open(
                self.id + self.sub_id + 'Maximal_distances/' +
                str(critical_concentration) + 'n2', 'w'))