Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(args):
global image_quality
manager = timemory.manager()
algorithm = args.algorithm
if len(args.compare) > 0:
algorithm = "comparison"
print(("\nArguments:\n{} = {}\n{} = {}\n{} = {}\n{} = {}\n{} = {}\n"
"{} = {}\n{} = {}\n{} = {}\n{} = {}\n{} = {}\n").format(
"\tPhantom", args.phantom,
"\tAlgorithm", algorithm,
"\tSize", args.size,
"\tAngles", args.angles,
"\tFormat", args.format,
"\tScale", args.scale,
"\tcomparison", args.compare,
"\tnumber of cores", args.ncores,
"\tnumber of columns", args.ncol,
def exit_action(errcode):
man = timemory.manager()
timemory.report(ign_cutoff=True)
fname = 'signal_error_{}.out'.format(errcode)
f = open(fname, 'w')
f.write('{}\n'.format(man))
f.close()
def exit_action(errcode):
man = timemory.manager()
timemory.report(ign_cutoff=True)
fname = 'signal_error_{}.out'.format(errcode)
f = open(fname, 'w')
f.write('{}\n'.format(man))
f.close()
help="When used with '--subset', do no center subset",
action='store_true')
args = parser.parse_args()
print("\nargs: {}\n".format(args))
if args.output_dir is None:
fpath = os.path.basename(os.path.dirname(args.fname))
args.output_dir = os.path.join(fpath + "_output", args.algorithm)
if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)
args.output_dir = os.path.abspath(args.output_dir)
manager = timemory.manager()
# Set path to the micro-CT data to reconstruct.
fname = args.fname
rot_center = float(args.axis)
# Set default rotation axis location
if rot_center == 0:
data_size = get_dx_dims(fname, 'data')
rot_center = data_size[2]/2
nsino = float(args.nsino)
blocked_views = None
imgs = []
set_environ("TIMEMORY_SCIENTIFIC", 0)
set_environ("TIMEMORY_FILE_OUTPUT", 0)
#----------------------------------------------------------------------#
# parse arguments
#
args = handle_arguments()
#----------------------------------------------------------------------#
# import and setup
#
import timemory
import subprocess as sp
# grab a manager handle
timemory_manager = timemory.manager()
# rusage records child processes
timemory.set_rusage_children()
components = []
for c in ["wall_clock", "user_clock", "sys_clock", "cpu_clock", "cpu_util", "peak_rss",
"num_minor_page_faults", "num_major_page_faults",
"voluntary_context_switch", "priority_context_switch"]:
components.append(getattr(timemory.component, c))
# run the command
exe_name = "[pytimem]"
if len(sys.argv) > 1:
exe_name = "[{}]".format(sys.argv[1])
comp = timemory.component_tuple(components, "[]")