The entry point for the Hyper-V Neutron Agent.
776435
def main():
    """"""
    neutron_config.register_agent_state_opts_helper(CONF)
    common_config.init(sys.argv[1:])
    neutron_config.setup_logging()

    hyperv_agent = HyperVNeutronAgent()

    # Start everything.
    LOG.info("Agent initialized successfully, now running... ")
    hyperv_agent.daemon_loop()
756754
def Nasv(macs,T):
    ''' 
    
        
    '''

    Na = avogadro_constant
    k  = boltzmann_constant
    vtherm=(2.*k*T/mass_H_atom)**0.5

    s  = macs*1.e-27
    Nasv = s*vtherm*Na
    return Nasv
1024896
def main(args,parser,subparser=None):
    '''

    '''

    # First priority to args.base
    base = args.base
    if base is None:
        base = os.environ.get('EXPFACTORY_BASE')

    # Does the base folder exist?
    if base is None:
        bot.error("You must set a base of experiments with --base" % base)
        sys.exit(1)

    if not os.path.exists(base):
        bot.error("Base folder %s does not exist." % base)
        sys.exit(1)

    # Export environment variables for the client
    experiments = args.experiments
    if experiments is None:
        experiments = " ".join(glob("%s/*" % base))

    os.environ['EXPFACTORY_EXPERIMENTS'] = experiments

    # If defined and file exists, set runtime variables
    if args.vars is not None:
        if os.path.exists(args.vars):
            os.environ['EXPFACTORY_RUNTIME_VARS'] = args.vars
            os.environ['EXPFACTORY_RUNTIME_DELIM'] = args.delim
        else:
            bot.warning('Variables file %s not found.' %args.vars)


    subid = os.environ.get('EXPFACTORY_STUDY_ID')
    if args.subid is not None:
        subid = args.subid 
        os.environ['EXPFACTORY_SUBID'] = subid

    os.environ['EXPFACTORY_RANDOM'] = str(args.disable_randomize)
    os.environ['EXPFACTORY_BASE'] = base
    
    from expfactory.server import start
    start(port=5000)
1037164
def _calc_specpp_hiE(self, Egamma):
        
        # Fixed quad with n=40 is about 15 times faster and is always within
        # 0.5% of the result of adaptive quad for Egamma>0.1
        # WARNING: It also produces artifacts for steep distributions (e.g.
        # Maxwellian) at ~500 GeV. Reverting to adaptative quadrature
        # from scipy.integrate import fixed_quad
        # result=c*fixed_quad(self._photon_integrand, 0., 1., args = [Egamma,
        # ], n = 40)[0]
        from scipy.integrate import quad

        Egamma = Egamma.to("TeV").value
        specpp = (
            c.cgs.value
            * quad(
                self._photon_integrand,
                0.0,
                1.0,
                args=Egamma,
                epsrel=1e-3,
                epsabs=0,
            )[0]
        )

        return specpp * u.Unit("1/(s TeV)")
171234
function (text, sep) {
/*Line 27 - 'WebAtoms.Core.js' */        if (sep && sep.constructor == String) {
/*Line 28 - 'WebAtoms.Core.js' */            sep = $.trim(sep);
/*Line 29 - 'WebAtoms.Core.js' */        }
/*Line 30 - 'WebAtoms.Core.js' */        var ar = text.split(sep);
/*Line 31 - 'WebAtoms.Core.js' */        var r = [];
/*Line 32 - 'WebAtoms.Core.js' */        var ae = new AtomEnumerator(ar);
/*Line 33 - 'WebAtoms.Core.js' */        var item;
/*Line 34 - 'WebAtoms.Core.js' */        while (ae.next()) {
/*Line 35 - 'WebAtoms.Core.js' */            item = ae.current();
/*Line 36 - 'WebAtoms.Core.js' */            if (item && item.constructor == String) {
/*Line 37 - 'WebAtoms.Core.js' */                item = $.trim(item);
/*Line 38 - 'WebAtoms.Core.js' */            }
/*Line 39 - 'WebAtoms.Core.js' */            r.push(item);
/*Line 40 - 'WebAtoms.Core.js' */        }
/*Line 41 - 'WebAtoms.Core.js' */        return r;
/*Line 42 - 'WebAtoms.Core.js' */    }
386423
function wrapInitOnce(target, reactionName) {
	if (!target.init || !target.init._mobxObserver) {
		wrapInit(target, reactionName);
		target.init._mobxObserver = true;
	}
}
270140
def main():
    
    dataset = 'RD'

    observables = ['log(<\sigma v>)', '\Omega_{\chi}h^2', 'log(\sigma_p^{SI})']
    var  = ['log(m_{\chi})']
    var += ['log(C_1)', 'log(C_2)', 'log(C_3)', 'log(C_4)', 'log(C_5)', 'log(C_6)']
    var += observables

    plot_vs_mass(dataset, observables, 'mass_vs_observables.png')
    plot_oneD(dataset, var, 'oneD.png')
    pairplot(dataset, var, 'pairplot.png')
