示例#1
0
def run(names):
    if not os.path.exists("src"):
        # os.system("mkdir src")
        generate.run()
        exit()

    if not len(names):
        names = input("please type fragments names : ").split(" ")

        if not len(names):
            exit()

    if not os.path.exists("src/fragments"):
        os.system("mkdir src/fragments")
        os.system("touch src/fragments/index.js")

    for name in names:
        if name == name.capitalize():
            lname = name.lower()
            print(lname)
            if not os.path.exists("src/fragments/%s" % lname):
                os.system("mkdir src/fragments/%s" % lname)
                os.system("mkdir src/fragments/%s/core" % lname)
                os.system("touch src/fragments/%s/core/index.js" % lname)
                os.system("touch src/fragments/%s/core/style.js" % lname)
                utils.add_import(name, "./%s" % lname,
                                 "src/fragments/%s/index.js" % lname)
                utils.add_import(name, "./%s" % lname,
                                 "src/fragments/index.js")
                fs = open("src/fragments/%s/%s.js" % (lname, lname), "w")
                fs.write(utils.create_component(name))
                fs.close()

    print("start")
    print(names)
示例#2
0
def run(args):
    if not os.path.exists("src"):
        # os.system("mkdir src")
        generate.run()
        exit()

    if not len(args):
        fn = input("please type parent fragment name : ").lower()
        if not os.path.exists("src/fragments/%s" % fn):
            exit()

    else:
        fn = args[0]

    if not len(args[1:]):
        names = input("please type core components names : ").split(" ")
        if not len(names):
            exit()
    else:
        names = args[1:]

    for name in names:
        if name == name.capitalize():
            lname = name.lower()

            utils.add_import(name, "./%s" % lname,
                             "src/fragments/%s/core/index.js" % fn)
            fs = open("src/fragments/%s/core/%s.js" % (fn, lname), "w")
            fs.write(utils.create_component(name))
            fs.close()
示例#3
0
	def generate(self, n, energy=None, height=None, Z=None):
		print time.asctime(time.localtime()),"Simulating", n, "Events."
		for i in range (n):
			xpos, ypos, epsilon, genergy, gZ, gheight, phi, N = g.run()
			
			if energy == None:
				simenergy = genergy
			if height == None:
				simheight = gheight
			if Z == None:
				simZ = gZ
				
			newsimulation = simulation(xpos, ypos, epsilon, simenergy, simZ, simheight, phi, N, self.layout)
			newsimulation.simulatedetection(self.raweff)
			if newsimulation.detected.DCmultiplicity < self.mincount:
				if newsimulation.detected.DCmultiplicity > 0:
					self.lmcount += 1
				else:
					self.nonDC += 1
			else:
				self.hmcount += 1
				intno = newsimulation.detected.DCmultiplicity - self.mincount
				if random.random() < self.highmultiplicityacceptance[intno]:
					self.passcount += 1
					self.simulations.append(newsimulation)
				
		print time.asctime(time.localtime()),"In total", self.nonDC, "Events did not produce Cherenkov Light." 
		print time.asctime(time.localtime()),"A further", self.lmcount, "Events produced Cherenkov Light below multiplicity Threshold." 
		print time.asctime(time.localtime()),"This leaves", self.hmcount, "high multiplicity events, of which", self.passcount, "were accepted."
