def setUp(self): """ Set up cylinder model """ radius = 5 length = 40 density = 20 # Analytical model self.ana = CylinderModel() self.ana.setParam('scale', 1.0) self.ana.setParam('background', 0.0) self.ana.setParam('sld', 1.0) self.ana.setParam('sld_solvent', 0.0) self.ana.setParam('radius', radius) self.ana.setParam('length', length) # Simulation model self.model = VolumeCanvas.VolumeCanvas() cyl = VolumeCanvas.CylinderDescriptor() self.handle = self.model.addObject(cyl) self.model.setParam('lores_density', density) self.model.setParam('scale', 1.0) self.model.setParam('background', 0.0) self.model.setParam('%s.contrast' % self.handle, 1.0) self.model.setParam('%s.radius' % self.handle, radius) self.model.setParam('%s.length' % self.handle, length)
def setUp(self): """ Set up cylinder model """ radius = 5 length = 40 density = 20 # Analytical model self.ana = CylinderModel() self.ana.setParam('scale', 1.0) self.ana.setParam('background', 0.0) self.ana.setParam('sld', 1.0) self.ana.setParam('sld_solvent', 0.0) self.ana.setParam('radius', radius) self.ana.setParam('length', length) self.ana.setParam('theta', math.pi / 2.0) self.ana.setParam('phi', math.pi / 2.0) # Simulation model self.model = VolumeCanvas.VolumeCanvas() self.handle = self.model.add('cylinder') self.model.setParam('lores_density', density) self.model.setParam('scale', 1.0) self.model.setParam('background', 0.0) self.model.setParam('%s.radius' % self.handle, radius) self.model.setParam('%s.length' % self.handle, length) self.model.setParam('%s.contrast' % self.handle, 1.0) self.model.setParam('%s.orientation' % self.handle, [0, 0, 0])
def setUp(self): """ Set up ellipsoid """ radius_a = 60 radius_b = 10 density = 30 self.ana = EllipsoidModel() self.ana.setParam('scale', 1.0) self.ana.setParam('background', 0.0) self.ana.setParam('sld', 1.0) self.ana.setParam('sld_solvent', 0.0) self.ana.setParam('radius_polar', radius_a) self.ana.setParam('radius_equatorial', radius_b) # Default orientation is there=1.57, phi=0 # Radius_a is along the x direction canvas = VolumeCanvas.VolumeCanvas() self.handle = canvas.add('ellipsoid') canvas.setParam('lores_density', density) canvas.setParam('scale', 1.0) canvas.setParam('background', 0.0) canvas.setParam('%s.radius_x' % self.handle, radius_a) canvas.setParam('%s.radius_y' % self.handle, radius_b) canvas.setParam('%s.radius_z' % self.handle, radius_b) canvas.setParam('%s.contrast' % self.handle, 1.0) self.canvas = canvas
def setUp(self): """ Set up ellipsoid """ radius_a = 10 radius_b = 15 density = 5 self.ana = EllipsoidModel() self.ana.setParam('scale', 1.0) self.ana.setParam('background', 0.0) self.ana.setParam('sld', 1.0) self.ana.setParam('sld_solvent', 1.0) self.ana.setParam('radius_polar', radius_a) self.ana.setParam('radius_equatorial', radius_b) canvas = VolumeCanvas.VolumeCanvas() self.handle = canvas.add('ellipsoid') canvas.setParam('lores_density', density) canvas.setParam('scale', 1.0) canvas.setParam('background', 0.0) canvas.setParam('%s.radius_x' % self.handle, radius_a) canvas.setParam('%s.radius_y' % self.handle, radius_b) canvas.setParam('%s.radius_z' % self.handle, radius_b) canvas.setParam('%s.contrast' % self.handle, 1.0) self.canvas = canvas self.ana.setParam('theta', 1.57) self.ana.setParam('phi', 0) self.canvas.setParam('%s.orientation' % self.handle, [0, 0, 0])
def setUp(self): radius = 15 thickness = 5 core_vol = 4.0/3.0*math.pi*radius*radius*radius outer_radius = radius+thickness shell_vol = 4.0/3.0*math.pi*outer_radius*outer_radius*outer_radius - core_vol self.shell_sld = -1.0*core_vol/shell_vol self.canvas = VolumeCanvas.VolumeCanvas() self.canvas.params['lores_density'] = 0.1 # Core shell model sphere = CoreShellModel() sphere.setParam('scale', 1.0) sphere.setParam('background', 0.0) sphere.setParam('sld_core', 1.0) sphere.setParam('sld_shell', self.shell_sld) sphere.setParam('sld_solvent', 0.0) # Core radius sphere.setParam('radius', radius) # Shell thickness sphere.setParam('thickness', thickness) self.sphere = sphere self.radius = radius self.outer_radius = outer_radius
def get_panels(self, parent): """ Create and return a list of panel objects """ self.parent = parent # 3D viewer self.plotPanel = SimCanvas.SimPanel(self.parent, -1, style=wx.RAISED_BORDER) # Central simulation panel self.paramPanel = ShapeParameters.ShapeParameterPanel( self.parent, q_min=self.q_min, q_max=self.q_max, q_npts=self.q_npts, pt_density=DEFAULT_PT_DENSITY, style=wx.RAISED_BORDER) # Simulation self.volCanvas = VolumeCanvas.VolumeCanvas() self.volCanvas.setParam('lores_density', DEFAULT_PT_DENSITY) self.adapter = ShapeAdapter.ShapeVisitor() self._data_1D = None self.calc_thread_1D = None self.speedCheck = False self.speed = 3.0e-7 # Q-values for plotting simulated I(Q) step = (self.q_max - self.q_min) / (self.q_npts - 1) self.x = np.arange(self.q_min, self.q_max + step * 0.01, step) # Set the list of panels that are part of the simulation perspective self.perspective = [] self.perspective.append(self.plotPanel.window_name) self.perspective.append(self.paramPanel.window_name) # Bind state events self.parent.Bind(ShapeParameters.EVT_ADD_SHAPE, self._onAddShape) self.parent.Bind(ShapeParameters.EVT_DEL_SHAPE, self._onDelShape) self.parent.Bind(ShapeParameters.EVT_Q_RANGE, self._on_q_range_changed) self.parent.Bind(ShapeParameters.EVT_PT_DENSITY, self._on_pt_density_changed) return [self.plotPanel, self.paramPanel]
def setUp(self): """ Set up zero-SLD-average core-shell model """ radius = 15 thickness = 5 density = 5 core_vol = 4.0 / 3.0 * math.pi * radius * radius * radius self.outer_radius = radius + thickness shell_vol = 4.0 / 3.0 * math.pi * self.outer_radius * self.outer_radius * self.outer_radius - core_vol self.shell_sld = -1.0 * core_vol / shell_vol self.density = density # Core-shell sphere = CoreShellModel() sphere.setParam('scale', 1.0) sphere.setParam('background', 0.0) # Core radius sphere.setParam('radius', radius) # Shell thickness sphere.setParam('thickness', thickness) sphere.setParam('sld_core', 1.0) sphere.setParam('sld_shell', self.shell_sld) sphere.setParam('sld_solvent', 0.0) self.ana = sphere canvas = VolumeCanvas.VolumeCanvas() canvas.setParam('lores_density', self.density) canvas.setParam('scale', 1.0) canvas.setParam('background', 0.0) handle = canvas.add('sphere') canvas.setParam('%s.radius' % handle, self.outer_radius) canvas.setParam('%s.contrast' % handle, self.shell_sld) handle2 = canvas.add('sphere') canvas.setParam('%s.radius' % handle2, radius) canvas.setParam('%s.contrast' % handle2, 1.0) self.canvas = canvas
def setUp(self): """ Set up canvas """ self.model = VolumeCanvas.VolumeCanvas() handle = self.model.add('sphere') radius = 10 density = .1 ana = SphereModel() ana.setParam('scale', 1.0) ana.setParam('background', 0.0) ana.setParam('sld', 1.0) ana.setParam('sld_solvent', 0.0) ana.setParam('radius', radius) self.ana = ana self.model.setParam('lores_density', density) self.model.setParam('scale', 1.0) self.model.setParam('background', 0.0) self.model.setParam('%s.contrast' % handle, 1.0) self.model.setParam('%s.radius' % handle, radius)
def setUp(self): self.canvas = VolumeCanvas.VolumeCanvas()
def setUp(self): self.model = VolumeCanvas.VolumeCanvas() self.model.add('cylinder', 'cyl') self.model.add('sphere', 'sph') self.model.add('ellipsoid', 'elli') self.model.add('singlehelix', 'shelix')
def setUp(self): self.canvas = VolumeCanvas.VolumeCanvas() self.canvas.params['lores_density'] = 0.05