def test_initialize(self): temp_dir = tempfile.mkdtemp() try: theargs = self._get_valid_args_for_constructor() subdir = os.path.join(temp_dir, 'foo') theargs.outputdirectory = subdir theargs.numrotations = '' theargs.rotationangles = '45,90,135' ts = TiltSeriesCreator(theargs) ts.initialize() self.assertTrue(os.path.isdir(subdir)) self.assertTrue(os.getcwd().endswith('foo')) self.assertEqual(ts._rotationangles, [0.0, 45.0, 90.0, 135.0]) finally: shutil.rmtree(temp_dir)
def test_get_methods(self): temp_dir = tempfile.mkdtemp() try: theargs = self._get_valid_args_for_constructor() subdir = os.path.join(temp_dir, 'foo') theargs.outputdirectory = subdir theargs.numrotations = '4' ts = TiltSeriesCreator(theargs) ts._workdir = temp_dir self.assertEqual(ts._get_warpz_dir(), os.path.join(temp_dir, TiltSeriesCreator.WARPZ_DIR_NAME)) self.assertEqual(ts._get_marker_dir(), os.path.join(temp_dir, TiltSeriesCreator.MARKER_DIR_NAME)) self.assertEqual(ts._get_projection_dir(), os.path.join(temp_dir, TiltSeriesCreator. PROJECTION_DIR_NAME)) self.assertEqual(ts._get_tracking_dir(), os.path.join(temp_dir, TiltSeriesCreator.TRACKING_DIR_NAME)) self.assertEqual(ts._get_result_dir(), os.path.join(subdir, TiltSeriesCreator.RESULT_DIR_NAME)) finally: shutil.rmtree(temp_dir)
def create_tiltseries(theargs): """Rotates 3DMarkers.txt file """ logger.info('Creating tilt series') if theargs.cores is None: try: cpucount = multiprocessing.cpu_count() except NotImplementedError: logger.exception('Unable to obtain cpu count from ' 'multiprocessing.cpu_count() defaulting to 1') cpucount = 1 theargs.cores = cpucount logger.debug('Cores to use set to ' + str(theargs.cores)) ts = TiltSeriesCreator(theargs) ts.initialize() ts.prepare_mrc_for_tiltseries_generation() ts.create_tiltseries()