Commit a48ba7b2 authored by Jonathan Juhl's avatar Jonathan Juhl
Browse files

build directory add

parent e42bf350
from .main_sortem import main
from .Gui_sortem import run
\ No newline at end of file
from .main_sortem import main
#from .Gui_sortem import run
\ No newline at end of file
#!/usr/bin/env python3
from .main_sortem import main
from .Gui_sortem import run
\ No newline at end of file
#!/usr/bin/env python3
from .main_sortem import main
#from .Gui_sortem import run
\ No newline at end of file
#!/usr/bin/env python3
import argparse
from execute import control_flow
from execute_sortem import control_flow
def main()
def main():
parser = argparse.ArgumentParser(description='Run sortinator.')
parser.add_argument('--num_gpus',type=int,default = 1,
help='Number of GPUs to use.')
......@@ -49,7 +48,6 @@ def main()
else:
train_light = True
deep_NN_batch_size = args.ab
deep_NN_prediction_size = args.pb
epochs = args.epochs
output = args.o
half_precision = args.f16
......
from os.path import join,isdir,getsize,isfile
from os import mkdir,listdir
import tensorflow as tf
import numpy as np
from H_reader import HF_rader
class super_class:
def __init__(self,work_dir,batch_size,length,depth,num_cpus,num_gpus,precision):
if not isdir(work_dir):
mkdir(work_dir)
self.precision = precision
self.width = length
self.depth = depth
self.work_dir = work_dir
self.refined = join(work_dir,'refined')
self.unrefined = join(work_dir,'unrefined')
self.particle_stack_dir = join(work_dir,'particle_stack_dir')
self.models = join(work_dir,'models')
self.star_files = join(work_dir,'output_star_files')
self.prediction_data = join(work_dir,'prediction_data')
self.results = join(work_dir,'gui_display')
if not isdir(self.work_dir):
mkdir(self.work_dir)
if not isdir( self.particle_stack_dir ):
mkdir( self.particle_stack_dir )
if not isdir( self.unrefined ):
mkdir( self.unrefined )
if not isdir( self.refined):
mkdir( self.refined)
if not isdir(self.star_files ):
mkdir(self.star_files )
if not isdir(self.results ):
mkdir(self.results )
if not isdir(self.models):
mkdir(self.models)
if not isdir(self.prediction_data ):
mkdir(self.prediction_data)
if precision:
self.precision = np.float16
else:
self.precision = np.float32
self.num_gpus = num_gpus
self.num_cpus = num_cpus
self.batch_size = batch_size
def _bytes_feature(self,value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _int64_feature(self,value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def close(self):
self.record.close()
def serialize_original_example(self,ids,image):
feature = {
'id': self._int64_feature(ids),
'image': self._bytes_feature(image),
}
example_proto = tf.train.Example(features=tf.train.Features(feature=feature))
return example_proto.SerializeToString()
def write_tf_record(self,vector,ids,record):
example = self.serialize_original_example(ids,vector.flatten().tobytes())
record.write(example)
def check_dir(self,folder,substring):
wordlist = list(listdir(folder ))
combined = '\t'.join(wordlist)
if substring in combined:
return False
else:
return True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment