OPSIALManual
v1.0
©2016XiaofengTan.AllRightsReserved
2
1.Introduction.............................................................................................................................................31.1SpectralCalculator&Fitter(SCF)..........................................................................................31.2AutomatedAnalyzer(AA)..........................................................................................................3
2.WorkingPrinciplesandWorkflowsofOPSIAL.........................................................................42.1RTModel...........................................................................................................................................42.1WorkflowofSCF.............................................................................................................................52.2WorkflowofAA..............................................................................................................................5
3.Tutorial...................................................................................................................................................10References..................................................................................................................................................13
3
1.Introduction OPSIAL(OpticalPlasmaSpectralCalculatIonAndParametersRetrievaL)is
softwarepackageforcalculatingemissionspectraofplasmasandforautomaticallydeterminingchemicalspeciesandimportantplasmaparameters(i.e.,chemicalspecies,mixingratios,plasmaLTEtemperature,andelectrondensity)ofaplasmafromitsemissionspectra.Itiscomprisedoftwomajorcomponents:1)SpectralCalculator&Fitter,2)AutomatedAnalyzer.
1.1SpectralCalculator&Fitter(SCF)TheSCFusesanultra-fastline-by-line(LBL)radiationtransport(RT)algorithm
developedbyDr.Tan(Tan,X.“Anultrafastline-by-linealgorithmforcalculatingspectralTransmittanceandradiance”,J.Quant.Spectrosc.Radiat.Transfer,129,p101–108,2013)forcalculatingemissionspectraofaplasmabasedonlineofsight(LOS)informationoftheplasmaspecifiedbytheuserthroughthegraphicalinterfaceofOPSIAL.HighlightedfeaturesofSCFinclude:
• Anultra-fastLBLalgorithmforperformingaccuratefirst-principlescalculationsofemissionspectraofplasmas.
• Coveringthe150nm–1000nmspectralrange.• IncludingallionicandneutralatomicspeciesintheNISTandCFAatomic
databases.• SupportingmultipleLOSsegments.• SupportingspectralemissioncalculationsforbothLTEandNLTEconditions.• Automaticallyfittingtotheinputplasmaemissionspectrumbyoptimizing
chemicalspeciesmixingratios,temperatures(LTEandNLTE),andpressuresoftheplasma.
1.2AutomatedAnalyzer(AA)TheAAusespatentedtechnology(Tan,X.“Methodforautomatically
determiningchemicalspecies,mixingratios,temperatures,andelectrondensityinplasmasfromobservedemissionspectra”,patentpending#62354170,2016)forautomaticallydeterminingchemicalspecies,mixingratios,plasmaLTEtemperatures,andelectrondensityinaplasmafromitsemissionspectra.Highlightedfeaturesinclude:
• Fullyautomatedanalysisworkflowthatdoesnotrequirehumaninterventions.
• Automaticallyidentifyingchemicalspecies(coveringallatomicspeciesintheNISTandCFAdatabases)inaplasmafromitsemissionspectra.
• Producingquantitativemetricsforthespeciesidentification,includingsensitivityandspecificity.
• Automaticallydeterminingthemixingratiosoftheidentifiedspecies,plasmaLTEtemperature,andelectrondensity.
4
• Automaticallyestimatingwavelengthcorrectionfortheinputemissionspectrum.
• Basedonfirst-principlesmethodsandabuilt-inperformancelibraryanddoesnotrequireuser’strainingofthechemicalidentifier.
• Supportinginputspectrawitheithercalibratedspectralradianceorwitharbitraryspectralradianceunits.
2.WorkingPrinciplesandWorkflowsofOPSIALTheworkingprinciplesandworkflowsoftheOPSIALcodearebrieflydescribedinthismanual.FordetailedinformationonthemethodsusedinOPSIAL,pleaserefertothereferencesinthe‘References’sectionofthismanual.
2.1RTModelTan’s(2003)ultra-fastLBLRTmodelisusedtoquicklycalculateemission
spectraoftheplasma.ThisRTmethodisbasedonfastconvolutionofspectrallineprofileusingtheFastFourierTransform(FFT)method.ThetheoreticalframeworkforapplyingthismethodtotheRTcalculationinOPSIALisbrieflydescribedasfollows.
Solutionstotheequationofradiativetransfer(GoodyandYung1989)for
calculatingspectraltransmittanceandradianceinplasmasrequirecalculationofopticaldepthasafunctionofthepaththoughtheLOS.Innumericalapproaches,thiscalculationisdecomposedintocalculationsoftheopticaldepththroughanumberofhomogenoussegmentsalongtheLOS.WithineachoftheseLOSsegments,temperature,pressure,andspeciesmolefractionsareassumedtobeuniform.InaLBLmodel,thewavelength-dependentopticaldepthforagasmixtureinahomogeneoussegmentisgivenby:
𝜏 𝜈;𝑇,𝑃,𝑈!,𝑈!,⋯ ,𝑈!! = 𝑈! 𝑆!,!𝑉 𝜎!,! , 𝛾!,!; 𝜈 − 𝜈!,!
!!!
!!! , (1)
where𝜏 𝜈;𝑇,𝑃,𝑈!,𝑈!,⋯ ,𝑈!! istheopticaldepththatdependsonthewavenumber𝜈,temperaturesTandtotalpressureP,andthecolumndensities𝑈!,𝑈!,⋯ ,𝑈!! ofthe𝑁!speciesinthesegment;𝑆!,! isthelinestrengthforthei-thlineofspecies𝛼thathas𝑁! linesintotal;𝑉 𝜎!,! , 𝛾!,!; 𝜈 − 𝜈!,! isthelineprofileforthei-thlineofspecies𝛼whosecentralwavenumberis𝜈!,!;𝜎!,! and𝛾!,! aretheDopplerwidthandthecollisionbroadenedhalfwidth(HWHM)forthei-thlineofspecies𝛼,respectively.Forsimplicity,itmaybeassumedinOPSIALthatDopplerandcollisionbroadeningaretheonlylinebroadeningmechanismsintheplasmaandasaresultthelineprofileintheemissionspectrumisVoigt.Thecollisionbroadeningofspectrallinesareattributedtothecollisionsofthecarrierspecieswithgasspeciesandelectronsintheplasma.Thebroadeningwithgasspeciesmaybeapproximatedas:
5
𝛾!,! = 0.08 !!"!!
!.!𝑃, (2)
where𝑇!isthegaskinetictemperatureoftheplasmainKandPisthepressureinatm.Ineq.(2),itisassumedthatallspeciesintheplasmaaresubjecttoasamebroadeningwiththesurroundinggasintheplasma.CollisionbroadeningwithelectronsmaybeobtainedfromvariousexperimentaldatasourcesorfromtheoreticalvaluessuchasthoseintheStark-Bdatabase(http://stark-b.obspm.fr).
Insteadofcalculatingtheopticaldepthusingeq.(1)directly,whichrequiresalot
ofcomputationalpowerwhen𝑁!sarelarge,asolutiontoeq.(1)intheFouriertransformspaceissought.Eq.(1)canbeeasilyrewritteninFouriertransformspaceusingtheconvolutiontheorem:
𝜏 𝑘;𝑇,𝑃,𝑈!,𝑈!,⋯ ,𝑈!! = 𝑈! 𝑆!,!𝑒𝑥𝑝 −𝜎!,!!𝑘! − 𝛾!,! 𝑘 − 𝑖𝑘𝜈!,!
!!!
!!! , (3)
where𝑘istheFouriertransformvariableofwavenumber𝜈.IftheLOSinformation(i.e.,𝑇,𝑃,𝑈!,𝑈!,⋯ ,𝑈!!)andthespectrallineinformation(i.e.,𝑆!,! foralllinesofallspecies)areknown,onecansumoverallthetermsintherightsideofeq.(3)togettheFouriertransformcoefficientsoftheopticaldepthandthenperformsaninverseFouriertransformtogettherealopticaldepth.
2.1WorkflowofSCFTheworkflowofSCFisverystraightforward.ItinvolvesspecifyingLOSparameters(i.e.,species,mixingratios,temperatures,pressures)oftheplasmaforspectralcalculationsintheCalculatormodeorspecifyinganinputspectrumandLOSparameterstobeoptimizedandtheirboundsintheFittermode.Theworkflowsofthetwomodesareself-explanatoryintheOPSIALgraphicfront-end.
2.2WorkflowofAAFig.1depictstheworkflowoftheAAinOPSIAL.Theinputemissionspectrum
(300)iscomprisedofwavelengthandspectralradiancepairsinwhichatleasttwoemissionpeaksarepresent.ThereisnoupperlimittothenumberofemissionpeaksthatcanbehandledbyOPSIAL.Theinputdatacanbeinunitsofcalibratedspectralradianceorinarbitraryunits.Currently,emissionpeaksinthespectralrangeof150nmto1000nmareusedbyOPSIALforanalysis.
ASpectralFeatureExtraction(SFE,302)methodisusedtoextracttheemission
peakinformationfromtheinputspectrum.Itperformsde-noising,emissionpeakidentification,andcontinuumbaselineremovalfromtheinputemissionspectrum.AnimportantaspectoftheSFEisthatitfitstheemissionpeaksintheemissionspectrumtoanappropriatepeakfunctionandaccuratelydeterminethepositions,heights,andwidthsofallemissionpeaksintheinputspectrumthatformthespectralfeatures(304)forfurtheruse.OPSIALusesGaussiantofitallpeaksinthe
6
emissionspectrumforsimplicity.AReferenceSpectralLibrary(RSL,308)isusedinOPSIALandiscomprisedofa
collectionofkeyandvaluepairsforallatomicspeciesintheNISTandHarvardCFAatomicdatabases.OPSIALAAassumestheLTEconditionandasingleLOSsegment.ThekeyfieldofanentryintheRSLiscomprisedofLTEtemperaturesrangingfrom800Kto30000Kwithastepsizeof1000Kandemissioninstrumentslit(Gaussianassumed)widthsrangingfrom0.008cm-1to2.6cm-1inageometricsequencewithacommonratioof2.ThevaluefieldofanentryintheRSLiscomprisedofpeakdescriptionsextractedfromemissionspectracalculatedwiththeRTcodeusingthecorrespondingkeyfieldoftheentryasinputtogetherwithadditionalLOSconditionssuchasLOSlength(e.g.,1cm)andLOSpressure(e.g.,1atm).
Theextractedspectralfeatures(304)oftheinputspectrumarecomparedwith
thevaluefieldsoftheentriesintheRSL.Twopeaksareconsideredapotentialmatchifthedifferenceofthepositionsiswithinawavelengththresholdspecifiedintheadditionalmatchparameters(310)bytheuser.ThelinearcorrelationcoefficientofthepositionsofthepairedpeaksischeckedagainstathresholdspecifiedinthematchparametersandtheentryintheRSLisignoredifthecoefficientdoesnotmeetthethreshold.ForanRSLentrythatpassestheabovecheck,twofeaturevectorsareformedbyOPSIALusingtheintegratedintensitiesofthepeaksintheRSLentryandintheinputspectrum,respectively.Amatchscoreiscalculatedusingthefollowingequation:
𝑆 = 1− !!!!!!
∙ !!(!)!!
(!)!!!!
!!(!)!!
!!! !!(!)!!
!!!
, (4)
where𝑋!
(!)and𝑋!(!)aretheintegratedintensitiesofthepeaksintheinputspectrum
andintheRSLentryinthewavelengthrangeoftheinputspectrum,respectively;N1andN2arethenumberofpeaksintheinputspectrumandintheRSLentry,respectively;andNisthenumberofuniquepeakspresentinboththeinputspectrumandtheentryoftheRSL.Itcanbeseenthateq.(4)isthecosinesimilaritybetweenthetwofeaturevectorstimestheratioofthenumberofcommonpeaksoverthetotalnumberofpeaks.TheminimumnumberofcommonpeaksandthemaximumnumberofthestrongestpeaksintheRSLentrytouseincalculatingmatchscoresarealsospecifiedintheadditionalmathparameters(310).
OPSIALfeaturesaPerformanceLibrary(PL,318)thatisconstructedandtrained
usingresultof~6000randomcomputerexperiments,eachofwhichcontains1to5randomlygeneratedspecieswithrandomlygeneratedmixingratiosandplasmaLTEtemperatures.ThesameLOSconditionsasusedinconstructingtheRSLareusedinthecomputerexperiments.TheresultsoftherandomcomputerexperimentsareusedtogenerateperformancemetricsforthespeciesidentifierofOPSIAL,suchastheTruePositiveRate(TPR)andtheFalsePositiveRate(FPR)asfunctionsofthematchscore.TPRsandFPRsarefittedtoempiricalexpressionsasfollows:
7
𝑇𝑃𝑅 = 1− 𝑆 ∙ 𝑒!!/!!"# , (5)and𝐹𝑃𝑅 = 1− 𝑆 ∙ 𝑒!!/!!"# , (6)
whereSisthematchscore;𝜏!"# and𝜏!"# areconstantstobefitted.Foreachspecies,acutoffmatchscore𝑆!"#$%%isdeterminedaccordingtothefollowingequation:𝑇𝑃𝑅 + 𝐹𝑃𝑅 = 1− 𝑆 𝑒!!!"#$%%/!!"# + 𝑒!!!"#$%%/!!"# = 𝑅 , (7)whereRisathresholdspecifiedbytheuser.InOPSIAL,thematchscoreisconvertedintomatchindexduringspeciesidentification.Thematchindexisdefinedas:𝐼 = 𝑆/𝑆!"#$%% . (8)
OPSIALfeaturesamethodforperformingwavelengthcalibration,LTEtemperaturesestimation,andspeciesidentificationoftheinputspectrum.Theworkflowofthemethodisasfollows.Firstly,peakyspectralfeaturesareextractedbytheSFE.TherelativeintensitiesofthesefeaturesarethencomparedtothoseoftheentriesoftheRSLtocalculatematchscores.Secondly,overallmatchscore(OMS)valuesarecalculatedtofacilitateestimationofplasmaLTEtemperaturesandwavelengthshiftintheinputspectrum.TheOMSisdefinedas:
𝑂𝑀𝑆 𝑇;Δ𝑤 = 𝑆 𝛼;𝑇;Δ𝑤 /𝑁!
!!! , (9)
where𝑂𝑀𝑆 𝑇;Δ𝑤 isafunctionoftheplasmaLTEtemperaturesTandthewavelengthshiftΔ𝑤;𝑆 𝛼;𝑇;Δ𝑤 isthematchscoreofspecies𝛼;andthesummationisoverforallspecies.TheOMS’arecalculatedforalltheLTEtemperaturesintheRSLandforallΔ𝑤sinaspecifiedwavelengthrange.ThewavelengthshiftoftheinputspectrumisestimatedwiththeΔ𝑤associatedwiththelargestOMS.PlasmaLTEtemperaturesisestimatedusingthematch-scoreweightedaverageofallthetemperaturesintheOMS’attheestimatedwavelengthshiftΔ𝑤!:𝑇! = 𝑒 !"# !;!!! ∙!"# !! !"# !;!!!! , (10)where𝑇!istheestimatedplasmaLTEtemperature;Δ𝑤!istheestimatedwavelengthshiftby.Thirdly,aspeciesisidentifiedifitsmatchindexcalculatedfromeqs.(7)and(8)isgreaterthan1.0.Onceaspeciesisidentified,theTPRandFPRfortheidentificationarethencalculatedfromeq.(5),(6),and(8).Finally,foranidentifiedspecies,aspecies-specificwavelengthcalibrationisdeterminedbyfittingtheextractedemissionpeakpositionsofthematchedpeakstothepositionsintheRSLforthatspecificspecies.Afinalwavelengthcalibrationisdeterminedusingthe
8
match-indexweightedaverageofallthespecies-specificwavelengthcalibrations.Theidentifiedspecies,estimatedtemperatureLTE𝑇! ,andguessedinitialmixing
ratios(320),togetherwithadditionalLOSinformation(e.g.,LOSlengthandpressure)(324)specifiedbytheuser,aresenttoaSahaequationsolvercodeandtheRTcode(324)tocalculateanemissionspectrum(326).Thechi-squaredofthedifferenceofthecalculatedspectrumandtheinputspectrumareminimizingbyvaryingthemixingratiosandtheLTEtemperatureusingagradient-descentbasedoptimizer.ThefinalmixingratiosandLTEtemperaturearedeterminedwhentheoptimizationconverges.TheelectrondensityoftheplasmaisdeterminedbysolvingtheSahaequationattheseconditions.
9
Figure1.FlowchartoftheAutomatedAnalyzer.
Spectralfeatureextraction
Calculatematchscores
Emissionspectrumofplasma
Spectralfeatures
Matchparameters
Referencespectrallibrary
Matchscores
IdentifySpeciesandestimatetemperatures Performance
library
Species,temperature,andmixingratios
SolveSahaequationandcalculateemissionspectrumwithRTcode
Calculatedemissionspectrum
Plasmaparameteroptimization
AdditionalLOSinformation
Emissionspectrumofplasma
Converged?
Plasmaparameters
300
Yes
No
302
304
322
310
318
324
320
308
312
330
332
326
306
314
328
Performanceparameters
316
10
ItisimportanttonotethattheconstructionofthePLofOPSIALisavery
time-consumingprocessandthatresultsofmorerandomlycomputersimulationsarestillbeingconstantlyaddedtothePLtoimprovetheaccuracyofthespeciesidentifierofOPSIAL.Asaconsequence,itisimportantfortheusertokeepupdatingthePLcomeswithareleaseofOPSIAL.
3.TutorialInthistutorial,wearegoingtoanalyzethefirstLIBSspectrumofMarstakenby
theChemCaminstrumentboardingtheNASAroverCuriosity*.Thespectrumcanbeseenonlineathttp://www.msl-chemcam.com/blog/chemcams-first-spectrum/.
Step1.StartOPSIALandselecttheAutomatedAnalyzertabsothatwecanhaveOPSIALautomaticallydeterminespecies,mixingratios,temperature,andelectrondensity.LoadfileMars_First_Spectrum_part.datinsidepathexamples/ChemCamoftheOPSIALinstallationdirectory.Thisspectrumcoversthe240–340nmspectralrange.SelectArbitraryUnitsintheSpectrumRadianceUnitstohaveOPSIALusetherelativeintensitiesofthespectrumtoperformanalysis.
Step2.MakesurethefollowingparametersintheAutomatedAnalyzeraresettothefollowingvalues:
• IdentifySpecies&EstimateLTETemperature.CheckthisradioboxtohaveOPSIALidentifyspeciesandestimateplasmaLTEtemperature.
• SpectrumSlitWidth:0.2nm.Thisistheslitwidthofthespectrumasseenfromthewidthofthepeaksinthespectrum.
• TPR+FPR:1.2.Thisisthethresholdusedineq.(7)forcalculatingcutoffmatchscoresforspecies.
• LOSLengthincm:1.0.ThisisanestimatedLOSlengthoftheplasmacreatedbytheChemCaminstrument.
• LOSPressureinatm:0.06.ThisistheaverageairpressureonthesurfaceofMars.
• NumberofOptimizationIterations:30.ThisisnumberofiterationsforfittingtotheinputspectrumtodeterminethemixingratiosandtheLTEplasmatemperature.
• Min.NumberofPeakstoMatch:4.Thisistheminimumnumberofpeakstomatchbetweentheinputspectrumandaspectruminthereferencelibraryinorderforthereferencespectrumtobeconsideredasapotentialmatchtotheinputspectrum.
*WeareverygratefultoDr.R.C.WiensandDr.A.ShanerfortheassistanceonretrievingthespectrumfromtheChemCamonlinedatabases.
11
OtherparametersontheAutomatedAnalyzershouldnormallytakethedefaultsvaluessincethosearethevalueswithwhichtheOPSIALspeciesidentifieristrained.AscreenshotafterthisstepisshowninFig.2.
Figure2.SettingsofOPSIALinStep2.
Step3.ExecutetheAction|StartCalculation/Analysismenucommandorclickthebuttonwithtwogearsonthetoolbar.OPSIALstartstoidentifyspeciesintheplasmaandestimatestheLTEplasmatemperature.Theresultlookslikethefollowing:****************************************************************OpticalPlasmaSpectralIdentification&AnaLysis(OPSIAL)TheAutonomousSpecies&TemperatureModule(LTEOnly)(c)2016XiaofengTan,Ph.D.,AllRightsReserved.****************************************************************>>>StartAnalysisat2016-07-07.14:12:03<<<Successfullyread2048linesofdatafrom/Users/xtan/opsial/examples/ChemCam/Mars_First_Spectrum_part1.dat!Identifyingspeciesandestimatingtemperature...Finishedestimatingtemperature!========================================================================Fe 3.36 93% 1% 1.00004e+00*w-9.33909e-03
12
Mg 2.06 95% 5% 9.99984e-01*w+4.18955e-03Si 1.61 99% 8% 1.00026e+00*w-7.16134e-02Ti 1.43 99% 10% 9.99897e-01*w+3.00783e-02Est.T:2.49086e+04KEst.WavelengthScaling:9.99965e-01*w+1.03931e-02========================================================================ItisworthmentioningthatthePLusedbyOPSIALisstillbeingactivelydeveloped(i.e.,moreandmoretrainingdataarebeinggeneratedtotrainthespeciesidentifierandtogenerateupdatedPL).Asaresult,theversionofOPSIALtheuserusesmayproducedifferentspeciesasshownaboveduetothedifferencesbetweenthePLs.
Step4.NowintheAutomatedAnalyzer,checktheradioboxDetermineSpecies,MixingRatios,LTETemperature,andElectronDensityandthenexecutetheAction|StartCalculation/Analysismenucommandorclickthecorrespondingbuttononthetoolbar.ThistimeOPSIALperformsanoptimizationtodeterminethemixingratiosandLTEtemperatureafterthespeciesidentificationandtemperatureestimation.Theresultlookslikethefollowing:
--Segment#1(w/#1nexttothedetector)Information--T=24744.3K,P=0.06ATM,Length=0.01m.MolefractionforFe:9.54716e-06MolefractionforMg:4.61802e-07MolefractionforSi:2.84595e-06MolefractionforTi:2.57678e-06Sumofmolefractions:1.54317e-05Electrondensity=2.74259e+17cm^-3.NotethatthemixingratiosdeterminedwithArbitraryUnitsselectedfortheSpectrumRadianceUnitsintheAutomatedAnalyzerarerelativemixingratiosbutnotabsolutemixingratios.ThecalculatedspectrumwiththeoptimizedmixingratiosandtheplasmaLTEtemperatureisplottedtogetherwiththeinputspectrumareshowninFig.3.
13
Figure3.CalculatedandinputspectrainStep4.
References
Tan,X.“Anultrafastline-by-linealgorithmforcalculatingspectralTransmittanceandradiance”,J.Quant.Spectrosc.Radiat.Transfer,129,p101–108,2013.
Tan,X.“Methodforautomaticallydeterminingchemicalspecies,mixingratios,
temperatures,andelectrondensityinplasmasfromobservedemissionspectra”,patentpending(application#62354170),2016.
Goody,R.M.;Yung,Y.L.Atmosphericradiation:theoreticalbasis,2nded.NewYork:Oxford;1989.