def run(raweff,
        rowcount,
        mincount=4,
        text=False,
        graph=False,
        output="default",
        layout="five",
        number=1):
    with open(
            "/nfs/astrop/d6/rstein/Hamburg-Cosmic-Rays/positioning/output/" +
            output + ".csv", 'wb') as csvout:
        writer = csv.writer(csvout, delimiter=',', quotechar='|')
        writer.writerow([
            "Event Number", "Category", "Xpos", "Ypos", "Smeared DC Count",
            "Smeared Background Count", "True X", "True Y",
            "True Energy per Nucleon", "True Z", "True Height", "Phi",
            "Epsilon", "Trigger", "Dangle", "Theta", "Background"
        ])

        nonDC = 0
        belowThreshold = 0
        metThreshold = 0

        for i in range(0, int(number)):

            rayxpos, rayypos, epsilon, rayradius, Epn, Z, height, phi, theta = g.run(
            )

            frac = atm.runabsorption(height)

            eff = raweff * frac / math.sin(phi)

            entry, entrytype = lt.run(layout, rayxpos, rayypos, epsilon,
                                      rayradius, Epn, Z, height, phi, theta,
                                      mincount, eff, metThreshold, graph, text)

            if entrytype == "metThreshold":
                metThreshold += 1
                for i in range(0, rowcount):
                    if text:
                        print i, entry[i]
                    writer.writerow(entry[i])
            elif entrytype == "belowThreshold":
                belowThreshold += 1
            elif entrytype == "nonDC":
                nonDC += 1
            else:
                print "ERROR OVER HERE!!!!"

        print time.asctime(
            time.localtime()
        ), "In total there were", number, "Simulated Events. Of these", nonDC, "did not produce Cherenkov Light."
        print time.asctime(
            time.localtime()
        ), "A further", belowThreshold, "Events produced Cherenkov Light below Threshold, leaving", metThreshold, "accepted events."
示例#5
0
文件: constant.py 项目: Venj0/Creator
def run(names):
    if not os.path.exists("src"):
        # os.system("mkdir src")
        generate.run()
        exit()

    if not len(names):
        names = input("please type constants names : ").split(" ")
        if not len(names):
            exit()
    if not os.path.exists("src/constants"):
        os.system("mkdir src/constants")
        os.system("touch src/constants/index.js")

    for name in names:
        utils.add_import(name, "./%s" % name, "src/constants/index.js")
        os.system("touch src/constants/%s.js" % name)
        fs = open("src/constants/%s.js" % name, "w")
        fs.write("export const %s" % name)
        fs.close()
示例#6
0
def main(settings: str, run: bool = False):
    if run:
        generate.run(settings)

    with open(settings, 'r') as f:
        params = yaml.safe_load(f)

    N = params['initial']['N']
    box = params['initial']['box']
    amount = params['initial']['crosslinker']
    seed = params['simulation'].get('seed', 1)

    inputs = convert.read(
        f"{params['folders']['bonds']}/{params['main']['bonds']}")
    Path('configs').mkdir(exist_ok=True, parents=True)
    prefix = f'configs/gel-N{N}-X{amount}-b{int(box)}.{seed}'
    convert.write_bild(f'{prefix}.bild', *inputs)
    convert.write_lammps(f'{prefix}.lammps', *inputs)
    convert.write_xyz(f'{prefix}.xyz', *inputs)
    inputs[1].to_csv(f'{prefix}.csv')
    return
示例#7
0
文件: test_bio.py 项目: jhpeach/bio
def test_14(capsys):
    cmd = "bio convert ncov --gff  --type gene,CDS,mRNA"
    run(cmd, capsys=capsys, fname="manytypes.gff")
示例#8
0
文件: test_bio.py 项目: jhpeach/bio
def test_12(capsys):
    cmd = "bio convert ncov --gff  --start 10kb --end 20kb"
    run(cmd, capsys=capsys, fname="overlap.gff")
示例#9
0
文件: test_bio.py 项目: jhpeach/bio
def test_13(capsys):
    cmd = "bio convert ncov --gff  --type CDS"
    run(cmd, capsys=capsys, fname="cds.gff")
示例#10
0
def generate(*args, **kwargs):
    generatec.run(*args, **kwargs)
示例#11
0
文件: test_bio.py 项目: jhpeach/bio
def test_39(capsys):
    cmd = "bio taxon 9606 --lineage --flat"
    run(cmd, capsys=capsys, fname="taxon_9606_flat_lineage.txt")
示例#12
0
文件: test_bio.py 项目: jhpeach/bio
def test_16(capsys):
    cmd = "bio convert ncov --fasta --type CDS -end 10"
    run(cmd, capsys=capsys, fname="cds.fa")
