'Align and weight projections, save them and reconstruct tomogram (optional). \n\
                                      See http://pytom.org/doc/pytom/reconstructTomograms.html for documentation.',
        authors='Gijs van der Schot',
        options=options)

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        tiltSeriesName, tiltSeriesFormat, firstProj, lastProj, \
        tltFile, prexgFile, preBin, referenceIndex, markerFileName, referenceMarkerIndex, expectedRotationAngle, handflip, \
        projectionTargets, fineAlignFile, projBinning, lowpassFilter, \
        volumeName, filetype, \
        tomogramSizeX, tomogramSizeY, tomogramSizeZ, \
        reconstructionCenterX, reconstructionCenterY, reconstructionCenterZ, \
        numberProcesses, weightingType, projIndices, verbose, help = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(sys.version_info)
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()
    # input parameters
    #tiltSeriesName = tiltSeriesPath + tiltSeriesPrefix  # "../projections/tomo01_sorted" # ending is supposed to be tiltSeriesName_index.em (or mrc)
    if not tiltSeriesFormat:
        tiltSeriesFormat = 'em'
    if firstProj:
        firstProj = int(firstProj)  # 1 # index of first projection
    else:
Esempio n. 2
0
        options=[
            ScriptOption('-p', 'Projection prefix.', True, False),
            ScriptOption('-a', 'Projection suffix.', True, False),
            ScriptOption('-w', 'Apply weighting to the projections or not',
                         False, True),
            ScriptOption('-f', 'Projection start index (int).', True, False),
            ScriptOption('-t', 'Projection end index (int).', True, False),
            ScriptOption('-s', 'Volume size.', True, False),
            ScriptOption('-o', 'Output filename.', True, False),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        prefix, suffix, weighting, start_idx, end_idx, vol_size, output, b_help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if b_help is True:
        print(helper)
        sys.exit()

    # parse the argument
    start_idx = int(start_idx)
    end_idx = int(end_idx)
    vol_size = [int(i) for i in vol_size.split(",")]

    from pytom.reconstruction.reconstructionStructures import Projection, ProjectionList
    projections = ProjectionList()
    for i in range(start_idx, end_idx + 1):
Esempio n. 3
0
                         arg=True,
                         optional=False),
            ScriptOption(['-j', '--jobName'],
                         'Specify job.xml filename',
                         arg=True,
                         optional=False),
            ScriptOption(['-h', '--help'], 'Help.', arg=False, optional=True)
        ])

    if len(sys.argv) <= 2:
        print(helper)
        sys.exit()
    try:
        particleList, mask, numberClasses, endThreshold,wedge1,wedge2,symmetryN,symmetryAxisZ,symmetryAxisX,\
        lowestFrequency,highestFrequency,destination,numberIterations,binning,\
        pixelSize,diameter,jobName,help = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if not checkFileExists(particleList):
        raise RuntimeError('ParticleList file ' + particleList +
                           ' does not exist!')

    if not checkFileExists(mask):
        raise RuntimeError('Mask file ' + mask + ' does not exist!')
Esempio n. 4
0
                         'Number of bins of histogram. Default is 10.', True,
                         True),
            ScriptOption(['-p', '--gaussianPeak'],
                         'The correspondent index of the gaussian peak.', True,
                         False),
            ScriptOption(['-c', '--numberParticles'],
                         'Number of particles up to CCC value.', True, True),
            ScriptOption(['-i', '--imageFile'], 'Save plot to a image file.',
                         True, True),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])
    if len(sys.argv) == 1:
        print helper
        sys.exit()
    try:
        pl_filename, num_steps, peak_index, ccc_value, imageFile, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print e
        sys.exit()
    if help is True:
        print helper
        sys.exit()

    # process the arguments
    num_steps = int(num_steps)
    if not num_steps:
        num_steps = 10

    peak_index = int(peak_index)

    scores = []