14819
function dotAtom() {
        return wrap('dot-atom', and(invis(opt(cfws)), dotAtomText, invis(opt(cfws)))());
    }
1339744
def make_client(instance):
    """"""
    neutron_client = utils.get_client_class(
        API_NAME,
        instance._api_version[API_NAME],
        API_VERSIONS,
    )
    instance.initialize()
    url = instance._url
    url = url.rstrip("/")
    client = neutron_client(username=instance._username,
                            project_name=instance._project_name,
                            password=instance._password,
                            region_name=instance._region_name,
                            auth_url=instance._auth_url,
                            endpoint_url=url,
                            endpoint_type=instance._endpoint_type,
                            token=instance._token,
                            auth_strategy=instance._auth_strategy,
                            insecure=instance._insecure,
                            ca_cert=instance._ca_cert,
                            retries=instance._retries,
                            raise_errors=instance._raise_errors,
                            session=instance._session,
                            auth=instance._auth)
    return client
1162779
private List<InvPair> createInvarLabel(IAtomContainer atomContainer) {
        Iterator<IAtom> atoms = atomContainer.atoms().iterator();
        IAtom a;
        StringBuffer inv;
        List<InvPair> vect = new ArrayList<InvPair>();
        while (atoms.hasNext()) {
            a = (IAtom) atoms.next();
            inv = new StringBuffer();
            inv.append(atomContainer.getConnectedAtomsList(a).size()
                    + (a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount())); //Num connections
            inv.append(atomContainer.getConnectedAtomsList(a).size()); //Num of non H bonds
            inv.append(PeriodicTable.getAtomicNumber(a.getSymbol()));

            Double charge = a.getCharge();
            if (charge == CDKConstants.UNSET) charge = 0.0;
            if (charge < 0) //Sign of charge
                inv.append(1);
            else
                inv.append(0); //Absolute charge
            inv.append((int) Math.abs((a.getFormalCharge() == CDKConstants.UNSET ? 0.0 : a.getFormalCharge()))); //Hydrogen count
            inv.append((a.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : a.getImplicitHydrogenCount()));
            vect.add(new InvPair(Long.parseLong(inv.toString()), a));
        }
        return vect;
    }
589821
function HyperServer($){

    //setup
    $ = Object.assign( defaults, $ ); 

    //injection
    let gx   = $.generator;
    let hx   = $.handler;

    //prototype
    let $ns, $n = proto();
    let dev  = ( 'development' == $n.get('env') || process.env.NODE_ENV  == 'development' );
    let port = (( dev ? $.LOCAL_PORT : $.APP_PORT ) || process.env.NODE_PORT );
 
    //config mapping
    $n.set( 'port', port );
    $n.set( 'view engine', $.VIEW_ENGINE );

    //middleware in out next
    if( dev ) $n.use( errorHandler({ dumpExceptions: true, showStack: true }) );
    $n.use( bodyParser.json() );
    $n.use( bodyParser.urlencoded({ extended:true }) );
    $n.use( override() );
    $n.use( cookieParser() );
    $n.use( sss({secret: 'secret', key:$.SESSION_ID, resave:true, saveUninitialized:true }));
    $n.use( ( i, o, n ) => { o.set('X-Powered-By', $.SERVER_ID ); n(); });
    $n.use( ( i, o, n ) => { i.baseUrl = i.originalUrl.split("?").shift(); n(); });
    $n.use( ( i, o, n ) => { console.info( `[${i.method} ${i.baseUrl}]`) || n(); }); //| q:${k(i.query)} \t | c:${k(i.cookies)}` ) || n(); });
    $n.use( favicon( $.PUBLIC_WWW + '/favicon.ico') );
    $n.use( proto.static( $.PUBLIC_WWW, {  
        setHeaders: ( res, path, stat ) => res.set('X-Timestamp', Date.now())
    }));

    //route stubs
    $.router.route( $n );

    //boot
    $ns = http.createServer($n)
          .on( 'close', ()=> {
            console.error( $.SERVER_ID + " - Shutting Down..");
          })
          .listen( port, data => {
            console.info( `Env  : [ ${( dev ? "DEV" : "UAT" )} ] \nPort : [ ${port} ]` );
            console.info( `URL  :  http://localhost:${port}` );
          });

    //termsigs
    process.once( 'SIGUSR2', ()=> {
            console.warn( 'Attempting to graceful kill...' );
            process.kill( process.pid, 'SIGUSR2');
          })
          .once( 'EADDRINUSE', ()=> {
            console.warn( 'Required port unavailable' );
            process.exit(1);
          });

    return $n;
  }
