tubeIndexes = t.tubeIndexes return self.factory.he3tubekernel(pressure, tubeIndexes, t.tubeLength, t.npixels, t.axisDirection, t.pixel0position) # 3. the handler to call python bindings def he3tubekernel(self, pressure, tubeIndexes, tubeLength, npixels, axisDirection, pixel0position): import mccomponents.mccomponentsbp as b import mccomposite.mccompositebp as b1 #c representation of tube indexes ctubeIndexes = b.vector_int(0) for ind in tubeIndexes: ctubeIndexes.append(ind) axisDirection = b1.Vector(*axisDirection) pixel0position = b1.Vector(*pixel0position) cz2c = b.Z2Channel(tubeLength, npixels, axisDirection, pixel0position) return b.He3TubeKernel(pressure, ctubeIndexes, cz2c, self.t2c, self.mca) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register(He3TubeKernel, onHe3TubeKernel, {'BoostPythonBinding': he3tubekernel})
tubeIndexes = t.tubeIndexes return self.factory.he3tubekernel( pressure, tubeIndexes, t.tubeLength, t.npixels, t.axisDirection, t.pixel0position) # 3. the handler to call python bindings def he3tubekernel(self, pressure, tubeIndexes, tubeLength, npixels, axisDirection, pixel0position): import mccomponents.mccomponentsbp as b import mccomposite.mccompositebp as b1 #c representation of tube indexes ctubeIndexes = b.vector_int(0) for ind in tubeIndexes: ctubeIndexes.append( ind ) axisDirection = b1.Vector(*axisDirection) pixel0position = b1.Vector(*pixel0position) cz2c = b.Z2Channel(tubeLength, npixels, axisDirection, pixel0position) return b.He3TubeKernel( pressure, ctubeIndexes, cz2c, self.t2c, self.mca ) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register ( He3TubeKernel, onHe3TubeKernel, {'BoostPythonBinding':he3tubekernel} )
abs, sctt = self._unitsRemover.remove_unit( (abs, sctt), 1./units.length.meter ) return self.factory.sqekernel( abs, sctt, csqe, Qrange, Erange ) # 3. the handler to call python bindings def sqekernel(self, absorption_cross_section, scattering_cross_section, sqe, Qrange, Erange): import mccomponents.mccomponentsbp as b Emin, Emax = Erange Qmin, Qmax = Qrange return b.SQEkernel( absorption_cross_section, scattering_cross_section, sqe, Qmin, Qmax, Emin, Emax ) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register ( SQEkernel, onSQEkernel, {'BoostPythonBinding':sqekernel} ) # version __id__ = "$Id$" # End of file
def register(): hs.register ( NeutronPrinter, onNeutronPrinter, {'BoostPythonBinding':neutronprinter} )
def identify(self, visitor): return visitor.onEventModeMCA(self) pass # end of EventModeMCA # 2. the handler to construct c++ engine def onEventModeMCA(self, mca): return self.factory.eventmodemca( mca.outfilename, mca.detectorDims ) def bp_eventmodemca( self, outfilename, detectorDims ): import mccomponents.mccomponentsbp as b dims = b.vector_uint( 0 ) for dim in detectorDims: dims.append(dim) return b.EventModeMCA( outfilename, dims ) # 4. register the new class and handlers import mccomponents.homogeneous_scatterer as mh mh.register(EventModeMCA, onEventModeMCA, {'BoostPythonBinding': bp_eventmodemca}) # version __id__ = "$Id$" # End of file
assert shape[0] == int( (qend-qbegin)/qstep ) assert shape[1] == int( (eend-ebegin)/estep ) size = shape[0] * shape[1] import mccomponents.mccomponentsbp as b svector = b.vector_double( size ) s.shape = -1, svector[:] = s fxy = b.new_fxy( qbegin, qend, qstep, ebegin, eend, estep, svector) return b.GridSQE( fxy ) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register ( GridSQE, onGridSQE, {'BoostPythonBinding':gridsqe} ) # version __id__ = "$Id$" # End of file
def register(): hs.register(NeutronPrinter, onNeutronPrinter, {'BoostPythonBinding': neutronprinter})
return self.factory.gridsqe(qbegin, qend, qstep, ebegin, eend, estep, s) # 3. the handler to call python bindings def gridsqe(self, qbegin, qend, qstep, ebegin, eend, estep, s): shape = s.shape assert len(shape) == 2 assert shape[0] == int((qend - qbegin) / qstep) assert shape[1] == int((eend - ebegin) / estep) size = shape[0] * shape[1] import mccomponents.mccomponentsbp as b svector = b.vector_double(size) s.shape = -1, svector[:] = s fxy = b.new_fxy(qbegin, qend, qstep, ebegin, eend, estep, svector) return b.GridSQE(fxy) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register(GridSQE, onGridSQE, {'BoostPythonBinding': gridsqe}) # version __id__ = "$Id$" # End of file
dearr = energies[1:] - energies[:-1] #make sure bin sizes are all the same import numpy assert numpy.all( numpy.abs( dearr-de ) < 1e-7*de ) n = eaxis.size() Z = doshist.data().storage().asNumarray() return self.factory.linearlyinterpolateddos( e0, de, n, Z ) # 3. the handler to call python bindings def linearlyinterpolateddos_bp_handler(self, e0, de, n, Z): return linearlyinterpolateddos_bp(e0, de, n, Z) import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register ( LinearlyInterpolatedDOS, onLinearlyInterpolatedDOS, {'BoostPythonBinding':linearlyinterpolateddos_bp_handler} ) # version __id__ = "$Id$" # End of file
#register new type # 2. the handler of engine renderer def onDWFromDOS(self, dwfromDOS): dos = dwfromDOS.dos cdos = dos.identify(self) mass = dwfromDOS.mass temperature = dwfromDOS.temperature return self.factory.dwfromDOS(cdos, mass, temperature, dwfromDOS.nsampling) # 3. the handler to call python bindings def dwfromDOS_bp_handler(self, dos, mass, temperature, nsampling): from mccomponents import mccomponentsbp as bp ret = bp.DWFromDOS_dbl(dos, nsampling) ret.calc_DW_core(mass, temperature) return ret import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register(DWFromDOS, onDWFromDOS, {'BoostPythonBinding': dwfromDOS_bp_handler}) # version __id__ = "$Id$" # End of file
cdos = dos.identify(self) mass = dwfromDOS.mass temperature = dwfromDOS.temperature return self.factory.dwfromDOS( cdos, mass, temperature, dwfromDOS.nsampling ) # 3. the handler to call python bindings def dwfromDOS_bp_handler(self, dos, mass, temperature, nsampling): from mccomponents import mccomponentsbp as bp ret = bp.DWFromDOS_dbl(dos, nsampling) ret.calc_DW_core( mass, temperature ) return ret import mccomponents.homogeneous_scatterer as hs # 4. register the new class and handlers hs.register ( DWFromDOS, onDWFromDOS, {'BoostPythonBinding':dwfromDOS_bp_handler} ) # version __id__ = "$Id$" # End of file