Esempio n. 5
0
    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description=
        'Create a folder with specific folder structure, as used by the GUI.',
        authors='GvdS',
        options=[
            ScriptOption(['-d'], 'Name of Folder.', True, False),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        dir_name, bHelp = parse_script_options(sys.argv[1:], helper)
    except:
        print(helper)
        sys.exit()

    if bHelp == True:
        print(helper)
        sys.exit()

    if os.path.exists(dir_name):
        raise Exception(
            'Folder already exists. Please give non-existent foldername.')

    create_project_filestructure(dir_name)
Esempio n. 6
0
        'Create a particle list from the EM files in a directory. Documentation is available at\n\
                          http://www.pytom.org/doc/pytom/genParticleList.html',
        authors='Yuxiang Chen',
        options=[
            ScriptOption(['-d'], 'Directory', True, False),
            ScriptOption(['-p'], 'Particle name prefix', True, True),
            ScriptOption(['-w'], 'Wedge Angle (degree)', True, False),
            ScriptOption(['-o'], 'Output particle list', True, False),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        dir_name, name_prefix, wedge_angle, output, bHelp = parse_script_options(
            sys.argv[1:], helper)
    except:
        sys.exit()
    if bHelp is True:
        print(helper)
        sys.exit()

    if name_prefix is None:
        name_prefix = ''
    wedge_angle = float(wedge_angle)
    w = SingleTiltWedge(wedge_angle)

    pl = ParticleList()
    all_files = os.listdir(dir_name)
    for fname in all_files:
        p = None
Esempio n. 7
0
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    #num_procs=20, num_procs_per_proc=1, tiltseriesname='sorted/sorted_aligned',
    #markerfile='sorted/markerfile.em',targets='alignment', firstindex=1, lastindex=21, refindex=11, weightingtype=0, deploy=False
    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],
        description='BATCHSUBMISSION TILT ALIGNMENT: submits  \n',
        authors='Gijs van der Schot',
        options=options)

    if len(sys.argv) == 1:
        print helper
        sys.exit()

    fnames_tomograms, projectfolder, numTomograms, num_procs, procPerTomo, tiltSeriesName, firstIndex, lastIndex, referenceIndex, markerFileName, projectionTargets, weightingType, deploy, help = parse_script_options(
        sys.argv[1:], helper)

    if not projectfolder:
        projectfolder = '/home/gijsvds/ost_2/03_Tomographic_Reconstruction'
    if not fnames_tomograms:
        tomonames = sorted([
            t for t in os.listdir(projectfolder) if len(t.split('_')[-1]) == 3
        ])
        fnames_tomograms = '{}/names_tomograms.txt'.format(projectfolder)
        out = open(fnames_tomograms, 'w')
        for i in tomonames:
            out.write(i + '\n')
        out.close()
        numTomograms = len(tomonames)
    if not num_procs: num_procs = 20
    if not procPerTomo: procPerTomo = 1
Esempio n. 8
0
    from pytom.tools.script_helper import ScriptHelper, ScriptOption
    from pytom.tools.parse_script_options import parse_script_options

    options = [
        ScriptOption(['-p', '--particleList'], 'Particle List', True, False),
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description=
        'Convert particle list to n particle list based on tomoname.',
        authors='Gijs van der Schot',
        options=options)
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        plName, help = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    if not os.path.exists(plName):
        sys.exit()

    extractParticleListsByTomoNameFromXML(plName)
Esempio n. 9
0
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name             
        description=
        'Extract tilt images from mrcstack, and creation of meta data file.',
        authors='Gijs van der Schot',
        options=options)

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        filename, outname, num_cycles, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if os.path.exists(filename):
        data = read(filename)
    else:
        print(helper)
        sys.exit()

    if num_cycles is None:
Esempio n. 10
0
        authors='Yuxiang Chen',
        options=[
            ScriptOption(
                '-d',
                'Unbinned projection directory. Note the projections should be aligned but not weighted!',
                True, False),
            ScriptOption('-o', 'Output filename.', True, False),
            ScriptOption('-i', 'Number of iterations to run.', True, True),
            ScriptOption('-m', 'Meta file including tiltangles.', True, True),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        proj_dir, output_filename, iter, metafile, b_help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if b_help is True:
        print(helper)
        sys.exit()

    # parse the arguments
    if not iter:
        iter = 10
    else:
        iter = int(iter)

    if metafile and os.path.exists(metafile):
        metadata = loadstar(metafile, dtype=datatype)
Esempio n. 11
0
        ScriptOption(['-b', '--binningFactor'],
                     'Binning Factor for reconstruction.', True, False),
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description=
        'Convert particle list to n particle list based on tomoname.',
        authors='Gijs van der Schot',
        options=options)
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        plName, logfile, binningFactor, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if not binningFactor:
        binningFactor = 8
    else:
        try:
            binningFactor = int(binningFactor)
        except:
            print('Invalid binningFactor. Exit.')
