<- system.file("extdata/custom_cary.csv", package = "eemR")
file
cat(readLines(file, n = 25L), sep = "\n")
Wavelength (nm),Intensity (a.u.),Z Axis,
01_SYN_50.00,01_SYN_55.00,01_SYN_60.00,01_SYN_65.00,01_SYN_70.00,01_SYN_75.00,01_SYN_80.00,01_SYN_85.00,01_SYN_90.00,01_SYN_95.00,01_SYN_100.00,01_SYN_105.00,01_SYN_110.00,01_SYN_115.00,01_SYN_120.00,01_SYN_125.00,01_SYN_130.00,01_SYN_135.00,01_SYN_140.00,01_SYN_145.00,01_SYN_150.00,01_SYN_155.00,01_SYN_160.00,01_SYN_165.00,01_SYN_170.00,01_SYN_175.00,01_SYN_180.00,01_SYN_185.00,01_SYN_190.00,01_SYN_195.00,01_SYN_200.00,01_SYN_205.00,01_SYN_210.00,01_SYN_215.00,01_SYN_220.00,01_SYN_225.00,01_SYN_230.00,01_SYN_235.00,01_SYN_240.00,01_SYN_245.00,01_SYN_250.00,01_SYN_255.00,01_SYN_260.00,01_SYN_265.00,01_SYN_270.00,01_SYN_275.00,01_SYN_280.00,01_SYN_285.00,01_SYN_290.00,01_SYN_295.00,01_SYN_300.00,01_SYN_305.00,01_SYN_310.00,01_SYN_315.00,01_SYN_320.00,01_SYN_325.00,01_SYN_330.00
,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57
,250,1.85870516300201,2.80107355117798,3.22146272659302,3.60980105400085,4.71845960617065,5.5966010093689,6.45598602294922,7.89595937728882,10.0022115707397,12.8900260925293,16.6048526763916,21.7009887695313,26.7308120727539,33.5129280090332,39.6480255126953,46.94189453125,52.1451263427734,59.4381446838379,63.8430557250977,71.0080108642578,74.9123001098633,80.2605209350586,84.8504257202148,87.1108627319336,87.6054077148438,89.1303558349609,88.1718978881836,89.9914093017578,90.4588851928711,90.4412231445313,91.7687301635742,88.9126510620117,88.2239227294922,83.9044876098633,81.0552597045898,76.6695327758789,72.4987258911133,68.7890853881836,65.8365325927734,91.5800476074219,109.421615600586,93.5778274536133,53.0399932861328,44.5870552062988,40.4739570617676,37.5545845031738,33.1918907165527,30.9178428649902,30.7513618469238,28.8479671478271,26.2540702819824,22.5371971130371,19.1686763763428,16.6529712677002,14.7242202758789,13.7677135467529,12.4740467071533
252.029998779297,2.1434018611908,3.11827969551086,3.62917947769165,4.18700551986694,5.13205671310425,6.11557626724243,7.16383838653564,8.7924222946167,10.8015441894531,13.4013109207153,17.4247570037842,22.7168807983398,28.294412612915,34.4576759338379,40.9357948303223,47.6901092529297,52.4071464538574,59.475528717041,64.4546813964844,70.2739791870117,75.7940139770508,79.9471435546875,83.4396667480469,85.106819152832,85.8016052246094,88.5793075561523,89.0074234008789,90.2360687255859,89.7650833129883,89.8542327880859,89.0672988891602,86.7302703857422,85.7473220825195,82.5640640258789,78.6254653930664,74.7004547119141,70.4368133544922,66.7534103393555,63.1299095153809,68.2004776000977,97.5321884155273,110.740531921387,60.1052017211914,44.5394287109375,39.8698654174805,36.2816505432129,33.5453300476074,30.2543392181396,28.1765575408936,25.9400939941406,25.5557174682617,22.9261245727539,18.3974666595459,15.442798614502,14.079273223877,13.2750692367554,11.3828964233398
254.059997558594,2.67089176177979,3.40243530273438,4.01974630355835,4.44969749450684,5.22138166427612,6.35891437530518,7.62873458862305,8.98092174530029,11.4190607070923,14.5513143539429,18.3162021636963,22.9994773864746,29.7316246032715,35.4233589172363,40.9313850402832,47.1130867004395,52.6845245361328,57.915599822998,64.2642211914062,69.621696472168,75.6429672241211,79.4112930297852,81.478271484375,82.5389556884766,83.7636108398438,85.4523010253906,86.0060958862305,87.1970748901367,86.3537292480469,87.5455551147461,88.1553192138672,85.58642578125,82.3766632080078,80.1367340087891,76.2343978881836,72.2738418579102,69.6762390136719,63.6211624145508,60.3295249938965,57.2498016357422,83.7615737915039,99.1347885131836,79.7561416625977,50.3657913208008,38.2091522216797,34.9725761413574,31.6794929504395,29.0758800506592,25.7576103210449,24.2810916900635,24.3023662567139,22.0833225250244,18.9265155792236,16.1673259735107,14.3542861938477,12.8271722793579,11.319299697876
255.929992675781,2.72522306442261,3.28733682632446,4.19300174713135,4.97215986251831,6.1463885307312,7.02236175537109,7.71991062164307,9.6124849319458,11.823860168457,15.4190979003906,19.5648899078369,24.0559177398682,28.3993949890137,35.6616325378418,40.9907379150391,46.2872734069824,51.7886924743652,57.424259185791,62.3483505249023,67.7299957275391,72.0610275268555,75.5730285644531,78.332405090332,80.6701889038086,81.3849716186523,83.3349380493164,83.8467254638672,84.6118087768555,84.9456100463867,84.2068939208984,84.434455871582,82.4365921020508,79.8226165771484,76.500732421875,73.765251159668,68.90869140625,65.3082122802734,61.8021774291992,57.9347038269043,54.6737518310547,61.3831558227539,83.2965927124023,95.8872299194336,72.8872985839844,37.6438446044922,32.7891044616699,29.4536170959473,26.5586490631104,24.3266563415527,22.6301803588867,21.189245223999,20.526050567627,19.40260887146,16.4672718048096,13.1716690063477,11.8394460678101,10.4384927749634
257.959991455078,3.21290683746338,3.98891663551331,4.72322702407837,5.63693141937256,6.4882287979126,7.45437288284302,8.90002632141113,10.663013458252,13.262001991272,16.6105194091797,20.4600143432617,25.9285221099854,31.2529468536377,37.0466766357422,42.4403190612793,47.3480987548828,53.1885375976562,58.5294418334961,64.3140335083008,68.8223876953125,71.7386703491211,76.046875,78.0461196899414,80.7746047973633,81.7677764892578,82.95556640625,84.4830169677734,84.428337097168,85.2716369628906,84.8473205566406,84.114616394043,81.9455413818359,80.568977355957,76.8515625,72.9974594116211,68.9783782958984,64.455192565918,60.5049858093262,56.848274230957,52.9985847473145,50.7969512939453,66.1279907226563,105.358459472656,89.5109558105469,39.0232467651367,32.7334098815918,29.4105377197266,26.7679061889648,24.2018451690674,21.8511295318604,20.4381790161133,19.5665378570557,19.1251640319824,17.2594509124756,14.3079223632812,12.1065378189087,10.5271911621094
260,3.41055822372437,3.93557405471802,5.1127781867981,5.9223747253418,6.73870515823364,7.8412184715271,9.4288444519043,11.6463184356689,14.1108064651489,17.5000305175781,21.7909755706787,26.9293537139893,32.0226821899414,37.3111724853516,42.6441459655762,47.9842987060547,53.9838218688965,58.4067115783691,62.4811820983887,67.9415283203125,72.0176467895508,74.2498474121094,75.0730209350586,78.44287109375,79.1882476806641,81.2593536376953,81.8445281982422,82.8198699951172,83.2321472167969,83.5785369873047,82.0417556762695,79.4182510375977,76.4430236816406,73.7386322021484,69.5505447387695,64.676383972168,61.7696571350098,57.9401168823242,54.3826103210449,51.0335388183594,47.273078918457,56.4147033691406,113.201438903809,80.7597351074219,39.8838844299316,30.4663391113281,27.8390369415283,25.6157512664795,23.1932373046875,20.8993339538574,18.5871868133545,17.9609069824219,18.4881687164307,16.6580276489258,13.1956052780151,11.5353488922119,9.66449356079102
262.029998779297,3.82153797149658,4.68460035324097,5.47021532058716,6.31838464736938,7.08445405960083,8.41258716583252,9.51007556915283,11.8409414291382,14.6743392944336,18.2979602813721,21.9991550445557,27.3488578796387,32.1398429870605,37.7207489013672,41.5274200439453,47.5885772705078,51.7020034790039,57.099292755127,61.7406425476074,65.6555023193359,69.953987121582,71.0863876342773,72.1729507446289,74.046012878418,76.3831253051758,76.5245666503906,78.6100769042969,78.930061340332,78.9697952270508,78.8229598999023,77.4386367797852,74.3858337402344,72.0304260253906,69.0096817016602,64.5219955444336,61.5817642211914,57.9443168640137,54.1362762451172,50.5893630981445,47.3394966125488,43.4472389221191,49.5518836975098,97.0061645507812,81.2925109863281,47.1760177612305,29.0424575805664,26.0920829772949,23.7819023132324,20.9830074310303,19.6952857971191,17.1577033996582,16.684419631958,16.3815746307373,15.3087348937988,13.0794944763184,10.3042526245117,8.92405891418457
264.059997558594,4.36516094207764,5.05646896362305,5.99236488342285,6.88891792297363,7.66924381256104,8.91412544250488,10.5313968658447,12.7600231170654,15.3796339035034,18.8983612060547,23.2077102661133,27.7346801757813,32.7493743896484,36.8162002563477,40.5715980529785,44.7855911254883,49.5624198913574,55.0984649658203,58.7350540161133,62.1021461486816,64.7838287353516,66.2831573486328,67.974983215332,70.7058715820312,72.8498764038086,73.0734939575195,73.7861175537109,74.3114700317383,73.9988327026367,73.8561782836914,72.9426727294922,70.1829071044922,67.5993118286133,63.5668411254883,60.2468490600586,57.487232208252,53.2839546203613,50.6836357116699,47.6183319091797,43.991138458252,40.4820938110352,41.5865783691406,62.2503547668457,82.8523406982422,69.3785705566406,30.143440246582,24.3638820648193,21.5016860961914,19.6230926513672,17.3148403167725,16.195442199707,14.6696329116821,14.4185476303101,13.9425964355469,13.0310144424438,10.9795207977295,8.76940536499023
265.929992675781,4.78284692764282,5.76570892333984,6.2163519859314,7.07550430297852,8.39108276367187,9.84166526794434,11.565936088562,13.7092056274414,16.5279941558838,19.7648601531982,24.1468276977539,28.073486328125,32.7102127075195,36.1343002319336,40.6638031005859,44.9474601745605,48.9677352905273,54.0034446716309,57.4265022277832,60.7783851623535,63.1089515686035,64.493408203125,66.729118347168,68.4787445068359,69.8424453735352,71.2379989624023,71.7714996337891,72.2129440307617,72.8810653686523,70.9214553833008,70.215950012207,67.907600402832,64.2173004150391,61.1582298278809,57.5839424133301,54.9184608459473,51.5932540893555,49.202579498291,45.0264625549316,42.5927276611328,37.9131355285645,36.7271995544434,45.6402282714844,78.1432647705078,84.2446899414062,38.4780883789063,23.1993026733398,20.8801803588867,19.0665664672852,17.3067398071289,15.101203918457,13.9566831588745,12.7976837158203,12.8941488265991,12.8284616470337,11.0452766418457,8.81198501586914
267.959991455078,5.27589845657349,6.1521725654602,7.36993169784546,7.90959119796753,9.15065383911133,10.7644720077515,12.6431379318237,14.7186260223389,17.5145130157471,20.7577228546143,25.0087203979492,29.0566215515137,33.0576438903809,36.3420867919922,39.9359664916992,44.4382171630859,48.8775634765625,51.8091201782227,56.0869331359863,59.6242942810059,60.5920906066895,62.274055480957,63.9864654541016,65.7647094726563,66.7045593261719,67.7906265258789,68.4980087280273,69.54052734375,69.0837554931641,68.0009613037109,66.1260986328125,63.7568168640137,61.0248680114746,57.8305931091309,54.5320739746094,52.4861183166504,48.8132286071777,45.8495101928711,42.258113861084,39.0966682434082,36.7507438659668,34.2593154907227,33.8393821716309,63.0026969909668,84.1991577148438,56.4019622802734,24.9062767028809,19.6142807006836,18.051815032959,15.8577184677124,14.0769367218018,12.82164478302,11.6376247406006,11.5235414505005,11.8738603591919,10.9061365127563,9.20903587341309
270,6.14943790435791,7.03985548019409,7.82888746261597,8.69509792327881,10.0348987579346,11.407787322998,13.8408660888672,16.1221160888672,19.270845413208,22.557897567749,26.3853607177734,30.0097217559814,33.4600219726562,36.7038192749023,40.4986381530762,44.0181198120117,48.4642143249512,51.684268951416,54.5989532470703,56.839973449707,58.0130996704102,60.3085708618164,61.4368782043457,63.4444274902344,64.6917724609375,65.7073593139648,66.4018783569336,66.8043670654297,67.0418167114258,65.5020904541016,63.2610092163086,60.4115867614746,58.1661643981934,54.9642066955566,52.1002922058105,48.9184417724609,46.8931655883789,43.8339691162109,40.0859375,37.0245361328125,34.6409759521484,31.8849487304687,29.64133644104,46.5233955383301,78.053840637207,78.1692810058594,30.5129566192627,18.7718601226807,16.6673927307129,14.9790945053101,13.4591083526611,12.3086795806885,11.1659564971924,10.3124408721924,10.6833515167236,10.7682857513428,9.91868877410889
272,6.62944889068604,7.28008651733398,8.23663997650146,9.39974975585938,10.8453950881958,12.5571994781494,14.8496608734131,17.1337718963623,20.1834678649902,23.6731014251709,26.8694725036621,30.5808620452881,33.4804801940918,37.2322463989258,40.7571868896484,45.3029975891113,48.3478355407715,51.3533744812012,53.493595123291,55.5847282409668,56.5123901367188,58.6008949279785,59.9544448852539,60.9591674804687,62.7969284057617,63.1091804504394,63.6809539794922,64.250114440918,64.0958023071289,62.4899787902832,59.6733245849609,57.6421966552734,55.0552520751953,52.0735054016113,49.5760650634766,46.2068748474121,43.8879890441895,41.0317001342773,37.9778289794922,35.1745529174805,32.847469329834,30.0689926147461,27.9124813079834,31.8812732696533,69.2128677368164,84.668212890625,41.0692863464355,18.4481716156006,15.9182415008545,13.7189950942993,12.7896699905396,11.7229051589966,10.3710126876831,9.50142669677734,9.04445457458496,9.81654357910156,9.39487934112549
274,7.41603326797485,7.92876625061035,9.13995933532715,10.2568235397339,11.953724861145,13.8516931533813,15.7398204803467,18.3624038696289,21.2710933685303,24.2195739746094,28.0204486846924,31.9226016998291,34.0879936218262,37.4483108520508,40.7658996582031,44.8349075317383,47.6915893554687,50.3293609619141,52.4713935852051,54.3359985351562,55.314868927002,56.9962730407715,58.7051849365234,59.1122741699219,60.3003120422363,60.6139450073242,61.6620941162109,61.2050857543945,60.4748229980469,58.348991394043,56.3800582885742,54.2810173034668,51.5368804931641,48.6399345397949,47.0471572875977,44.1619453430176,40.654842376709,38.0979270935059,35.6526527404785,32.2819633483887,31.1417274475098,28.2369842529297,25.169584274292,25.4083862304687,49.8596458435059,77.0573043823242,57.9296760559082,21.5218982696533,14.3651523590088,13.397910118103,11.8990306854248,10.8816595077515,9.66688537597656,9.02763938903809,8.11851406097412,8.73623752593994,8.61113166809082
276,7.81372547149658,8.81320190429688,9.60810375213623,11.5968799591064,13.3157911300659,14.7510061264038,17.3492660522461,19.8856315612793,22.6171913146973,26.2505836486816,29.3080310821533,32.4245719909668,35.5392189025879,37.9935836791992,42.1229972839355,44.591682434082,47.7093734741211,49.8665771484375,51.4108963012695,51.8842506408691,53.9039878845215,55.3751754760742,56.5443649291992,56.7629547119141,57.7544288635254,58.5337409973145,58.6556930541992,58.5977973937988,57.6518936157227,55.8751831054687,53.748291015625,50.9336585998535,48.9919013977051,46.54736328125,43.7442855834961,41.5843887329102,38.3376770019531,35.5525932312012,33.3607788085937,31.7255821228027,28.9991931915283,26.7983951568604,24.3347206115723,22.1110553741455,31.2014274597168,65.520637512207,72.6701965332031,30.4517059326172,14.4962472915649,12.1989126205444,11.0809707641602,10.0885620117187,9.45803165435791,8.29226207733154,7.64368200302124,7.52702045440674,7.91528081893921
278,8.48977661132813,9.72201824188232,10.9945764541626,12.3502340316772,14.6449317932129,16.5595989227295,18.747974395752,21.2034740447998,24.3064498901367,27.6277103424072,30.4052429199219,33.8209686279297,36.1396217346191,39.385196685791,42.7643585205078,45.4900398254395,47.948673248291,49.6876640319824,50.9636993408203,52.3083076477051,53.5917663574219,54.0611381530762,55.3604202270508,55.7568016052246,56.2939567565918,57.7520179748535,56.8129348754883,56.0606842041016,55.2115783691406,53.1221351623535,50.9379577636719,49.4548149108887,46.8170204162598,44.3587074279785,41.6488952636719,39.3058090209961,36.089183807373,33.8585624694824,31.6063346862793,29.3909339904785,27.0542392730713,24.8800773620605,22.6839694976807,21.0330677032471,21.5759353637695,46.9133758544922,73.185661315918,49.4711151123047,17.0408706665039,11.9908084869385,10.5606393814087,9.47162628173828,8.83677864074707,8.19705486297607,7.32574367523193,6.79376029968262,6.77574682235718
280,9.17060279846191,10.7361602783203,11.9468517303467,13.7060613632202,15.5742597579956,18.0546531677246,20.4713668823242,23.7345409393311,26.4405708312988,29.5096549987793,32.8378601074219,34.5172424316406,38.207218170166,41.8863258361816,44.4178733825684,47.1293525695801,49.3283500671387,50.4015922546387,51.2054824829102,52.1976928710937,53.2793464660645,54.1178741455078,54.5313758850098,54.9432258605957,55.8546295166016,55.7861747741699,55.2872047424316,54.3410720825195,53.1083488464355,51.0687599182129,48.7317733764648,46.8424453735352,44.4959030151367,42.7631225585937,39.6353950500488,37.2586402893066,34.5268287658691,32.335823059082,30.0511512756348,27.9724884033203,25.4165897369385,22.9819965362549,21.0822505950928,19.606632232666,18.7149105072021,29.8068771362305,64.5562973022461,67.0754699707031,25.1678047180176,11.4009189605713,9.83836936950684,9.01907253265381,8.37013435363769,7.81657075881958,7.19332599639893,6.66719484329224,6.11242961883545
282,10.1019287109375,11.5800104141235,12.9970426559448,14.8697080612183,16.7626628875732,19.2185344696045,21.8908138275146,24.7509365081787,27.8465919494629,31.2070140838623,34.1463890075684,37.0135650634766,39.6970901489258,43.4160842895508,45.342357635498,47.8797187805176,49.8394889831543,50.3688507080078,50.4839782714844,52.2149238586426,52.8301200866699,53.2352714538574,54.1411628723145,54.8820114135742,54.8560218811035,55.3460540771484,53.9031372070313,53.0047569274902,51.1480407714844,49.4790000915527,46.8833351135254,44.6873245239258,42.497917175293,39.9358444213867,37.9777565002441,35.3452682495117,32.9601249694824,30.4906444549561,28.3763179779053,26.1937122344971,24.0974254608154,21.8326168060303,20.3651542663574,18.9013957977295,17.3187465667725,18.7819938659668,53.0021514892578,71.5673294067383,42.6870040893555,12.9425649642944,9.78479480743408,8.45710563659668,7.94507169723511,7.23891258239746,6.70252704620361,6.16295576095581,5.49235391616821
284,10.4421472549438,12.0179777145386,13.8513479232788,16.1304492950439,18.0575847625732,20.7996673583984,24.1695022583008,26.6093864440918,30.0439910888672,32.5205383300781,35.3260383605957,38.5231170654297,41.2779159545898,44.2526016235352,46.2045631408691,48.5946846008301,50.4220352172852,50.7044219970703,51.5091133117676,51.6817779541016,53.2729721069336,52.9527969360352,53.5108604431152,53.4884338378906,54.0079193115234,53.1847801208496,52.2562294006348,50.9408912658691,48.9856147766113,47.726390838623,44.9403762817383,42.6372413635254,40.4396896362305,38.6279335021973,36.564884185791,33.3923530578613,31.1226139068604,29.0496425628662,26.8141498565674,25.467809677124,23.0671539306641,20.7443943023682,19.1811771392822,17.7717571258545,15.8602781295776,15.4107141494751,35.026912689209,67.0927581787109,60.3559799194336,18.6382484436035,9.50141620635986,8.14902019500732,7.78250789642334,6.95368623733521,6.33366012573242,5.82480907440186,5.3531494140625
286,11.1862163543701,12.5576801300049,14.7683629989624,17.4937152862549,19.7286758422852,22.4737720489502,25.3906593322754,28.5470027923584,31.3895568847656,34.1828346252441,36.8001937866211,40.9202270507812,42.842700958252,45.3932800292969,48.1626968383789,49.2899055480957,50.6819648742676,51.6555786132812,50.9963874816895,51.641471862793,52.2208023071289,52.3825531005859,52.6477203369141,52.536060333252,53.2410163879395,51.7915420532227,50.9816284179687,49.817985534668,48.2453765869141,45.4916687011719,42.9353523254395,40.9983291625977,39.0420150756836,36.6315498352051,34.1375885009766,31.8135585784912,29.7591304779053,27.8124866485596,25.1664371490479,23.2535800933838,21.4422187805176,19.5025844573975,18.1085643768311,16.3618869781494,15.3263788223267,13.9953851699829,21.2125186920166,59.00048828125,67.0372848510742,28.2929344177246,9.06644630432129,7.53646755218506,7.2679705619812,6.53416347503662,5.90030336380005,5.24513149261475,5.02353954315186
288,11.418137550354,13.4024925231934,16.1324062347412,18.5914611816406,20.8604259490967,24.2508201599121,27.0655269622803,30.1565170288086,33.5743141174316,36.5337982177734,38.3620414733887,41.7550888061523,45.4048347473145,47.3766479492188,49.3450202941895,50.6066551208496,51.1274299621582,51.0591278076172,51.7542839050293,51.8490257263184,52.4329261779785,52.7435836791992,51.958667755127,52.1096992492676,51.6449012756348,50.8255767822266,49.5630569458008,48.119441986084,45.8649291992188,43.289966583252,41.3925895690918,39.0771675109863,37.5333633422852,35.1679000854492,32.8708381652832,30.4508457183838,28.3584594726562,26.4721431732178,24.2980518341064,22.1344432830811,20.2115783691406,18.611270904541,17.2335796356201,15.7603769302368,14.0518999099731,13.3108510971069,14.1540794372559,42.4813041687012,63.6471290588379,45.0498695373535,10.7297897338867,7.17738008499145,6.67493677139282,6.13038015365601,5.46122550964355,5.14815235137939,4.59314632415771
290,12.3915195465088,14.5368547439575,16.925220489502,19.987886428833,22.2329254150391,25.9109668731689,28.910343170166,32.4790954589844,35.4773635864258,38.0293235778809,40.3983268737793,43.6618843078613,46.437801361084,49.0418014526367,50.770393371582,51.6063423156738,51.665714263916,52.2079315185547,52.2347183227539,52.7055702209473,52.302661895752,52.0769920349121,52.2918472290039,52.1205558776855,51.725341796875,50.3940391540527,48.1075820922852,46.3073348999023,44.0949325561523,42.2608528137207,40.0914421081543,37.5530967712402,35.2090759277344,33.1373252868652,30.7469062805176,28.5165481567383,26.9057102203369,25.0044822692871,23.2345237731934,20.8397541046143,19.2261028289795,17.8055305480957,16.3429832458496,15.173300743103,13.3189630508423,12.1194944381714,11.6675472259521,22.9568252563477,61.9389266967773,54.2313270568848,16.8328342437744,7.14372968673706,6.36283874511719,5.68834257125854,5.20053243637085,4.70265054702759,4.49306154251099
292.029998779297,12.5515785217285,15.2342157363892,17.860668182373,20.7128601074219,24.3374519348145,27.5379524230957,31.0039157867432,34.2450523376465,36.4704704284668,40.5526542663574,43.319953918457,46.0796546936035,48.8112182617188,50.504524230957,51.8680000305176,52.7387886047363,52.4364356994629,52.8608703613281,52.6561698913574,52.7649803161621,52.4214401245117,52.9266395568848,52.6539840698242,51.4566917419434,50.7894897460937,49.0688552856445,47.0725212097168,44.8861274719238,42.5015525817871,40.313404083252,39.0502815246582,36.427318572998,34.2075347900391,31.843147277832,29.8690223693848,27.5666332244873,25.7452583312988,23.8300094604492,22.0810394287109,20.0860576629639,18.3934192657471,17.1226806640625,15.5786418914795,14.1440734863281,12.6415157318115,11.5818395614624,10.4505929946899,13.283164024353,48.3891334533691,58.9646949768066,29.2827930450439,8.54113674163818,5.85121726989746,5.40816020965576,4.68171501159668,4.27833843231201,3.89794135093689
When eemR
was originally created, I wrote few functions to import eems derived from the spectrofluorometers I knew. Given the high diversity in file formats, eemR
now offers the possibility for the users to write their own import function.
Introduction
In this example, we will learn how to create a import function for a specific eem file generated by the software of a Cary Eclipse spectrofluorometer. First, lets have a look to the content of custom_cary.csv
.
Example: Importing Cary Eclipse Spectrofluorometer Data
From this output, we see that:
- The emission wavelengths are contained in the first column (250, 252, …).
- The excitation wavelengths are in the first row (50, 55, …). They are offsets to be applied to each excitation. For examples:
- The emissions at excitation 250 nm are 250 + 50, 250 + 55, 250 + 60, …
- The emissions at excitation 252 nm are 252 + 50, 252 + 55, 252 + 60, …
- The fluorescence data start at row 3 and column 2.
Function Requirements
The first thing we need to do is to create a function that will read this data in a format that can be used by eemR
. The function needs to meet these flowing criteria:
- Have an argument
file
that will contains the path of the file(s) to read. - Return a list containing the flowing elements:
-
file
: the path of the file -
em
: a numeric vector containing emission wavelengths. -
ex
: a numeric vector containing excitation wavelengths. -
x
: a matrix oflength(em)
rows bylength(ex)
columns.
-
Further more, the x
matrix of the list need to be arranged as follow:
Let’s now write a function that will read the eem file and format the data accordingly. In this particular example, fluorescence has been measured in asynchronous mode. Hence, extra manipulations are needed to get the data on a regular grid.
Writing the Import Function
library(dplyr)
library(tidyr)
library(eemR)
import_cary <- function(file) {
dat <- read.csv(file, nrows = 102L, skip = 1L)
ex <- na.omit(dat[, 1L])
em <- seq(50L, 330L, by = 5L)
em <- outer(ex, em, "+")
em <- as.vector(em)
ex <- rep(ex, 57L)
x <- dat[, -1L]
x <- x[-1L, ]
x <- matrix(
as.numeric(unlist(x, use.names = FALSE)),
ncol = 101L,
byrow = FALSE
)
res <- tibble(ex, em, x = as.vector(x)) |>
arrange(ex, em) |>
complete(ex, em, fill = list(x = NA))
ex <- sort(unique(ex))
em <- sort(unique(em))
x <- matrix(res$x, ncol = length(ex), byrow = TRUE)
# We need to interpolate because you do not have a regular grid (i.e.
# asynchronous)
r <- MBA::mba.surf(
res |> drop_na(),
no.X = 200L,
no.Y = 200L,
extend = FALSE
)
l <- list(
file = file,
x = t(r$xyz.est$z),
ex = r$xyz.est$x,
em = r$xyz.est$y
)
l
}
We can now try our function and have a look to the structure of the returned list.
Testing the Import Function
str(import_cary(file))
#> List of 4
#> $ file: chr "/home/runner/work/_temp/Library/eemR/extdata/custom_cary.csv"
#> $ x : num [1:200, 1:200] 1.91 2.29 2.73 3.04 3.27 ...
#> $ ex : num [1:200] 250 251 252 253 254 ...
#> $ em : num [1:200] 300 302 305 307 310 ...
We will use the import_function
argument of the eem_read()
function to tell eemR
how to read our file.
eem <- eem_read(file, import_function = import_cary)
eem
#> sample ex_min ex_max em_min em_max is_blank_corrected
#> 1 custom_cary 250 450 300 780 FALSE
#> is_scatter_corrected is_ife_corrected is_raman_normalized
#> 1 FALSE FALSE FALSE
We can visualize the eem by using the plot()
function:
Visualizing the EEM Data
plot(eem)
Using Other Functions in eemR
# Remove second order Rayleigh scattering
plot(eem_remove_scattering(eem, "rayleigh", order = 2L, width = 15L))
# Extract Coble' peaks
eem_coble_peaks(eem)
#> Warning: This metric uses either excitation or emission wavelengths that were
#> not present in the data. Data has been interpolated to fit the requested
#> wavelengths.
#> sample b t a m c
#> 1 custom_cary NA 10.86736 83.44561 61.2534 49.55256