Beispiel #1
0
                    #maglist.magnet_lists['VV'][vvswap][0]=buildlist[line,5]
                    maglist.swap('VV',maglist.magnet_lists['VV'].index([buildlist[line,5],1,0]) , vvswap)
                    maglist.magnet_lists['VV'][vvswap][1]=int(buildlist[line,4])
                    
                    vvswap+=1
            
            outfile = (os.path.split(filename)[1]+'.h5')
            #fg.output_fields(outfile, options.id_filename, options.id_template, options.magnets_filename, maglist)
            fp = open(os.path.split(filename)[1]+'.genome','w')
            pickle.dump(maglist, fp)
            fp.close()
            
        
        
    
    if options.readable:
        
        for filename in args[0::]:
            print("Making file %s human readable." % (filename))
            
            human_output(options.id_filename, filename)
        
    if options.analysis:
        for filename in args[0::]:
            print("Processing file %s" % (filename))
            # load the genome
            maglists = pickle.load( open( filename, "rb" ) )
            
            outfile = (os.path.split(filename)[1]+'.h5')
            fg.output_fields(outfile, options.id_filename, options.id_template, options.magnets_filename, maglists)
Beispiel #2
0
                mag_num=int(maglists.magnet_lists['VV'][vv][0])
                mag_flip=maglists.magnet_lists['VV'][vv][1]
                vv+=1
            
            if mag_type==2:
                mag_num=int(maglists.magnet_lists['HH'][hh][0])
                mag_flip=maglists.magnet_lists['HH'][hh][1]
                hh+=1
                
            if mag_type==3:
                mag_num=int(maglists.magnet_lists['VE'][ve][0])
                mag_flip=maglists.magnet_lists['VE'][ve][1]
                ve+=1
                
            if mag_type==4:
                mag_num=int(maglists.magnet_lists['HE'][he][0])
                mag_flip=maglists.magnet_lists['HE'][he][1]
                he+=1
            
            line= ("%5i %4i %4i %4i %4i %4i\n"%(b+1,a+1,mag_type,info['beams'][b]['mags'][a]['direction'][0],mag_flip, mag_num))
            f3.write(line)
            
            a+=1
            
        f3.write("\n")
    
    f3.close()
    
    fg.output_fields('/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/4.62409644e-07_000_00bc026cfae7.h5', '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/2015test.json', '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/2015test.h5', '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/magnets.mag', maglists)
    
Beispiel #3
0
    (options, args) = parser.parse_args()

    print("Loading magnets")
    mags = magnets.Magnets()
    mags.load(options.magnets_filename)

    if options.build:
        for filename in args[1::]:
            print("Processing file %s" % (filename))
            # load the genome
            genome = ID_BCell()
            genome.load(filename)

            outfile = os.path.join(args[0], os.path.split(filename)[1] + '.h5')
            fg.output_fields(outfile, options.id_filename,
                             options.lookup_filename, options.magnets_filename,
                             genome.genome)
        sys.exit(0)

    if options.setup > 0:
        print("Running setup")
        for i in range(options.setup):
            # create a fresh maglist
            maglist = magnets.MagLists(mags)
            maglist.shuffle_all()
            genome = ID_BCell(options.id_filename, options.lookup_filename,
                              options.magnets_filename)
            genome.create(maglist)
            genome.save(args[0])

    for filename in args[1::]:
                hh += 1

            if mag_type == 3:
                mag_num = int(maglists.magnet_lists['VE'][ve][0])
                mag_flip = maglists.magnet_lists['VE'][ve][1]
                ve += 1

            if mag_type == 4:
                mag_num = int(maglists.magnet_lists['HE'][he][0])
                mag_flip = maglists.magnet_lists['HE'][he][1]
                he += 1

            line = ("%5i %4i %4i %4i %4i %4i\n" %
                    (b + 1, a + 1, mag_type,
                     info['beams'][b]['mags'][a]['direction'][0], mag_flip,
                     mag_num))
            f3.write(line)

            a += 1

        f3.write("\n")

    f3.close()

    fg.output_fields(
        '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/4.62409644e-07_000_00bc026cfae7.h5',
        '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/2015test.json',
        '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/2015test.h5',
        '/home/gdy32713/DAWN_stable/optid/Opt-ID/IDSort/src/v2/magnets.mag',
        maglists)
Beispiel #5
0
    
    (options, args) = parser.parse_args()

    print("Loading magnets")
    mags = magnets.Magnets()
    mags.load(options.magnets_filename)

    if options.build:
        for filename in args[1::]:
            print("Processing file %s" % (filename))
            # load the genome
            genome = ID_BCell()
            genome.load(filename)
            
            outfile = os.path.join(args[0], os.path.split(filename)[1]+'.h5')
            fg.output_fields(outfile, options.id_filename, options.lookup_filename, 
                              options.magnets_filename, genome.genome);
        sys.exit(0)

    if options.setup > 0:
        print("Running setup")
        for i in range(options.setup):
            # create a fresh maglist
            maglist = magnets.MagLists(mags)
            maglist.shuffle_all()
            genome = ID_BCell(options.id_filename, options.lookup_filename, options.magnets_filename)
            genome.create(maglist)
            genome.save(args[0])
    
    for filename in args[1::]:
        print("Processing file %s" % (filename))
        
def process(options, args):
    if options.create_genome:
        for filename in args[0::]:
            print("Turning file %s from Human Readable to Genome" % (filename))

            f2 = open(filename, 'r')
            buildlist = np.genfromtxt(filename, dtype=str)
            f2.close()

            mags = magnets.Magnets()
            mags.load(options.magnets_filename)

            maglist = magnets.MagLists(mags)

            heswap = 0
            veswap = 0
            hhswap = 0
            vvswap = 0

            for line in range(buildlist.shape[0]):

                if int(buildlist[line, 2]) == 4:
                    #maglist.magnet_lists['HE'][heswap][0]=buildlist[line,5]
                    maglist.swap(
                        'HE', maglist.magnet_lists['HE'].index(
                            [buildlist[line, 5], 1, 0]), heswap)
                    maglist.magnet_lists['HE'][heswap][1] = int(buildlist[line,
                                                                          4])

                    heswap += 1

                elif int(buildlist[line, 2]) == 3:
                    #maglist.magnet_lists['VE'][veswap][0]=buildlist[line,5]
                    maglist.swap(
                        'VE', maglist.magnet_lists['VE'].index(
                            [buildlist[line, 5], 1, 0]), veswap)
                    maglist.magnet_lists['VE'][veswap][1] = int(buildlist[line,
                                                                          4])
                    veswap += 1

                elif int(buildlist[line, 2]) == 2:
                    #maglist.magnet_lists['HH'][hhswap][0]=buildlist[line,5]
                    maglist.swap(
                        'HH', maglist.magnet_lists['HH'].index(
                            [buildlist[line, 5], 1, 0]), hhswap)
                    maglist.magnet_lists['HH'][hhswap][1] = int(buildlist[line,
                                                                          4])

                    hhswap += 1

                elif int(buildlist[line, 2]) == 1:
                    #maglist.magnet_lists['VV'][vvswap][0]=buildlist[line,5]
                    maglist.swap(
                        'VV', maglist.magnet_lists['VV'].index(
                            [buildlist[line, 5], 1, 0]), vvswap)
                    maglist.magnet_lists['VV'][vvswap][1] = int(buildlist[line,
                                                                          4])

                    vvswap += 1

            outfile = (os.path.split(filename)[1] + '.h5')
            #fg.output_fields(outfile, options.id_filename, options.id_template, options.magnets_filename, maglist)
            fp = open(os.path.split(filename)[1] + '.genome', 'w')
            pickle.dump(maglist, fp)
            fp.close()

    if options.readable:

        for filename in args[0::]:
            print("Making file %s human readable." % (filename))

            human_output(options.id_filename, filename)

    if options.analysis:
        for filename in args[0::]:
            print("Processing file %s" % (filename))
            # load the genome
            maglists = pickle.load(open(filename, "rb"))

            outfile = (os.path.split(filename)[1] + '.h5')
            fg.output_fields(outfile, options.id_filename, options.id_template,
                             options.magnets_filename, maglists)