当前位置: 首页>>代码示例>>Python>>正文


Python pys.sd函数代码示例

本文整理汇总了Python中pys.sd函数的典型用法代码示例。如果您正苦于以下问题:Python sd函数的具体用法?Python sd怎么用?Python sd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gendats

def gendats(di,
            w0=w0*1e2,
            width=0.46e-4,
            L=0.043e-4,
            N0=1.08e22,
            depth=0.086e-4,
            mindensity=1e18,
            dat_xres=None,
            new=False):
    if new:
        mkpinprick = mk45_pinprick_plasma
    else:
        mkpinprick = mk45_pinprick_plasma_old
    targ_plasma, targ_neutral = mkpinprick(
        dim = [i*1e-4 for i in d['tlim']],
        N0  = N0,
        laser_radius = w0,
        width = width,
        L = L,# 43nm
        depth = depth, #chosen arbitrarily
        mindensity=mindensity);
    if not dat_xres:
        dat_xres = di['res'][0]+1;
    print("making targets for {}".format(di['pbsbase']));
    dd = sd(di, f_2D = targ_plasma, dat_xres = dat_xres);
    dat = gendat(**dd);
    savetxt(
        "{}/{}".format(di['pbsbase'],'target_plasma.dat'),
        dat);
    dd = sd(d, f_2D = targ_neutral, dat_xres = dat_xres);
    dat = gendat(**dd);
    savetxt(
        "{}/{}".format(di['pbsbase'],'target_neutral.dat'),
        dat);
开发者ID:noobermin,项目名称:sharks,代码行数:34,代码来源:genall.py

示例2: manual_genboundary

def manual_genboundary(bspec,**kw):
    kwp = sd(kw,**bspec);
    getkw = mk_getkw(kwp,outletdefaults,prefer_passed = True);
    btype = getkw("type");
    lims  = getkw('lim');
    di = dict();
    for dim,lim in zip(all_lims,lims):
        di[dim] = lim;
    if btype == 'outlet':
        model = getkw('model');
        di['label']= getkw('label');
        di['phase_velocity'] = getkw('phase_velocity');
        if model == 'none':
            ret = outlet_none_tmpl.format(**di);
        elif model == 'potential':
            di = sd(manbounds_defs,**di);
            if not test(di,'connection_rank'):
                di['connection_rank'] ='';
            else:
                di['connection_rank'] = 'connection_rank {}'.format(
                    getkw('connection_rank'));
            if not test(kwp,'voltage_measurement'):
                di['voltage_measurement'] = '';
            else:
                raise NotImplementedError("haven't got to this yet...");
            di['circuit'] = di['circuit'];
            ret = outlet_pot_tmpl.format(**di);
        elif model == 'laser':
            raise NotImplementedError("need to implement the laser...");
        else:
            raise ValueError("unknown outlet model {}".format(model));
    else:
        raise NotImplementedError("yeah...");
    return ret;
开发者ID:noobermin,项目名称:sharks,代码行数:34,代码来源:genlsp.py

示例3: genregions