Esempio n. 12
0
                         'Binning factor of the particle list.', True, True),
            ScriptOption(['-g', '--gpuID'], 'Which gpu do you want to use?',
                         True, True),
            ScriptOption(['-m', '--metaFile'],
                         'Metafile containing tiltangles.', True, True),
            ScriptOption(['-a', '--alignmentResultsFile'],
                         'Alignment ResultsFile', True, True),
            ScriptOption([
                '-s', '--sizeReconstruction'
            ], 'Size Reconstruction in pixels. Three numbers separated by a comma.',
                         True, True),
            ScriptOption(['-v', '--verbose'], 'print intermediate output',
                         False, True)
        ])
    try:
        proj_dir, outdir, coordinateBinning, gpu, metafile, alignmentfile, size, verbose = ll = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        print(helper)
        sys.exit()

    coordinateBinning = int(coordinateBinning) if coordinateBinning else 1
    metadata = loadstar(metafile, dtype=DATATYPE_METAFILE)
    tilt_angles = metadata['TiltAngle']
    size = [464, 464, 464] if size is None else list(map(int, size.split(',')))
    patches = xp.zeros((size[0], size[1], len(tilt_angles)), dtype=xp.float32)

    images = []

    tt = time()
Esempio n. 13
0
                         optional=False),
            ScriptOption(['-c', '--cubeSize'],
                         'Cube size along each dimension.',
                         arg=True,
                         optional=False),
            ScriptOption(['--help'],
                         'Print this help.',
                         arg=False,
                         optional=True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        volFilename, plFilename, cubeSize, help = parse_script_options(
            sys.argv[1:], helper)
    except:
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    cubeSize = int(cubeSize)

    particleList = ParticleList()
    try:
        particleList.fromXMLFile(plFilename)
    except:
        from pytom.localization.structures import readParticleFile
        particles = readParticleFile(plFilename)
Esempio n. 14
0
         ScriptOption(['-o', '--outputParticleList'],
                      'classified Particle List.', True, True),
         ScriptOption(['-c', '--ccc'], 'constrained correlation matrix.',
                      True, True),
         ScriptOption(['-e', '--neig'], 'number of eigenvectors.', True,
                      True),
         ScriptOption(['-n', '--nclass'], 'number of classes.', True, True),
         ScriptOption(['-a', '--average'], 'name for class averages.', True,
                      True),
         ScriptOption(['-h', '--help'], 'Help.', False, True)
     ])
 if len(sys.argv) == 1:
     print(helper)
     sys.exit()
 try:
     pl, cpl, ccc, neig, nclass, cName, help = parse_script_options(
         sys.argv[1:], helper)
 except Exception:
     sys.exit()
 if help is True:
     print(helper)
     sys.exit()
 neig = int(neig)
 nclass = int(nclass)
 if not cName:
     cName = 'class'
 doClassification(pl=pl,
                  cpl=cpl,
                  ccc=ccc,
                  neig=neig,
                  nclass=nclass,
                  cName=cName)
Esempio n. 15
0
                     False, True),
        ScriptOption(['-n', '--normalize'],
                     'Normalize average. False by default.', False, True),
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description='Convert coordinate list to particle list.',
        authors='Friedrich Foerster',
        options=options)
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        plName, outname, cores, weighting, verbose, showProgressBar, createInfoVol, norm, help = dd = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    try:
        cores = int(cores)
    except:
        cores = 1

    if not os.path.exists(plName):
        print('Please provide an existing particle list')
