08 lower growing resolution

import os
import topogenesis as tg
import pyvista as pv
import trimesh as tm
import numpy as np
import pickle
import csv
import pandas as pd
#This script is to reduce the 3_6 lattice to 7_2 in order to make the growing calculation possible
########################################################################################
#Import the complete 3_6 lattice and a 7_2 lattice for reference
lattice_path = os.path.relpath("data\lattice_complete_3_6.csv")
complete_lattice_3_6 = tg.lattice_from_csv(lattice_path)

lattice_path_1 = os.path.relpath("data\solar_envelope_7_2.csv")
reference_lattice_7_2 = tg.lattice_from_csv(lattice_path)
########################################################################################


########################################################################################
#Translate 3_6 to 7_2, any 7_2 voxel with at least one 3_6 in it will be placed
shape_3_6 = complete_lattice_3_6.shape
shape_7_2 = [int(x/2) for x in shape_3_6]
base_7_2 = np.zeros(shape_7_2, dtype=bool)
print(shape_7_2)
amount = 0
amount1 = 0
for i in range(shape_7_2[0]):
    for j in range(shape_7_2[1]):
        for k in range(shape_7_2[2]):
            temp_list=[]
            for l in range(0, 2):
                x = i*2+l
                for m in range(0,2):
                    y = j*2+m
                    for n in range(0,2):
                        z = k*2+n
                        amount1+=1
                        if complete_lattice_3_6[x][y][z] == True:
                            temp_list.append(1)
            if 1 in temp_list:
                base_7_2[i][j][k] = True
                amount += 1
########################################################################################
#Export the new growing lattice
lattice_7_2 = tg.to_lattice(base_7_2, reference_lattice_7_2)
csv_path_lattice = os.path.relpath("data\growing_lattice_7_2.csv")
lattice_7_2.to_csv(csv_path_lattice)
########################################################################################
print("done")
#This small script is translate predefined entrance locations to 
#the bigger voxel size in a flattened lattice
########################################################################################
#Establish entrance locations in coords
test_list = np.zeros(shape_7_2)
coords = [[11,0,0],[21,0,0],[0,0,0],[21,9,0],[21,5,0],[0,9,0],[11,9,0]]
for i in range(1, len(coords)+1):
    x = coords[i-1][0]
    y = coords[i-1][1]
    z = coords[i-1][2]
    test_list[x][y][z] = i

new_list = test_list.flatten()
temp_list = []
for i in range(len(new_list)):
    if new_list[i] != 0:
        temp_list.append([i, new_list[i]])
print(temp_list)
########################################################################################


Last update: January 25, 2021