def genregions(**kw):
    def getkw(l, scale=None):
        if test(kw, l):
            ret = kw[l]
        else:
            ret = region_defaults[l]
        if scale:
            return [scale * i for i in ret]
        return ret

    regsplit_dir, subdivs = getkw("region_split")

    nonsplits = [x for x in ["x", "y", "z"] if x != regsplit_dir]
    limkw = [x + lims for x in ["x", "y", "z"] for lims in ["min", "max"]]
    lims = {k: lim for k, lim in zip(limkw, getkw("lims"))}

    total_doms = getkw("domains")
    doms = [total_doms // subdivs for i in range(subdivs)]
    doms[-1] += total_doms % subdivs
    lmn, lmx = regsplit_dir + "min", regsplit_dir + "max"
    mn, mx = lims[lmn], lims[lmx]
    edges = [mn + i * (mx - mn) / subdivs for i in range(subdivs)] + [mx]
    mins = edges[:-1]
    maxs = edges[1:]
    reg = sd(lims, split=getkw("split_dir").upper + "SPLIT")
    regions = [
        sd(reg, **{lmn: mn, lmx: mx, "i": i, "domains": di}) for i, (mn, mx, di) in enumerate(zip(mins, maxs, doms))
    ]
    return mkregion_str(regions)
开发者ID:noobermin,项目名称:sharks,代码行数:29,代码来源:genlsp.py

示例4: gendat3d

def gendat3d(
        di,
        w0=w0*1e2,
        width=0.46e-4,
        L=0.043e-4,
        N0=1.08e22,
        mindensity=1e18,
        dat_xres=None,
        dat_zres=4,#works for no z variation
        fmt='%.4e'
):
    targ_neutral = mk45_pinprick_neutral3d(
        dim = [i*1e-4 for i in d['tlim']],
        N0  = N0,
        laser_radius = w0,
        width = width,
        L = L,# 43nm
        mindensity=mindensity);
    if not dat_xres:
        dat_xres = di['res'][0]+1;
    print("making targets for {}".format(di['pbsbase']));
    dd = sd(di, f_3D = targ_neutral, dat_xres = dat_xres);
    dat = gendat(dat_zres=dat_zres,datfmt=fmt,**dd);
    savetxt(
        "{}/{}".format(di['pbsbase'],di['dens_dat']),
        dat);
开发者ID:noobermin,项目名称:sharks,代码行数:26,代码来源:genall.py

示例5: genonescale

def genonescale(**kw):
    getkw = mk_getkw(kw, onescale_defaults)
    slen = getkw("solid_len")
    xlen = getkw("xlen")
    kw1 = sd(kw, tlim=(0.0, xlen) + (0.0, 0.0, 0.0, 0.0), sdim=(xlen - slen, xlen) + (0.0, 0.0, 0.0, 0.0))
    kw1["f_1D"] = genf(**kw1)
    return gentargetdat(**kw1)
开发者ID:noobermin,项目名称:sharks,代码行数:7,代码来源:gendat.py

示例6: mksim

def mksim(pbsbase, **d):
    print("making {}".format(pbsbase))
    myd = sd(lsp_d, **d)
    lsp = genlsp(**myd)
    pbs = genpbs(pbsbase=pbsbase)
    pbs = re.sub("../scripts/autozipper", "../../scripts/autozipper", pbs)
    output(lsp, pbs, pbsbase, dats=["sine700points.dat", myd["targetdat"]], dir=pbsbase)
开发者ID:noobermin,项目名称:sharks,代码行数:7,代码来源:genall.py

示例7: firsthash_new

def firsthash_new(frame,**kw):
    kw['new']=True;
    kw['dupes']=None;
    hashes = genhash(frame,**kw);
    uni,counts = np.unique(hashes,return_counts=True);
    d=sd(kw,dupes=uni[counts>1],removedupes=True);
    dupei = np.in1d(hashes, d['dupes'])
    hashes[dupei] = -1
    return hashes, retd;
开发者ID:noobermin,项目名称:lspreader,代码行数:9,代码来源:pmovie.py

示例8: mkscale_sim

def mkscale_sim(**d):
    datf = "water-{}.dat".format(d["dat"])
    d = sd(scale_sim, **d)
    d["targetdat"] = datf
    d["description"] = "scale length sim with {}".format(d["dat"])
    if not test(d, "name"):
        name = "longl_l={}_{}".format(d["dat"], d["I"])
    else:
        name = d["name"]
    mksim(name, **d)
开发者ID:noobermin,项目名称:sharks,代码行数:10,代码来源:genall.py

示例9: genregions

def genregions(**kw):
    def getkw(l,scale=None):
        if test(kw, l):
            ret = kw[l]
        else:
            ret = region_defaults[l];
        if scale:
            return [scale*i for i in ret];
        return ret;
    regsplit_dir, subdivs = getkw('region_split');
    
    nonsplits = [x for x in ['x','y','z']
                 if x != regsplit_dir ];
    limkw = [x+lims
             for x in ['x','y','z']
             for lims in ['min','max']];
    lims = {k:lim for k,lim in zip(limkw,getkw('lim',scale=1e-4))};
    
    total_doms = getkw('domains');
    doms =  [total_doms//subdivs for i in range(subdivs)];
    doms[-1] += total_doms % subdivs;
    lmn,lmx = regsplit_dir+'min', regsplit_dir+'max';
    mn,mx = lims[lmn],lims[lmx]
    edges = [mn+i*(mx-mn)/subdivs
             for i in range(subdivs)] + [mx];
    split_cells = getkw(getkw("region_dom_split")+"cells");
    
    mins = edges[:-1];
    maxs = edges[1:];
    if test(kw,"xcells") and test(kw,"ycells") and test(kw,"zcells"):
        zcells_per_region = [kw['zcells']//subdivs 
                             for i in range(subdivs)]
        zcells_per_region[-1] += kw['zcells'] % subdivs;
        
        cellses = [ kw['xcells']*kw['ycells']*zc
                    for i,zc in enumerate(zcells_per_region)];
    else:
        cellses = [None for i in range(subdivs)];
    reg = sd(lims,split=getkw("region_dom_split").upper()+"SPLIT")
    regions = [ sd(reg,**{lmn:mn,lmx:mx,'i':i+1,'domains':di,'cells':cells})
                for i,(mn,mx,di,cells) in enumerate(zip(mins,maxs,doms,cellses)) ];
    return mkregion_str(regions, split_cells=split_cells);
开发者ID:noobermin,项目名称:sharks,代码行数:42,代码来源:genlsp_obj.py

示例10: mktarg

 def mktarg(di):
     dd = sd(
         di,
         f_2D = mk45(
             dim = [i*1e-4 for i in di['tlim']],
             N0    = 1.0804e22,
             width = 0.46e-4,
             dropcorners='round'));
     dat = gendat(**dd);
     savetxt(
         "{}/{}".format(di['pbsbase'],di['dens_dat']),
         dat);
开发者ID:noobermin,项目名称:sharks,代码行数:12,代码来源:genall.py

示例11: genconductor_boundaries

def genconductor_boundaries(**kw):
    getkw=mk_getkw(kw, condb_defaults);
    conductorss='';
    for I,conductor in enumerate(getkw('conductors')):
        cd = sd(condb_objdef, **conductor);
        if test(cd,'from') and test(cd,'to'):
            cd['xmin'],cd['ymin'],cd['zmin'] = cd['from']
            cd['xmax'],cd['ymax'],cd['zmax'] = cd['to']
            pass;
        else:
            outlet = cd['outlet'];
            if outlet not in all_lims:
                raise ValueError('Unknown outlet "{}"'.format(outlet));
            coords = outlet_coords(outlet,kw);
            cd['width']*=1e-4;
            cd['start']*=1e-4;
            sign = lambda outlet: 1.0 if outlet[-2:] == 'ax' else -1.0
            coords[outlet] += sign(outlet)*(cd['width'] + cd['start']);
            coords[otherside(outlet)] += sign(outlet)*cd['start'];
        conductorss += condb_tmpl.format(
            i=I+1,
            **sd(cd,**coords));
    return conductorss;
开发者ID:noobermin,项目名称:sharks,代码行数:23,代码来源:genlsp_obj.py

示例12: gendatrot

def gendatrot(
        di,
        w0=w0*1e2,
        width=0.46e-4,
        L=0.043e-4,
        N0=1.08e22,
        mindensity=1e18,
        spotz_width=20e-4,
        yres = 75,
        fmt='%.4e',):
    print("warning: this will only work for rot3d");
    targ_neutral = mk0_pinprick_neutral3d(
        N0  = N0,
        spotz_width=spotz_width,
        laser_radius = w0,
        width = width,
        L = L,# 43nm
        mindensity=mindensity);
    #manual hacks to save space
    #generate cell sized samples around the corners.
    # x's edge
    def getsamples(point,lims,res,ndxs = 3):
        out=np.linspace(lims[0]*1e-4,lims[1]*1e-4,res+1);
        dx = out[1] - out[0];
        out = out[ out >= point - ndxs*dx ];
        out = out[ out <= point + ndxs*dx ];
        return list(out);
    def axissamples(half_width, tlim, lim, res,ndxs=3):
        p = [ tlim[0] ] + getsamples(-half_width,lim,res,ndxs=ndxs)
        p+= [0.0] + getsamples(half_width,lim,res,ndxs=ndxs)
        p+= [ tlim[1] ];
        return np.array(p);
    x = axissamples(
        w0, di['tlim'][0:2], di['lim'][0:2], di['res'][0]);
    y = np.linspace(
        di['tlim'][2]*1e-4,di['tlim'][3]*1e-4,yres+1);
    z = axissamples(
        spotz_width/2.0,
        di['tlim'][4:6], di['lim'][4:6], di['res'][2]);
    print("making targets for {}".format(di['pbsbase']));
    X,Y,Z=np.meshgrid(x,y,z,indexing='ij');
    Q=targ_neutral(X,Y,Z)
    dd = sd(di, data3D =(x,y,z,Q), datfmt=fmt);
    dat = gendat(**dd);
    savetxt(
        "{}/{}".format(di['pbsbase'],di['dens_dat']),
        dat);
开发者ID:noobermin,项目名称:sharks,代码行数:47,代码来源:genall.py

示例13: genconductors

def genconductors(**kw):
    getkw=mk_getkw(kw, condb_defaults);
    conductorss='';
    for I,conductor in enumerate(getkw('conductors')):
        cd = sd(condb_objdef, **conductor);
        coords=dict();
        if test(cd,'outlet'):
            outlet = cd['outlet'];
            if outlet not in all_lims:
                raise ValueError('Unknown outlet "{}"'.format(outlet));
            coords = outlet_coords(outlet,kw);
            cd['width']*=1e-4;
            cd['start']*=1e-4;
            if outlet[-2:] == 'ax':
                sign = 1.0;
            else:
                sign =-1.0
            cd['type']= 'BLOCK';
            coords[outlet] += sign*(cd['width'] + cd['start']);
            coords[otherside(outlet)] += sign*cd['start'];
            cd['from'] = (coords['xmin'],coords['ymin'],coords['zmin']);
            cd['to']   = (coords['xmax'],coords['ymax'],coords['zmax']);
        conductorss += condf_tmpl.format(
            i=I+1,
            xf=cd['from'][0],yf=cd['from'][1],zf=cd['from'][2],
            **cd);
        def mk_to(cd):
            '''generate the to's'''
            return ''.join([
                condt_tmpl.format(xt=xt,yt=yt,zt=zt)
                for xt,yt,zt in cd['to'] ]);
        
        if cd['type'] == 'BLOCK':
            if type(cd['to']) == list: cd['to'] = cd['to'][0]
            conductorss += condt_tmpl.format(
                xt=cd['to'][0],yt=cd['to'][1],zt=cd['to'][2]);
        elif cd['type'] == 'PARALLELPIPED':
            conductorss += mk_to(cd);
        elif cd['type'] == 'TRILATERAL':
            conductorss += mk_to(cd);
            conductorss += 'sweep_direction {sweep_direction}\n'.format(
                **cd);
        else:
            raise ValueError(
                "Unknown conductor type '{}'".format(cd['type']));
    return conductorss;
开发者ID:noobermin,项目名称:sharks,代码行数:46,代码来源:genlsp_species.py

示例14: gendatclean

def gendatclean(
        di,
        width=0.46e-4,
        N0=1.08e22,
        fmt='%.4e',):
    targ_neutral = mk45_clean_neutral2d(
        width=width,
        N0  = N0,);
    print("making targets for {}".format(di['pbsbase']));
    dd = sd(di,
            f_2D = targ_neutral,
            dat_xres=di['res'][0]+1,
            dat_yres=di['res'][0]+1);
    dat = gendat(datfmt=fmt,**dd);
    savetxt(
        "{}/{}".format(di['pbsbase'],di['dens_dat']),
        dat);
开发者ID:noobermin,项目名称:sharks,代码行数:17,代码来源:genall.py

示例15: sd

        contour_quantities=('RhoN10', 'RhoN10'),
    ),
    #pmovies
    no_pmovies=True,
    #particle dumps
    dump_particle=True,
    particle_dump_interval_ns=1e-15,
);
d2 = sd(d,
        lim = (-25,25,
               -25,25,
               0,0),
        tlim = (-20,20,
                -20,20,
                0,0),
        res =(1600,
              1600,
              0),
        pbsbase='prexp2',
        region_split=('y',3),
        domains=96,
        totaltime=400e-15,
        particle_dump_interval_ns=1e-15,);
gensim(**d);
gensim(**d2);

def mktarg(di, No = 3.34e22, ro = 5e-4, L = 1e-4):
    tw = di['tlim'][1] - di['tlim'][0]
    dat_xres= int(tw/(di['lim'][1]-di['lim'][0])*di['res'][0]);
    dd = sd(
        di,
开发者ID:noobermin,项目名称:sharks,代码行数:31,代码来源:genall.py


注:本文中的pys.sd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。