def backscatter(mat, e0, nTraj=100000, buildSample=buildBulk, params={}): """backscatter(mat, e0, nTraj=100000, buildSample=buildBulk) Simulate backscatter from the specified material at the specified beam energy.""" defOut = (dtsa2.DefaultOutput if dtsa2.DefaultOutput else dtsa2.reportPath()) monte = nm.MonteCarloSS() monte.setBeamEnergy(epq.ToSI.keV(e0)) p = params.copy() p["Material"] = mat buildSample(monte, (0.0, 0.0, 0.0), p) bs0 = nm.BackscatterStats(monte, 100) monte.addActionListener(bs0) ann = nm.AnnularDetector(1.0e-3, 10, (0.0, 0.0, -1.0e-3), (0.0, 0.0, 1.0)) monte.addActionListener(ann) monte.runMultipleTrajectories(nTraj) tmpFile = jio.File.createTempFile("Backscatter", ".csv", jio.File(defOut)) print u"Results -> %s" % tmpFile fos = jio.FileOutputStream(tmpFile) try: osw = jio.OutputStreamWriter(fos) osw.append("Parameters:\n") osw.append("E0\t%g keV\n" % e0) for k, v in p.iteritems(): osw.append("%s\t%s\n" % (k, v)) ann.dump(osw) osw.flush() bs0.dump(fos) finally: fos.close() return (bs0.backscatterFraction(), bs0.forwardscatterFraction())
def build(monte, chamber, origin, buildParams): p1Mat, p1Radius = buildParams["P1"] p2Mat, p2Radius = buildParams["P2"] separation = buildParams["Separation"] substrate = buildParams["Substrate"] sphere1 = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, p1Radius]), p1Radius) monte.addSubRegion(chamber, p1Mat, sphere1) sphere2 = nm.Sphere(epu.Math2.plus(origin, [separation, 0.0, 2.0 * p1Radius - p2Radius]), p2Radius) monte.addSubRegion(chamber, p2Mat, sphere2) if substrate: monte.addSubRegion(chamber, substrate, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * p1Radius])))
def buildSphere(monte, chamber, origin, buildParams): radius = buildParams["Radius"] subMat = buildParams["Substrate"] mat = buildParams["Material"] coating = buildParams["Coating"] thickness = buildParams["Thickness"] coatSphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + thickness]), radius + thickness) srC = monte.addSubRegion(chamber, coating, coatSphere) sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + thickness]), radius) monte.addSubRegion(srC, mat, sphere) if subMat: monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius])))
def buildEmbeddedSphere(monte, chamber, origin, buildParams): mat = buildParams["Material"] radius = buildParams["Radius"] subMat = buildParams["Substrate"] depth = buildParams["Depth"] sr = monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], origin)) monte.addSubRegion(sr, mat, nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, depth + radius]), radius))
def buildSphere(monte, chamber, origin, buildParams): radius = buildParams["Radius"] subMat = buildParams["Substrate"] mat = buildParams["Material"] sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius]), radius) monte.addSubRegion(chamber, mat, sphere) if subMat: monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius])))
def buildSphere(monte, chamber, origin, buildParams): mat = buildParams["Material"] radius = buildParams["Radius"] coating = buildParams["Coating"] cThick = buildParams["Coating Thickness"] film = buildParams["Film"] fThick = buildParams["Film Thickness"] coatSphere = nm.Sphere( epu.Math2.plus(origin, [0.0, 0.0, radius + cThick]), radius + cThick) srC = monte.addSubRegion(chamber, coating, coatSphere) sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + cThick]), radius) monte.addSubRegion(srC, mat, sphere) monte.addSubRegion( chamber, film, nm.MultiPlaneShape.createFilm( [0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius]), fThick))
def buildEmbeddedCylinder(monte, chamber, origin, buildParams): mat = buildParams["Material"] subMat = buildParams["Substrate"] radius = buildParams["Radius"] depth = buildParams["Depth"] if subMat: sr = monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], origin)) else: sr = chamber end1 = epu.Math2.plus(origin, [0.0, 0.0, depth]) cyl = nm.CylindricalShape(origin, end1, radius); monte.addSubRegion(sr, mat, cyl)
def stemCell(h2oThickness, objMat, objDiameter, objDepth, e0, beamOffset=0.0, detectorDistance=0.008, detectorRadius=0.02, detRingCount=100, nTraj=10000): """stemCell(h2oThickness, objMat, objDiameter, objDepth, e0, [beamOffset=0.0], [detectorDistance=0.008], [detectorRadius=0.02], [detRingCount=100], [nTraj=10000]): Model scattering from a spherical object embedded in a suspended water film. Example: > import dtsa2.stemCell as sc > sc.stemCell(1.0e-6, material("Au",10.0), 2.0e-7, 4.0e-7, 100.0,nTraj=1000)""" monte = nm.MonteCarloSS() monte.setBeamEnergy(epq.ToSI.keV(e0)) beam = nm.GaussianBeam(1.0e-10) beam.setCenter((beamOffset, 0.0, -0.01)) monte.setElectronGun(beam) h2o = d2.material("H2O", 1.0) h2oThickness = max(h2oThickness, objDiameter) objDepth = max(0.5 * objDiameter, min(h2oThickness - 0.5 * objDiameter, objDepth)) h2oSr = monte.addSubRegion( monte.getChamber(), h2o, nm.MultiPlaneShape.createFilm((0.0, 0.0, -1.0), (0.0, 0.0, 0.0), h2oThickness)) monte.addSubRegion(h2oSr, objMat, nm.Sphere((0.0, 0.0, objDepth), 0.5 * objDiameter)) ann = nm.AnnularDetector(detectorRadius, detRingCount, (0.0, 0.0, detectorDistance), (0.0, 0.0, -1.0)) monte.addActionListener(ann) monte.runMultipleTrajectories(nTraj) header = "Parameters:\nWater thickness\t%g nm\nSphere material\t%s\nSphere diameter\t%g nm\nSphere center depth\t%g nm\nBeam offset\t%g nm\nDetector distance\t%g mm\nDetector radius\t%g mm\nE0\t%g keV" % ( 1.0e9 * h2oThickness, objMat.descriptiveString(False), 1.0e9 * objDiameter, 1.0e9 * objDepth, 1.0e9 * beamOffset, 1.0e3 * detectorDistance, 1.0e3 * detectorRadius, e0) print header return (header, ann)
def doMonte(cc): monte = nm.MonteCarloSS() monte.setBeamEnergy(epq.ToSI.keV(e0)) monte.addSubRegion(chamber, cc, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], origin)) # Add event listeners to model characteristic radiation chXR = nm3.CharacteristicXRayGeneration3.create(monte) chTr = nm3.XRayTransport3.create(monte, det, chXR) xrel = nm3.XRayAccumulator3(xrts, "Characteristic") chTr.addXRayListener(xrel) fxg3 = nm3.FluorescenceXRayGeneration3.create(monte, chXR) chSFTr = nm3.XRayTransport3.create(monte, det, fxg3) chSF = nm3.XRayAccumulator3(xrts, "Secondary") chSFTr.addXRayListener(chSF) det.reset() monte.runMultipleTrajectories(nTraj) return (xrel, chSF)
def simLineInMatrix(lin, linMat, blk, blkMat, nmLinWid, umBlock, nPts, trs, outDir, hdr, det, e0, lt, pc, withPoisson=True, nTraj=100, sf=True, bf=True, iDigits=5, bVerbose=False, xtraParams={}): """simLineInMatrix(lin, linMat, blk, blkMat, nmLinWid, umBlock, nPts, trs, outDir, hdr, det, e0, lt, pc, withPoisson=True, nTraj=nTraj, sf=True, bf=True, iDigits=5, bVerbose=False, xtraParams={}) Simulate a line of width `nmLinWid' nm at the center of a block of `umBlock' microns. The line is of material `lin' with a name `linMat'. The block is of material `blk' with a name `blkMat'. We analyze an list `trs' of transitions, writing the K-ratios to a .csv file with a header `hdr'. We use the detector `det', voltage `e0' (kV) and live time `lt' sec and probe current `pc' nA. This will compute the standard spectra, compute the spectra for nPts+1 from -nPts/2 ... 0 ...nPts/2 times the block size. It will then compute the K-ratios for each spectrum and write them to a file `name' in outDir with a header `hdr' that matches the transition order. """ # order is order of trs.. sc = 1.0e-6 # scale from microns to meters for positions lX = [] # an array for postions lKlin = [] # an array for the K-ratio of the line lKblk = [ ] # an array for the K-ratio of the block. Title correspond to hdr string # start clean dt2.DataManager.clearSpectrumList() # create the standards linStd = simulateBulkStandard(lin, linMat, det, e0, lt, pc, withPoisson=True, nTraj=nTraj, sf=True, bf=True, xtraParams={}) dt2.display(linStd) blkStd = simulateBulkStandard(blk, blkMat, det, e0, lt, pc, withPoisson=True, nTraj=nTraj, sf=True, bf=True, xtraParams={}) dt2.display(blkStd) lStd = {"El": dt2.element(linMat), "Spc": linStd} bStd = {"El": dt2.element(blkMat), "Spc": blkStd} stds = [lStd, bStd] # note: put the transitions in this order iCount = 0 for x in range(-nPts / 2, (nPts / 2) + 1, 1): xv = sc * x * umBlock / nPts lX.append(round(x * umBlock / nPts, iDigits)) monte = nm.MonteCarloSS() monte.setBeamEnergy(epq.ToSI.keV(e0)) # use a 1 nm probe beam = nm.GaussianBeam(1.0e-9) monte.setElectronGun(beam) beam.setCenter([xv, 0.0, -0.05]) # createBlock(double[] dims, double[] point, double phi, double theta, double psi) # createBlock - Create a block of: # dimensions specified in dims, # centered at point, # then rotated by the euler angles phi, theta, psi. block = nm.MultiPlaneShape.createBlock( [umBlock * 1.0e-6, umBlock * 1.0e-6, umBlock * 1.0e-6], [0.0, 0.0, 0.5 * umBlock * 1.0e-6], 0.0, 0.0, 0.0) matrix = monte.addSubRegion(monte.getChamber(), blk, block) monte.addSubRegion( matrix, lin, nm.MultiPlaneShape.createBlock( [1.0e-9 * nmLinWid, umBlock * 1.0e-6, umBlock * 1.0e-6], [0.0, 0.0, 0.5 * umBlock * 1.0e-6], 0.0, 0.0, 0.0)) det.reset() # Add event listeners to model characteristic radiation chXR = nm3.CharacteristicXRayGeneration3.create(monte) xrel = nm3.XRayTransport3.create(monte, det, chXR) brXR = nm3.BremsstrahlungXRayGeneration3.create(monte) brem = nm3.XRayTransport3.create(monte, det, brXR) fxg3 = nm3.FluorescenceXRayGeneration3.create(monte, chXR) chSF = nm3.XRayTransport3.create(monte, det, fxg3) brSF = nm3.XRayTransport3.create( monte, det, nm3.FluorescenceXRayGeneration3.create(monte, brXR)) # here is where we run the simulation monte.runMultipleTrajectories(nTraj) spec = det.getSpectrum((lt * pc * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge)) props = spec.getProperties() props.setNumericProperty(epq.SpectrumProperties.LiveTime, lt) props.setNumericProperty(epq.SpectrumProperties.FaradayBegin, pc) props.setNumericProperty(epq.SpectrumProperties.FaradayEnd, pc) props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) spcName = "x = %.3f um" % x epq.SpectrumUtils.rename(spec, spcName) spec = epq.SpectrumUtils.addNoiseToSpectrum(spec, 1.0) # display(spec) a = jmg.compKRs(spec, stds, trs, det, e0) iCount += 1 print(iCount) lKlin.append(round(a[0], iDigits)) lKblk.append(round(a[1], iDigits)) basFile = "%gnm-%s-in-%gum-%s-%gkV-%g-Traj.csv" % ( nmLinWid, linMat, umBlock, blkMat, e0, nTraj) strOutFile = outDir + "/" + basFile f = open(strOutFile, 'w') strLine = hdr + '\n' f.write(strLine) for i in range(iCount): strLine = "%.5f" % lX[i] + "," strLine = strLine + "%.5f" % lKlin[i] + "," strLine = strLine + "%.5f" % lKblk[i] + "\n" f.write(strLine) f.close()
def base(det, e0, withPoisson, nTraj, dose, sf, bf, name, buildSample, buildParams, xtraParams): """base(det, e0, withPoisson, nTraj, dose, sf, bf, name, buildSample, buildParams) represents \ a generic mechanism for Monte Carlo simulation of x-ray spectra. The argument buildSample \ is a method buildSample(monte,origin,buildParams) taking an instance of MonteCarloSS, the \ position of the origin and a dictionary of build parameters. This method should construct \ the sample geometry. The other arguments are the detector, the beam energy (keV), whether \ to add Poisson noise, the number of electron trajectories to simulate, whether to simulate \ characteristic secondary fluorescence and Bremsstrahlung secondary fluorescence, the name \ to assign to the resulting spectrum.""" if e0 < 0.1: raise "The beam energy must be larger than 0.1 keV." if nTraj < 1: raise "The number of electron trajectories must be larger than or equal to 1." if dose <= 0.0: raise "The electron dose must be larger than zero." name = name.strip() if xtraParams.has_key("Postfix"): name = "%s - %s" % (name, xtraParams["Postfix"]) # Place the sample at the optimal location for the detector origin = epq.SpectrumUtils.getSamplePosition(det.getProperties()) # Create a simulator and initialize it monte = nm.MonteCarloSS() if xtraParams.has_key("Gun"): gun = xtraParams["Gun"] gun.setCenter([0.0, 0.0, -0.099]) monte.setElectronGun(gun) if xtraParams.has_key("PosX"): beamX = xtraParams["PosX"] beamY = xtraParams["PosY"] beamZ = xtraParams["PosZ"] beamNM = xtraParams["nmSize"] beam=nm.GaussianBeam(beamNM*1.0e-9) beam.setCenter([beamX, beamY, beamZ]) monte.setElectronGun(beam) chamber = monte.getChamber() if xtraParams.has_key("VP"): pathLength, gas = xtraParams["VP"] dim = 0.5 * nm.MonteCarloSS.ChamberRadius; dims = epu.Math2.plus(epu.Math2.v3(dim, dim, dim), epu.Math2.z3(2.0 * pathLength)) pt = epu.Math2.plus(origin, epu.Math2.z3(0.5 * dim)); shape = nm.MultiPlaneShape.createBlock(dims, pt, 0.0, 0.0, 0.0); msm = nm.BasicMaterialModel(gas); chamber = monte.addSubRegion(chamber, msm, shape); monte.setBeamEnergy(epq.ToSI.keV(e0)) buildSample(monte, chamber, origin, buildParams) # Add event listeners to model characteristic radiation chXR = nm3.CharacteristicXRayGeneration3.create(monte) xrel = nm3.XRayTransport3.create(monte, det, chXR) brXR = nm3.BremsstrahlungXRayGeneration3.create(monte) brem = nm3.XRayTransport3.create(monte, det, brXR) chSF, brSF, bremFluor, charFluor = None, None, None, None hasCharAcc = xtraParams.has_key('Characteristic Accumulator') and xtraParams['Characteristic Accumulator'] if sf or hasCharAcc or xtraParams.has_key("Compton"): charFluor = nm3.FluorescenceXRayGeneration3.create(monte, chXR) if xtraParams.has_key("Compton"): charFluor.setIncludeCompton(True) chSF = nm3.XRayTransport3.create(monte, det, charFluor) hasBremFluorAcc = xtraParams.has_key('Brem Fluor Accumulator') and xtraParams['Brem Fluor Accumulator'] if bf or hasBremFluorAcc: bremFluor = nm3.FluorescenceXRayGeneration3.create(monte, brXR) brSF = nm3.XRayTransport3.create(monte, det, bremFluor) hasTrans = xtraParams.has_key("Transitions") if hasTrans: if xtraParams.has_key("Emission Images"): eis = [] dim = xtraParams["Emission Images"] for xrt in xtraParams["Transitions"]: size = xtraParams["Emission Size"] ei = nm3.EmissionImage3(size, size, xrt) xrel.addXRayListener(ei) if chSF: chSF.addXRayListener(ei) if brSF: brSF.addXRayListener(ei) ei.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim) ei.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim) eis.append(ei) if hasCharAcc: cxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Characteristic", dose * 1.0e-9) xrel.addXRayListener(cxra) hasCharFluorAcc = xtraParams.has_key('Char Fluor Accumulator') and xtraParams['Char Fluor Accumulator'] if hasCharFluorAcc or chSF or sf: cfxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Characteristic Fluorescence", dose * 1.0e-9) chSF.addXRayListener(cfxra) if hasBremFluorAcc or brSF or bf: bfxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Continuum Fluorescence", dose * 1.0e-9) brSF.addXRayListener(bfxra) contImgs = [] if xtraParams.has_key('Continuum Images'): dim = xtraParams['Continuum Images'] size = xtraParams['Continuum Size'] energies = xtraParams['Continuum Energies'] for eMin, eMax in energies: ci3 = nm3.ContinuumImage3(size, size, epq.ToSI.keV(eMin), epq.ToSI.keV(eMax)) ci3.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim) ci3.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim) brem.addXRayListener(ci3) contImgs.append(ci3) doPRZ = xtraParams.has_key("PhiRhoZ") if doPRZ: depth = xtraParams["PhiRhoZ"] prz = nm3.PhiRhoZ3(xrel, origin[2] - 0.1 * depth, origin[2] + 1.1 * depth, 110) xrel.addXRayListener(prz) voxelated = xtraParams.has_key('Voxelated') vox = None if voxelated: dim = xtraParams['Voxelated'] gen = xtraParams['GeneratedV'] size = xtraParams['SizeV'] vox = nm3.VoxelatedDetector((origin[0], origin[1], origin[2] - 0.1 * size), (size, size, size), (dim, dim, dim), gen) xrel.addXRayListener(vox) doTraj = xtraParams.has_key('Trajectories') if doTraj: dim = xtraParams['Trajectories'] size = xtraParams['TrajSize'] ti = nm.TrajectoryImage(size, size, dim) ti.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim) ti.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim) monte.addActionListener(ti) defOut = (dtsa2.DefaultOutput if dtsa2.DefaultOutput else dtsa2.reportPath()) do = ("%s\\%s" % (xtraParams["Output"], dtsa2.normalizeFilename(name)) if xtraParams.has_key("Output") else "%s/%s" % (defOut, dtsa2.normalizeFilename(name))) do = do.replace("\\", "/") fdo = jio.File(do) fdo.mkdirs() doVRML = xtraParams.has_key('VRML') vrmlWr = None if doVRML: vrmlFile = jio.File.createTempFile("vrml", ".wrl", fdo) print "VRML in " + str(vrmlFile) vrmlWr = jio.FileWriter(vrmlFile) vrml = nm.TrajectoryVRML(monte, vrmlWr) vrml.setDisplayBackscatter(False) vrml.setDisplayXRayEvent(True) vrml.setMaxTrajectories(xtraParams['VRML']) vrml.setTrajectoryWidth(1.0e-9) vrml.setMaxRadius(1.0) vrml.setEmissive(True) vrml.addView("Y-Axis", epu.Math2.plus(origin, (0.0, 5.0e-6, 0.0)), origin) vrml.addView("Gun", epu.Math2.plus(origin, (0.0, 0.0, -5.0e-6)), origin) vrml.addView("X-Axis", epu.Math2.plus(origin, (-5.0e-6, 0.0, 0.0)), origin) vrml.renderSample() monte.addActionListener(vrml) scatter = None if xtraParams.has_key("Scatter"): scatter = nm.ScatterStats(epq.ToSI.eV(50.0)) monte.addActionListener(scatter) # Reset the detector and run the electrons det.reset() monte.runMultipleTrajectories(nTraj) # Get the spectrum and assign properties spec = det.getSpectrum((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge)) props = spec.getProperties() props.setNumericProperty(epq.SpectrumProperties.LiveTime, dose) props.setNumericProperty(epq.SpectrumProperties.FaradayBegin, 1.0) props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0) epq.SpectrumUtils.rename(spec, name) if withPoisson: spec = epq.SpectrumUtils.addNoiseToSpectrum(spec, 1.0) printAcc = xtraParams.has_key('Print Accumulators') and xtraParams['Print Accumulators'] if printAcc: sw0 = jio.StringWriter() sw = jio.PrintWriter(sw0) if hasTrans or scatter: pw = None if hasCharAcc or (hasBremFluorAcc and bf) or (hasCharFluorAcc and sf) or scatter: jio.File(do).mkdirs() pw = jio.PrintWriter("%s/Intensity.csv" % do) pw.println(name) if hasCharAcc: pw.println("Characteristic") cxra.dump(pw) if printAcc: sw.println("Characteristic") cxra.dump(sw) if hasBremFluorAcc and brSF and bf: pw.println("Bremsstrahlung Fluorescence") bfxra.dump(pw) if printAcc: sw.println("Bremsstrahlung Fluorescence") bfxra.dump(sw) if hasCharFluorAcc and chSF and sf: pw.println("Characteristic Fluorescence") cfxra.dump(pw) if printAcc: sw.println("Characteristic Fluorescence") cfxra.dump(sw) if printAcc: print sw0.toString() sw.close() sw0.close() if scatter: scatter.header(pw) scatter.dump(pw) if pw: pw.close() imgs = [] if xtraParams.has_key("Emission Images"): nm3.EmissionImageBase.scaleEmissionImages(eis) print eis print do nm3.EmissionImage3.dumpToFiles(eis, do) print u"Writing emission images to %s" % do imgs.extend(eis) if xtraParams.has_key("Continuum Images"): imgs.extend(contImgs) nm3.EmissionImageBase.scaleEmissionImages(imgs) print contImgs print do nm3.ContinuumImage3.dumpToFiles(contImgs, do) print u"Writing continuum images to %s" % do if doPRZ: jio.File(do).mkdirs() pw = jio.PrintWriter(u"%s/PhiRhoZ.csv" % do) prz.write(pw) pw.close() print u"Writing emission images to %s" % do if doTraj: ti.dumpToFile(do) print u"Writing trajectory images to %s" % do if vrmlWr: vrmlWr.close() if vox: jio.File(do).mkdirs() objs = list(vox.getAccumulatorObjects()) xx = {} for obj in objs: iio.write(vox.createXZSum(400, obj), "png", jio.File(do, "Voxelated[XZ,Sum][%s].png" % obj)) iio.write(vox.createXYSum(400, obj), "png", jio.File(do, "Voxelated[XY,Sum][%s].png" % obj)) iio.write(vox.createXZView(400, obj), "png", jio.File(do, "Voxelated[XZ, Max][%s].png" % obj)) iio.write(vox.createXYView(400, obj), "png", jio.File(do, "Voxelated[XY, Max][%s].png" % obj)) vox.writeXZPlanar(400, obj, jio.File(do, "Voxilated[XZ,planar,%s].tif" % obj)) vox.writeXYPlanar(400, obj, jio.File(do, "Voxilated[XY,planar,%s].tif" % obj)) for f in (0.1, 0.5, 0.8, 0.9): iio.write(vox.createXZFraction(400, obj, f), "png", jio.File(do, "Voxelated[XZ,f=%g][%s].png" % (f, obj))) xx[obj] = vox.createRadialCDF(origin, obj) hdr = "Radius" for obj in objs: hdr = "%s\t%s" % (hdr, obj) print hdr first = xx[objs[0]] for i, (d, f) in enumerate(first): ln = "%g" % d for obj in objs: rcdf = xx[obj][i] ln = "%s\t%g" % (ln, rcdf[1]) print ln #if bremFluor: #print "Stats[Scale] = %s" % bremFluor.getScaleStats() return dtsa2.wrap(spec)