631837
def hugoniot_p(rho, rho0, c0, s):
    
    eta = 1. - (rho0 / rho)
    Ph = rho0 * c0 * c0 * eta / np.power((1. - s * eta), 2.)
    return Ph
898091
private static double getRadiusForNucl(NucleotideImpl nuc, Atom atom) {

		if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius();
		if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius();

		if (atom.getElement()==Element.C) return NUC_CARBON_VDW;

		if (atom.getElement()==Element.N) return NUC_NITROGEN_VDW;

		if (atom.getElement()==Element.P) return PHOSPHOROUS_VDW;

		if (atom.getElement()==Element.O) return OXIGEN_VDW;

		logger.info("Unexpected atom "+atom.getName()+" for nucleotide "+nuc.getPDBName()+", assigning its standard vdw radius");
		return atom.getElement().getVDWRadius();
	}
1310321
def rotational_invariance(force_constants,
                          supercell,
                          primitive,
                          symprec=1e-5):
    

    print("Check rotational invariance ...")

    fc = force_constants
    p2s = primitive.get_primitive_to_supercell_map()

    smallest_vectors, multiplicity = primitive.get_smallest_vectors()

    abc = "xyz"

    for pi, p in enumerate(p2s):
        for i in range(3):
            mat = np.zeros((3, 3), dtype='double')
            for s in range(supercell.get_number_of_atoms()):
                m = multiplicity[s, pi]
                vecs = smallest_vectors[s, pi, :m]
                v = np.dot(vecs.sum(axis=0) / m, primitive.get_cell())
                for j in range(3):
                    for k in range(3):
                        mat[j, k] += (fc[p, s, i, j] * v[k] -
                                      fc[p, s, i, k] * v[j])

            print("Atom %d %s" % (p + 1, abc[i]))
            for vec in mat:
                print("%10.5f %10.5f %10.5f" % tuple(vec))
1261171
def warsaw_up_to_warsaw(C, parameters=None, sectors=None):
    
    C_in = smeftutil.wcxf2arrays_symmetrized(C)
    p = default_parameters.copy()
    if parameters is not None:
        # if parameters are passed in, overwrite the default values
        p.update(parameters)
    Uu = Ud = Ul = Ue = np.eye(3)
    V = ckmutil.ckm.ckm_tree(p["Vus"], p["Vub"], p["Vcb"], p["delta"])
    Uq = V
    C_out = smeftutil.flavor_rotation(C_in, Uq, Uu, Ud, Ul, Ue)
    C_out = smeftutil.arrays2wcxf_nonred(C_out)
    warsaw = wcxf.Basis['SMEFT', 'Warsaw']
    all_wcs = set(warsaw.all_wcs)  # to speed up lookup
    return {k: v for k, v in C_out.items() if k in all_wcs}
420449
private static GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex) {

        IAtom[] ligands = tc.getLigands();

        int centre = atomToIndex.get(tc.getChiralAtom());
        int[] indices = new int[4];

        int offset = -1;

        for (int i = 0; i < ligands.length; i++) {
            indices[i] = atomToIndex.get(ligands[i]);
            if (indices[i] == centre) offset = i;
        }

        // convert clockwise/anticlockwise to -1/+1
        int parity = tc.getStereo() == CLOCKWISE ? -1 : 1;

        // now if any atom is the centre (indicating an implicit
        // hydrogen) we need to adjust the indicies and the parity
        if (offset >= 0) {

            // remove the 'implicit' central from the first 3 vertices
            for (int i = offset; i < indices.length - 1; i++) {
                indices[i] = indices[i + 1];
            }

            // we now take how many vertices we moved which is
            // 3 (last index) minus the index where we started. if the
            // value is odd we invert the parity (odd number of
            // inversions)
            if (Integer.lowestOneBit(3 - offset) == 0x1) parity *= -1;

            // trim the array to size we don't include the last (implicit)
            // vertex when checking the invariants
            indices = Arrays.copyOf(indices, indices.length - 1);
        }

        return new GeometryEncoder(centre, new BasicPermutationParity(indices), GeometricParity.valueOf(parity));
    }
1167135
function createReducer(initialState) {
  var reactor = {};

  for (var _len = arguments.length, atoms = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    atoms[_key - 1] = arguments[_key];
  }

  atoms.forEach(function (atom) {
    reactor = _extends({}, reactor, atom.react);
  });

  return function () {
    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
    var action = arguments[1];

    var handler = reactor[action.type];
    return handler ? handler(state, action) : state;
  };
}