Esempio n. 16
0
            ScriptOption(['-o', '--outputVolumePath'],
                         'Path to output volume ',
                         arg=True,
                         optional=False),
            ScriptOption(['-i', '--invertDensity'],
                         'Set if density should be negative',
                         arg=False,
                         optional=False),
            ScriptOption(['-h', '--help'], 'Help.', arg=False, optional=True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        mmCIF, chain, pixelSize, cubeSize, volumePath, densityNegative, helpme = parse_script_options(
            sys.argv[1:], helper)
    except:
        sys.exit()

    if helpme is True:
        print(helper)
        sys.exit()
        pass

    volume = mmCIF2em(mmCIF,
                      float(pixelSize),
                      int(cubeSize),
                      chain=chain,
                      densityNegative=densityNegative)

    volume.write(volumePath)
                       description='Calculate the correlation matrix, given the aligned particle list. The result will be written to the disk named correlation_matrix.csv.',
                       authors='Yuxiang Chen',
                       options= [ScriptOption(['-p'], 'Aligned particle list file.', True, False),
                                 ScriptOption(['-m'], 'Mask.', True, False),
                                 ScriptOption(['-f'], 'Frequency (after binning).', True, False),
                                 ScriptOption(['-b'], 'Binning factor.', True, True),
                                 ScriptOption(['-v'], 'Verbose mode.', False, True),
                                 ScriptOption(['-o'], 'Output directory.', True, True),
                                 ScriptOption(['--help'], 'Help info.', False, True)])
 
 if len(sys.argv) == 1:
     print(helper)
     sys.exit()
 
 try:
     pl_filename, mask_filename, freq, binning, verbose, outdir, help = parse_script_options(sys.argv[1:], helper)
 except Exception as e:
     print(e)
     sys.exit()
 
 if help is True:
     print(helper)
     sys.exit()
 
 if verbose:
     from pytom.tools.timing import Timing
     t = Timing()
     t.start()
 
 # construct the job
 freq = int(freq)
Esempio n. 18
0
                '-g', '--createGraphics'
            ], 'Flag to turn on to create graphical reports of intermediate steps of '
                         'the particle polishing', False, True),
            ScriptOption(
                ['-n', '--numberOfParticles'],
                'To take a subset of the particlelist for debugging purposes',
                True, True),
            ScriptOption(['--metaFile'], 'Metafile containing tiltangles.',
                         True, True),
            ScriptOption(['-v', '--verbose'], 'print intermediate output',
                         False, True)
        ])

    try:
        particleList, proj_dir, template, outdir, fsc_path, coordinateBinning, recOffset, max_shift, \
        create_graphics, number_of_particles, metafile, verbose = ll = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(e)
        print(helper)
        sys.exit()

    print(ll)
    vol_size = read_size(template, 'x')
    if vol_size % 2 != 0:
        raise ValueError("The particle size has to be an even number.")

    coordinateBinning = int(coordinateBinning) if coordinateBinning else 1
    recOffset = list(map(int,
                         recOffset.split(','))) if recOffset else [0, 0, 0]
    max_shift = int(max_shift) if max_shift else 6
    create_graphics = True if create_graphics else False
Esempio n. 19
0
        sys.argv[0].split('/')[-1],  # script name
        description=
        'Select the particle list for alignment according to the class list.',
        authors='Yuxiang Chen',
        options=[
            ScriptOption('-p', 'Particle list.', True, False),
            ScriptOption('-c', 'Class label file.', True, False),
            ScriptOption('-o', 'Output particle list.', True, False),
            ScriptOption('-t', 'True positive class.', True, True),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        pl_filename, class_label_filename, output, tp_label, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    if tp_label is None:
        tp_label = 1
    else:
        tp_label = int(tp_label)

    from pytom.basic.structures import ParticleList
    pl = ParticleList(".")
    pl.fromXMLFile(pl_filename)
Esempio n. 20
0
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description=
        'Extract tilt images from mrcstack, and creation of meta data file.',
        authors='Gijs van der Schot',
        options=options)

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        filename, outname, numSTD, smooth, num_cycles, mask, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if os.path.exists(filename):
        data = read(filename)
    else:
        print(helper)
        sys.exit()

    num_cycles = 2 if num_cycles is None else int(num_cycles)
