Example #1
0
    def __init__(self, name, pressure, tof, radius, height):
        AbstractComponent.__init__(self, name)
        # engine
        from mccomposite import mccompositebp
        from mccomponents import mccomponentsbp

        shape = mccompositebp.Cylinder(radius, height)
        self.engine = mccomponentsbp.DGSSXResPixel(tof, pressure, shape)
        return
    def __init__(self, name, path, append=False):

        AbstractComponent.__init__(self, name)

        if not append and os.path.exists(path):
            raise RuntimeError, "Neutron storage %r already exists. To append neutrons to this storage, please use keyword 'append=1'" % path

        if append: mode = 'a'
        else: mode = 'w'

        from mcni.neutron_storage import storage
        self._storage = storage(path, mode=mode)
        return
    def __init__(self, name, path, append = False):
        
        AbstractComponent.__init__(self, name)

        if not append and os.path.exists( path ):
            raise RuntimeError, "Neutron storage %r already exists. To append neutrons to this storage, please use keyword 'append=1'" % path
        
        if append: mode='a'
        else: mode = 'w'
        
        from mcni.neutron_storage import storage
        self._storage = storage( path, mode = mode) 
        return
 def __init__(self, name, neutron, dx=0, dy=0, dE=0):
     AbstractComponent.__init__(self, name)
     self.neutron = neutron
     self.dx = dx
     self.dy = dy
     self.dE = dE
     if not dx and not dy and not dE:
         self.process = self._process_0
     elif not dE:
         self.process = self._process_area
     else:
         self.process = self._process
     return
 def __init__(self, name, neutron, dx=0, dy=0, dE=0):
     AbstractComponent.__init__(self, name)
     self.neutron = neutron
     self.dx = dx
     self.dy = dy
     self.dE = dE
     if not dx and not dy and not dE:
         self.process = self._process_0
     elif not dE:
         self.process = self._process_area
     else:
         self.process = self._process
     return
    def __init__(self, name, path):
        AbstractComponent.__init__(self, name)
        
        path = self.path = os.path.abspath( path )
        
        if not os.path.exists( path ):
            raise IOError , "path %r does not exist" % path
        
        if os.path.isdir( path ):
            raise IOError , "path %r is a directory" % path

        from mcni.neutron_storage import storage
        self._storage = storage( path, 'r' )
        if self.parallel:
            # master node keeps the cursor
            if self.mpiRank == 0:
                self._cursor = 0
        return
    def __init__(self, name, path):
        AbstractComponent.__init__(self, name)

        path = self.path = os.path.abspath(path)

        if not os.path.exists(path):
            raise IOError, "path %r does not exist" % path

        if os.path.isdir(path):
            raise IOError, "path %r is a directory" % path

        from mcni.neutron_storage import storage
        self._storage = storage(path, 'r')
        if self.parallel:
            # master node keeps the cursor
            if self.mpiRank == 0:
                self._cursor = 0
        return
    def __init__(self, name, Q, E, Ei, L1):
        AbstractComponent.__init__(self, name)
        Ef = Ei - E
        
        from mcni.utils import e2k, e2v
        ki = e2k( Ei )
        kf = e2k( Ef )
        
        assert Q > abs(kf-ki) and Q < ki+kf, \
               'invalid: ki=%s, kf=%s, Q=%s' % (
            ki, kf, Q )
        
        cost = (ki*ki+kf*kf-Q*Q)/2/ki/kf

        from math import acos, cos, sin
        theta = acos( cost )

        vf = e2v( Ef )
        self.vz = vf * cos( theta )
        self.vp = vf * sin( theta )

        vi = e2v( Ei )
        self.t0 = L1/vi
        return
Example #9
0
    def __init__(self, name, Q, E, Ei, L1):
        AbstractComponent.__init__(self, name)
        Ef = Ei - E

        from mcni.utils import e2k, e2v
        ki = e2k(Ei)
        kf = e2k(Ef)

        assert Q > abs(kf-ki) and Q < ki+kf, \
               'invalid: ki=%s, kf=%s, Q=%s' % (
            ki, kf, Q )

        cost = (ki * ki + kf * kf - Q * Q) / 2 / ki / kf

        from math import acos, cos, sin
        theta = acos(cost)

        vf = e2v(Ef)
        self.vz = vf * cos(theta)
        self.vp = vf * sin(theta)

        vi = e2v(Ei)
        self.t0 = L1 / vi
        return
Example #10
0
 def __init__(self, name, testFacility):
     AbstractComponent.__init__(self, name)
     self.testFacility = testFacility
     return
Example #11
0
 def __init__(self, name, components, geometer, neutron_coords_transformer):
     AbstractComponent.__init__(self, name)
     self.components = components
     self.geometer = geometer
     self.neutron_coords_transformer = neutron_coords_transformer
     return
 def __init__(self, name, testFacility):
     AbstractComponent.__init__(self, name)
     self.testFacility = testFacility
     return
Example #13
0
 def __init__(self, name, components, geometer, neutron_coords_transformer):
     AbstractComponent.__init__(self, name)
     self.components = components
     self.geometer = geometer
     self.neutron_coords_transformer = neutron_coords_transformer
     return
Example #14
0
    def __init__(self, name, facility = 'neutron component'):
        base2.__init__(self, name)
        base1.__init__(self, name, facility)

        self._outputdir = None
        return