示例#13
0
文件: test_bio.py 项目: jhpeach/bio
def test_18(capsys):
    cmd = "bio convert ncov --fasta --translate --type CDS --end 10"
    run(cmd, capsys=capsys, fname="translates.fa")
示例#14
0
文件: test_bio.py 项目: jhpeach/bio
def test_5(capsys):
    cmd = "bio convert ncov --genbank"
    run(cmd, capsys=capsys, fname="ncov.gb")
示例#15
0
文件: test_bio.py 项目: jhpeach/bio
def test_6(capsys):
    cmd = "bio convert ncov --fasta"
    run(cmd, capsys=capsys, fname="ncov.fa")
示例#16
0
文件: test_bio.py 项目: jhpeach/bio
def test_43(capsys):
    cmd = "bio runinfo ebola"
    run(cmd, capsys=capsys, fname="sra-test.txt")
示例#17
0
文件: test_bio.py 项目: jhpeach/bio
def test_4(capsys):
    cmd = "bio convert ncov --json"
    run(cmd, capsys=capsys, fname="ncov.json")
示例#18
0
文件: test_bio.py 项目: jhpeach/bio
def test_42(capsys):
    cmd = "bio fetch KM233118 --rename ebola"
    run(cmd, capsys=capsys, fname=None)
示例#19
0
文件: test_bio.py 项目: jhpeach/bio
def test_41(capsys):
    cmd = "bio data --delete ebola"
    run(cmd, capsys=capsys, fname=None)
示例#20
0
文件: test_bio.py 项目: jhpeach/bio
def test_40(capsys):
    cmd = "bio taxon  ncov ratg13"
    run(cmd, capsys=capsys, fname="taxon_data.txt")
示例#21
0
文件: test_bio.py 项目: jhpeach/bio
def test_15(capsys):
    cmd = "bio convert ncov --fasta --seqid foo --start 10 --end 20"
    run(cmd, capsys=capsys, fname="start.fa")
示例#22
0
文件: test_bio.py 项目: jhpeach/bio
def test_37(capsys):
    cmd = "bio taxon 9606"
    run(cmd, capsys=capsys, fname="taxon_9606.txt")
示例#23
0
文件: test_bio.py 项目: jhpeach/bio
def test_1(capsys):
    cmd = "bio data --delete ncov,ratg13"
    run(cmd, capsys=capsys, fname=None)
示例#24
0
文件: test_bio.py 项目: jhpeach/bio
def test_8(capsys):
    cmd = "bio convert ncov --gff --match phosphoesterase"
    run(cmd, capsys=capsys, fname="match.gff")
示例#25
0
文件: test_bio.py 项目: jhpeach/bio
def test_17(capsys):
    cmd = "bio convert ncov --fasta --type gene --end 10"
    run(cmd, capsys=capsys, fname="start-gene.fa")
示例#26
0
文件: test_bio.py 项目: jhpeach/bio
def test_9(capsys):
    cmd = "bio convert ncov --gff --gene S"
    run(cmd, capsys=capsys, fname="gene.gff")
示例#27
0
文件: test_bio.py 项目: jhpeach/bio
def test_19(capsys):
    cmd = "bio convert ncov --fasta --protein --start -10"
    run(cmd, capsys=capsys, fname="protein-end.fa")
示例#28
0
文件: test_bio.py 项目: jhpeach/bio
def test_11(capsys):
    cmd = "bio convert ncov --gff  --start 10,000 --end 20,000"
    run(cmd, capsys=capsys, fname="overlap.gff")
示例#29
0
文件: test_bio.py 项目: jhpeach/bio
def test_7(capsys):
    cmd = "bio convert ncov --gff"
    run(cmd, capsys=capsys, fname="ncov.gff")
示例#30
0
文件: test_bio.py 项目: jhpeach/bio
def test_38(capsys):
    cmd = "bio taxon 9606 --lineage"
    run(cmd, capsys=capsys, fname="taxon_9606_lineage.txt")