Esempio n. 21
0
                ['--scale'],
                'Scale coordinates by a factor. Set > 1 to adjust to larger volumes. Use 2 if the localization tomo was 1x binned.',
                arg=True,
                optional=True),
            ScriptOption(['--help'],
                         'Print this help.',
                         arg=False,
                         optional=True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        jobFilename, maskFile, resultFilename, orientFilename, maxNumParticle, sizeParticle, plFilename, particlePath, minScore, motlFilename, margin, write2disk, scale, help = parse_script_options(
            sys.argv[1:], helper)
    except:
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    if minScore == None:
        minScore = -1
    else:
        minScore = float(minScore)
    if write2disk == None:
        write2disk = 0
    if margin.__class__ == str:
        margin = int(margin)
    if particlePath is None:
Esempio n. 22
0
                                   ScriptOption(['--particleDiameter'], 'Particle diameter in Angstrom', arg=True,
                                                optional=False),
                                   ScriptOption(['-w', '--weighting'], 'Weight particles by exp of CC', arg=False,
                                                optional=True),
                                   ScriptOption(['-c', '--compound'], 'Use compound weighting in Fourier space',
                                                arg=False, optional=True),
                                   ScriptOption(['-j','--jobName'], 'Specify job.xml output filename', arg=True,
                                                optional=False),

                                   ScriptOption(['-h', '--help'], 'Help.', arg=False, optional=True)])
    
    if len(sys.argv) <= 2:
        print(helper)
        sys.exit()
    try:
        results = parse_script_options(sys.argv[1:], helper)
        particleList, reference, mask, isSphere, angShells, angleInc, scoreObject, \
        symmetryN, symmetryAxisZ, symmetryAxisX,\
        destination, numberIterations, binning,\
        pixelSize, diameter, weighting, compound, jobName, help = results
    except Exception as e:
        print(e)
        sys.exit()
        
    if help is True:
        print(helper)
        sys.exit()

    from pytom.alignment.GLocalSampling import GLocalSamplingJob, mainAlignmentLoop
    from pytom.basic.structures import ParticleList, Reference, Mask, SampleInformation, PointSymmetry
    from pytom.score.score import FLCFScore, nxcfScore
Esempio n. 23
0
        'Align and weight projections, save them and reconstruct tomogram (optional). \n\
                                      See http://pytom.org/doc/pytom/reconstructTomograms.html for documentation.',
        authors='Friedrich Foerster',
        options=options)

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        tiltSeriesName, tiltSeriesFormat, firstProj, lastProj, projIndices,\
        tltFile, prexgFile, preBin, referenceIndex, markerFileName, alignResultFile, referenceMarkerIndex, expectedRotationAngle, \
        projectionTargets, fineAlignFile, projBinning, lowpassFilter, \
        volumeName, filetype, \
        tomogramSizeX, tomogramSizeY, tomogramSizeZ, \
        reconstructionCenterX, reconstructionCenterY, reconstructionCenterZ, \
        weightingType, noOutputImages, verbose, help = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(sys.version_info)
        print(e)
        print()
        print(helper)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if (markerFileName is None) and (alignResultFile is None):
        raise Exception(
            'Please provide either a markerfile or an alignmentResults.txt file'
        )
Esempio n. 24
0
    options = [ScriptOption(['-f','--FCSFile'], 'File with FSC values in single column', True, False),
               ScriptOption(['-b','--boxSize'], 'Box size of average', True, False),
               ScriptOption(['-p','--pixelSize'],'Pixel size of voxels in model.',True, False),
               ScriptOption(['-o','--outputName'],'Save figure under this name.',True, True),
               ScriptOption(['-s','--show'],'Show figure.',False, True),
               ScriptOption(['-c','--FSCCutoff'],'Cut-off used to determine the resolution of your object from the FSC curve. Typical values are 0.5 or 0.143.', True, False),
               ScriptOption(['-h', '--help'], 'Help.', False, True)]


    helper = ScriptHelper(sys.argv[0].split('/')[-1], description='Convert coordinate list to particle list.',
                          authors='Gijs van der Schot', options=options)
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        FSCFile, boxsize, pixelsize, outname, show_image, cutoff, help = parse_script_options(sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if not boxsize: boxsize=0

    if not os.path.exists(FSCFile):
        print('FSC File does not exist')
        sys.exit()

    if not outname:
Esempio n. 25
0
                         'Print this help.',
                         arg=False,
                         optional=True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    particleList = None
    projectionDirectory = None
    aw = False

    try:
        tomogram, particleListXMLPath, prefix, logfile, projectionList, projectionDirectoryTemplate, aw, size, coordinateBinning, \
        recOffset, projBinning, metafile, numProcesses, help= parse_script_options(sys.argv[1:], helper)

    except Exception as e:
        print(e)
        sys.exit()

    if help:
        print(helper)
        sys.exit()

    size = [int(i) for i in size.split(",")]
    if len(size) == 1:
        tmp = size[0]
        size.append(tmp)
        size.append(tmp)
Esempio n. 26
0
                     True, True),
        ScriptOption(['-h', '--help'], 'Help.', False, True)
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description='Update paramters in a particle list.',
        authors='Gijs van der Schot',
        options=options)

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        outname, XMLfnames, suffix, prefix, wedgeangles, rotate, shiftBin, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    fnames = []

    if wedgeangles:
        wedgeangles = wedgeangles.split(',')
        if len(wedgeangles) % 2:
            wedgeangles = wedgeangles + [wedgeangles[-1]]
    else:
Esempio n. 27
0
        description='Convert em file to mrc.',
        authors='Thomas Hrabe',
        options=[
            ScriptOption(['-f', '--file'], 'Filename', True, True),
            ScriptOption(['-d', '--directory'], 'A directory of files.', True,
                         True),
            ScriptOption(['-t', '--targetPath'], 'Path to new file.', True,
                         True),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        filename, directory, target, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    if filename:
        #convert only one file
        em2mrc(filename, target)
    elif directory:
        import os

        fileList = os.listdir(directory)
        for file in fileList:
Esempio n. 28
0
    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],
        description='Subtomogram alignment by Fast Rotational Matching.',
        authors='Yuxiang Chen',
        options=[
            ScriptOption(['-j'], 'Job xml file.', True, False),
            ScriptOption(['-v'], 'Verbose mode.', False, True),
            ScriptOption(['--help'], 'Help info.', False, True)
        ])

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    if 1:
        job_filename, verbose, bHelp = parse_script_options(
            sys.argv[1:], helper)
    else:
        sys.exit()

    if bHelp is True:
        print(helper)
        sys.exit()

    # check the job
    job = FRMJob()
    job.fromXMLFile(job_filename)
    job.check()

    worker = FRMWorker()

    if verbose:
Esempio n. 29
0
    ]

    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name             
        description=
        'Extract tilt images from mrcstack, and creation of meta data file.',
        authors='Gijs van der Schot',
        options=options)
    # mpi.begin()

    if len(sys.argv) == 1:
        print(helper)
        sys.exit()

    try:
        filename, outdir, prefix, origdir, mdoc, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()

    if help is True:
        print(helper)
        sys.exit()

    if mdoc is None: mdoc = False
    else: mdoc = True

    if os.path.exists(filename):
        data = mrcfile.open(filename, permissive=True).data.copy()
        print(data.shape)
    else:
Esempio n. 30
0
    from pytom.tools.script_helper import ScriptHelper, ScriptOption
    from pytom.tools.parse_script_options import parse_script_options
    helper = ScriptHelper(
        sys.argv[0].split('/')[-1],  # script name
        description='Mirror the volume.',
        authors='Yuxiang Chen',
        options=[
            ScriptOption(['-v'], 'Input volume.', True, False),
            ScriptOption(['-o'], 'Output volume.', True, True),
            ScriptOption(['-h', '--help'], 'Help.', False, True)
        ])
    if len(sys.argv) == 1:
        print(helper)
        sys.exit()
    try:
        input_filename, output_filename, help = parse_script_options(
            sys.argv[1:], helper)
    except Exception as e:
        print(e)
        sys.exit()
    if help is True:
        print(helper)
        sys.exit()

    # process the arguments
    if output_filename is None:
        output_filename = input_filename.split('.')[0] + '_mirror.em'

    from pytom_volume import read, vol, mirrorVolume
    v = read(input_filename)
    res = vol(v)
    mirrorVolume(v, res)