video Head Impulse Test (vHIT)という検査のデータから波を抽出する。
Otometrics ICS Impulse (Video Head Impulse Testing (vHIT))では、詳細データ出力モードで下記の様なデータが出力されるので、 csvTextScanで処理してコンマ毎に区切って配列とする。(サンプルデータ)
Patient Name:,name,name Test Date,3/30/2018 3:18 PM Test Type,Lateral Impulse 1,Direction,Left ,Gain,0.4837 ,Peak Velocity,218.3326 ,Eye,0.641704371383839,2.11709642219835,2.95768035360603,3.14182961672028,6.28835747649499,7.37158040607711,4.00230208459215,1.7021308211183,2.8245832594704,3.62934378384021,1.72937549781364,1.67960347721248,5.19181461233075,5.94618893822202,2.11115201875486,2.72683878440079,5.47940149649712,3.60743605142473,3.19221275380273,4.18161504439649,3.52209679583777,3.63795389767795,4.18368169203732,4.79855737920414,7.88416862355505,10.681749507384,12.4490855227451,17.1213028541785,21.1373016401545,24.2184959926384,31.6160802981424,40.9846036062875,46.4452969111572,48.2528330935939,48.3412680462614,46.9879603925118,45.3279795044368,41.6175787297347,36.9963166328313,32.7584981835162,28.9928224896296,29.0331745087497,29.9313646678466,28.384285362549,24.8054402001721,19.1706784962798,11.148045533721,1.87830098159119,-7.80931431166318,-20.4435403301736,-33.1525799791947,-39.4543234584555,-41.8422437490394,-39.509340700699,-27.6760899861732,13.4469777693756,102.405956367396,197.92924278509,254.895437232525,271.314813654067,260.299130646516,238.327836713582,212.421452136505,182.250747314058,148.467034024519,110.693680307856,67.4617543894508,31.4911757615623,18.2938916004473,22.1312899162427,33.1947832075468,43.4442541744162,48.6156923991415,55.2275183060556,61.8580168888182,61.5470625141709,55.6136900973409,49.7958285482117,48.1421259687465,46.2351064948336,40.0020446622756,33.3935546955584,29.9353621220405,29.3362073104107,29.0755593964792,28.5041785955512,25.9955356395107,22.3953542132698,30.4012036725804,60.9406723580074,108.813124463932,155.389517760235,174.79712157777,152.075949833141,97.081898949849,35.7080264792392,-6.7676840734254,-20.6822867640582,-16.4366418345787,-9.24266782174066,-4.42802533267634,-3.68507674081193,-6.6938289368372,-10.6332429632848,-13.13012996025,-11.5108788374957,-6.04949070665379,-1.95246659091632,-0.390996339861601,3.29196426333403,7.02825103982216,7.46943440895275,7.51391228541526,9.69462888935646,11.4446052228224,10.5802530508044,9.93311164984339,9.45165979633065,6.95652602123951,5.31479152957272,5.04669845661174,7.65402274455096,25.5006028683722,62.1840505199823,100.884752949736,118.026256443418,95.8153232238428,45.8909716082748,4.09190591604773,-12.6299339866024,-11.391938936127,-6.31306111657715,-5.391232066202,-4.29589858406043,-1.31664551003749,-1.35010506338922,-5.14157171094183,-6.95762415735826,-4.11805233701619,-2.24003170647214,-4.07719096738493,-5.85878715752107,-5.30843026196516,-3.80743127671435,-4.35170627520987,-6.36059011892672,-5.72036595276911,-3.0291824942283,-1.95933463848826,-2.15950094456068,-2.70290698017756,-1.86680045360462,-0.759980627665318,-1.49721563640767,-0.67311942107445,3.20970309585868,9.6164057714565,21.7758715182609,43.3839382822411,66.0290615165294,70.5253885151028,49.5916395365201,17.9878624151553,-5.28915567048941,-11.0972625848776,-6.29024463654792,-3.37509026972077,-1.5242900934037,1.83409659563755,1.58789986968843,-2.0820138325645,-3.36179116104292,-2.53207643646872,-2.48993900698559,-1.8043903526946 ,Head,3.55600359016921,3.28744890266921,3.01889421516921,2.75033952766921,2.41464616829421,1.94467546516921,1.74325944954421,1.34042741829421,0.803318043294208,0.400486012044208,-0.0694846910807925,-0.539455394205792,-1.14370344108079,-1.54653547233079,-2.08364484733079,-2.55361555045579,-3.02358625358079,-3.35927961295579,-3.56069562858079,-3.62783430045579,-3.62783430045579,-3.29214094108079,-2.48647687858079,-1.14370344108079,0.736179371419208,3.42172624641921,10.0684547620442,10.0684547620442,18.5950660901692,24.1675758557942,30.7471656995442,38.6695289807942,48.0689430432942,59.2811012464192,72.1717262464192,86.4051246839192,101.645603199544,117.826023121419,134.207859058919,150.321140308919,164.957370777669,178.989353199544,191.611423512044,202.017917652669,209.738864918294,214.774265308919,217.459812183919,218.332614918294,217.929782887044,216.519870777669,214.639987965169,212.222995777669,208.933200855794,204.904880543294,200.272312183919,194.632663746419,187.515964527669,178.989353199544,169.052829762044,157.236423512044,143.875827808919,129.105319996419,113.797702808919,98.1543922620442,82.3768043714192,67.0020485120442,51.9629860120442,38.3338356214192,25.8460426526692,14.7010231214192,4.76449968391921,-4.03066633170579,-11.9530296129558,-19.0697288317058,-25.3807639879558,-31.0204124254558,-35.7872581285808,-39.7484397692058,-42.8368186754558,-45.0523948473308,-46.5965843004558,-47.2679710192058,-46.5965843004558,-46.5965843004558,-45.1195335192058,-43.0382346910808,-37.6000022692058,-34.4444846910808,-31.3561057848308,-27.8648948473308,-24.5079612535808,-20.8824729723308,-17.5255393785808,-14.2357444567058,-11.1473655504558,-8.66323469108079,-6.58193586295579,-5.03774640983079,-4.03066633170579,-3.29214094108079,-2.68789289420579,-2.21792219108079,-1.81509015983079,-1.68081281608079,-1.68081281608079,-1.61367414420579,-1.61367414420579,-1.34511945670579,-0.942287425455792,-0.673732737955792,-0.270900706705792,-0.00234601920579239,0.131931324544208,0.266208668294208,0.467624683919208,0.803318043294208,1.07187273079421,1.40756609016921,1.54184343391921,1.67612077766921,1.87753679329421,2.14609148079421,2.54892351204421,3.01889421516921,3.48886491829421,4.09311296516921,4.56308366829421,4.89877702766921,5.23447038704421,5.63730241829421,5.70444109016921,5.90585710579421,5.90585710579421,5.97299577766921,5.97299577766921,5.70444109016921,5.70444109016921,5.30160905891921,4.89877702766921,4.42880632454421,3.95883562141921,3.48886491829421,3.22031023079421,2.88461687141921,2.54892351204421,2.21323015266921,1.87753679329421,1.47470476204421,1.00473405891921,0.669040699544208,0.400486012044208,0.131931324544208,-0.136623362955792,-0.405178050455792,-0.673732737955792,-1.00942609733079,-1.27798078483079,-1.54653547233079,-1.81509015983079,-1.81509015983079,-2.08364484733079,-2.28506086295579,-2.55361555045579,-2.75503156608079,-2.95644758170579,-3.09072492545579,-3.22500226920579,-3.29214094108079,-3.42641828483079,-3.49355695670579,-3.56069562858079,-3.62783430045579,-3.76211164420579,-3.76211164420579,-3.76211164420579 ,Deleted,No Impulse 2,Direction,Left ,Gain,0.5986 ,Peak Velocity,234.2377 ,Eye,9.62763363757197,8.72691237743854,8.14705034647073,5.85088662779241,2.62438004108619,3.00904468312785,4.30432090063358,5.93749658125704,9.5616440055675,9.96636584964268,7.17735894496909,2.6344039432757,-0.450666402462533,1.64388150348301,5.15099555793359,7.40206259848041,5.93333807563901,2.08955003653054,1.20307742417812,1.71317400315313,2.47611786420914,3.65741856679533,5.23029940776175,9.34404673153975,14.493983756803,16.7171760798723,16.5134009033002,18.4262704062984,24.7927725612146,33.8620583261402,42.8591239636837,51.1180006883334,56.894102505558,61.9045991805872,64.8377934365071,59.0912369065062,50.0602818591828,45.8401577915128,46.4085656510405,45.9753074797537,40.3127751722748,31.9462969246478,24.7136195814564,18.2636919575236,11.8231340829914,7.79207774468662,2.72407031237984,-7.90106941062705,-26.2010234661228,-51.7896859058331,-71.1452043587955,-75.6189996145747,-76.4254131079381,-76.1372082785933,-64.8501212213538,-49.3500458326127,-34.0714364370356,-7.08154956904475,45.8048801763718,127.336153017005,206.606322788715,253.142121596731,263.263989788439,250.178712897763,239.764596801398,241.809176855401,247.175080486764,250.820839628872,253.61130378138,252.040165632654,239.030438287731,211.225204433641,172.185875368483,131.051691347054,95.2213285663599,67.1403406851677,46.4404023128082,36.2269942422159,37.0924701202379,42.841275577912,46.5159050570519,44.5968582432663,39.8665530737757,33.90996853322,28.7668456585696,27.0302342363879,27.2358339597807,26.9225493239272,24.2590663426132,22.2790295249873,22.8934294320573,22.2203514339106,19.1198492520964,17.8887472491448,17.7099220807511,14.2614438260934,9.39676398307926,5.79476997671301,4.56460448518219,4.8826488377352,5.22400372705143,3.69858707881695,-1.01937021570669,-5.39904697148503,-6.40210660048235,-3.92229654499301,-1.84975346197914,-2.36823614946834,-2.35539143262799,-0.718881356932744,0.00580302705807767,-1.69540363331008,-2.20316440725735,-0.746816996474216,0.996396798403955,2.71319305072927,3.98997318599754,3.50577697308364,1.36991476190368,1.7574617811663,3.47246167919011,5.21351886429765,9.14853532375878,11.8149137722727,12.6169293064974,13.8218412836243,13.6953827290026,13.5506577091726,12.931917654648,10.5792180840663,9.60459643754596,9.22511194750502,9.00789174100353,8.56609608485089,4.30370397923797,2.43590671260531,4.84291808661891,8.43028956956425,22.333755784593,37.0761178698447,34.0281429072072,20.7086847726003,9.71524090840972,2.30411054620371,-1.97238957545361,-1.77312929331183,0.343036223256217,0.158542425907179,-0.927828337993232,0.649336415705484,1.84579690373919,0.0134922652509144,-0.82820129475146,-1.37721297925155,-2.20547200466434,-0.6235884695425,1.54461696774027,2.33003048883948,0.574973216070646,-6.78006201056017,-23.2056101744347,-47.5370684579389,-70.7434072418866,-75.2535796585288,-52.6312178789322,-20.7806230253611,1.20172721601172,10.2109040978922,7.69771864119329,1.50903654864545,-1.49997833068222,-2.55000758231536,-1.89268734018301,-2.92207981166252,-4.70767619815597 ,Head,-0.479030589518292,-0.613307933268292,-0.613307933268292,-0.747585277018292,-0.747585277018292,-0.881862620768292,-1.01613996451829,-1.15041730826829,-1.35183332389329,-1.55324933951829,-1.75466535514329,-1.95608137076829,-2.29177473014329,-2.49319074576829,-2.69460676139329,-2.89602277701829,-3.23171613639329,-3.43313215201829,-3.50027082389329,-3.50027082389329,-3.29885480826829,-2.82888410514329,-1.62038801139329,-0.00905988639329239,2.34079362923171,5.49631120735671,9.86032487923171,20.6025123792317,20.6025123792317,32.4860573011067,39.1327858167317,39.1327858167317,46.3837623792317,54.3061256604817,75.3205299573567,88.2111549573567,102.981662769857,119.027805347982,135.611057301107,151.791477222982,168.710422535482,185.830783863607,201.675510426107,215.438938160482,226.248264332357,232.760715504232,234.237766285482,233.969211597982,232.425022144857,228.463840504232,222.354221363607,215.103244801107,206.845188160482,198.519992847982,189.120578785482,179.184055347982,168.173313160482,156.356906910482,143.869113941732,130.374240894857,116.677951832357,103.048801441732,89.8224830823567,77.2004127698567,65.2497291761067,53.7018776136067,42.6911354261067,32.4189186292317,22.8180885511067,13.8215065198567,5.69772722298171,-1.82180402701829,-9.13991926139329,-16.1894798082683,-22.8362083238933,-29.0801048082683,-34.5183372301433,-39.3523216051433,-43.3806419176433,-46.4018821520183,-48.8188743395183,-51.1015891832683,-51.1015891832683,-50.7658958238933,-49.4902610582683,-47.4089622301433,-44.9248313707683,-41.9707298082683,-38.7480735582683,-31.2956809801433,-27.0659446520183,-22.8362083238933,-18.3379173082683,-13.7724876207683,-9.67702863639329,-5.71584699576829,-2.15749738639329,0.796604176106708,3.41501237923171,5.76486589485671,8.04758073860671,9.86032487923171,11.4045143323567,12.6130104261067,13.4186744886067,13.7543678479817,13.8215065198567,13.6872291761067,13.2843971448567,12.6801490979817,11.8744850354817,11.0688209729817,10.0617408948567,8.71896745735671,7.44333269173171,6.23483659798171,4.95920183235671,3.68356706673171,2.34079362923171,1.19943620735671,0.0580787854817076,-0.881862620768292,-1.88894269889329,-2.69460676139329,-3.50027082389329,-4.30593488639329,-4.91018293326829,-5.58156965201829,-5.98440168326829,-6.38723371451829,-6.58864973014329,-6.58864973014329,-6.65578840201829,-6.79006574576829,-6.92434308951829,-6.85720441764329,-2.96316144889329,-2.96316144889329,-2.96316144889329,-2.56032941764329,-2.15749738639329,-1.68752668326829,-1.62038801139329,-1.62038801139329,-1.35183332389329,-1.28469465201829,-1.28469465201829,-1.35183332389329,-1.41897199576829,-1.48611066764329,-1.62038801139329,-1.68752668326829,-1.88894269889329,-2.09035871451829,-2.09035871451829,-2.22463605826829,-2.29177473014329,-2.42605207389329,-2.42605207389329,-2.49319074576829,-2.62746808951829,-2.62746808951829,-2.89602277701829,-2.89602277701829,-2.96316144889329,-3.09743879264329,-3.23171613639329,-3.23171613639329,-3.50027082389329,-3.63454816764329,-3.76882551139329,-3.76882551139329,-3.97024152701829,-3.97024152701829,-3.97024152701829 ,Deleted,No Impulse 3,Direction,Left ,Gain,0.5754 ,Peak Velocity,234.7648 ,Eye,2.79457733040711,-10.5028642324477,-16.2917863409295,-9.16372043854822,-3.91076955369873,7.81352491393041,14.8645286880543,7.89062479898675,6.20214667877074,2.88021139682721,-3.94088501254452,1.65355680529172,5.99473605122322,-1.72788789742286,-5.15925151666881,-2.69101107122298,-1.09068482162455,1.70864303151711,2.21361392344826,-1.87380934778095,-7.60351718715715,-4.4312431790273,7.70858095225567,13.0005342455623,4.27878447722507,-5.40988033895132,2.47292285804809,20.3452339172448,29.8721746842987,28.6603785036355,33.8461937301031,52.3634089321165,67.7439835826197,66.6869583670734,57.749549985984,56.1883104053688,64.970573221196,79.139117379602,85.746706296061,79.7631753191153,62.4754280279193,38.6715943307641,24.7140671604404,19.5447135077792,17.3998107587376,19.5197368567883,6.67855775134693,-27.1920511403332,-62.6723915309841,-86.8022507028802,-101.098840104168,-108.170915722897,-103.042012245388,-91.4404235772559,-76.2289488174141,-52.772930509012,-25.9741191242925,12.8994863112276,71.0093665215606,122.880276527437,146.041511403559,155.228548112379,166.263283208254,178.655606528906,195.643345493692,211.732251070629,229.831781333288,253.720133848412,262.756659373809,252.511622015032,235.777540456998,224.502298030891,218.426976886052,203.472004343011,180.174183929224,154.039611938783,115.424873550787,72.7751471947181,53.846981998639,47.7758857116873,39.8851791145336,39.2814135972634,38.3981610095818,32.8516529235845,30.1960349991158,29.1966646652086,29.008215043455,25.929475567141,20.2113839276904,10.4370231358603,0.945632653521486,10.4867619705792,15.4845830422037,8.48313875893498,17.8231613149689,26.6689919221864,19.7270470879379,11.0331764005207,8.29927363908605,6.93717861750465,1.84603547898452,-2.64215257645847,-3.77017300515141,-6.59104860184289,-10.8652205266728,-9.0814531183356,-1.6063021899976,2.93924747796335,0.785437609722572,-2.89136225681544,3.64387287242742,31.4842373854907,83.1685530797489,146.925540675914,194.631214603901,201.654979375815,165.12227746692,102.815934512157,41.9370383391485,1.37712107219409,-12.7924777281211,-7.63077956690202,0.961013420677684,5.69776076431404,8.74909505572202,8.71252333492339,5.27145093440469,3.55340189422914,3.27543247073923,2.42256753944009,2.26300092476837,2.10687840330013,1.41245244700922,0.645617146820095,0.18091342804697,0.830492283312431,2.8371530483274,5.86954910022876,7.60737505280394,4.30960216588544,-1.2208590938188,-2.4469583164398,0.374226237110263,-0.896166642878764,-7.60659384881143,-8.9516500253151,-6.2043955148869,-5.69093859355862,-5.32168561885572,-6.07497027630765,-6.09354404996748,-3.243219338849,5.29391860015256,24.0774539189549,51.7443052470478,79.9130069788761,87.5979798196923,61.9190380096555,21.5766599898128,-8.13275998864683,-18.9699988430456,-13.6828488332187,-4.31477608866974,-0.794515462189944,-0.138212943921486,-0.844919925232329,-3.90596191225685,-6.8636487458398,-9.21187898172383,-7.69146251597297,-1.3236400855316,3.15013878751742,-0.196742268065477,-5.54567990472497,-5.84041291365798 ,Head,0.182285328450458,0.115146656575458,0.0480079847004576,-0.0191306871745425,-0.153408030924543,-0.287685374674543,-0.489101390299543,-0.690517405924542,-0.891933421549542,-1.09334943717454,-1.42904279654954,-1.83187482779954,-2.03329084342454,-2.50326154654954,-2.77181623404954,-3.10750959342454,-3.37606428092454,-3.91317365592454,-4.24886701529954,-4.58456037467454,-4.58456037467454,-4.45028303092454,-4.11458967154954,-3.04037092154954,-0.891933421549542,2.26358415657546,6.15762712532546,10.9244728284505,16.4969825940755,22.7408790784505,29.7233009534505,38.2499122815755,60.4728126722005,74.1691017347005,88.6710548597005,103.9786720472,119.5548439222,134.795322437825,150.102939625325,165.07486345345,180.449619312825,194.548740406575,207.1036720472,217.3087501722,223.149814625325,226.909580250325,231.5421486097,234.7648048597,234.563388844075,231.877841969075,227.37955095345,220.7999611097,213.079013844075,204.9552345472,196.428623219075,187.4991798597,178.23404314095,168.4317970472,157.891025562825,145.134677906575,131.706943531575,117.876377125325,104.180088062825,90.8194923597005,78.1974220472005,66.2467384534505,55.1017189222005,44.7623634534505,35.4972267347005,27.1720314222005,19.7867775159505,13.2071876722005,7.09756853157546,1.18936540657546,-4.31600568717454,-9.41854474967454,-14.2525291246745,-18.4822654527995,-22.3763084215495,-25.5989646715495,-28.2845115465495,-30.3658103746745,-31.8428611559245,-32.6485252184245,-32.7156638902995,-31.9771384996745,-30.5672263902995,-28.6202049059245,-26.4046287340495,-23.9204978746745,-21.3692283434245,-15.7295799059245,-12.7754783434245,-9.61996076529954,-6.59872053092454,-3.91317365592454,-1.22762678092454,0.987949390950458,3.06924821907546,5.08340837532546,6.82901384407546,8.44034196907546,9.71597673470046,10.7230568128255,11.4615822034505,11.9315529065755,11.9986915784505,11.9986915784505,11.7972755628255,11.3944435315755,10.7901954847005,10.1188087659505,9.31314470345046,8.70889665657546,7.90323259407546,7.09756853157546,6.15762712532546,5.15054704720046,4.07632829720046,3.06924821907546,2.19644548470046,1.18936540657546,0.316562672200457,-0.556240062174542,-1.29476545279954,-1.89901349967454,-2.43612287467454,-2.97323224967454,-3.30892560904954,-3.57748029654954,-3.71175764029954,-3.84603498404954,-3.98031232779954,-4.11458967154954,-4.04745099967454,-4.11458967154954,-4.18172834342454,-4.18172834342454,-4.11458967154954,-4.04745099967454,-4.04745099967454,-3.84603498404954,-3.98031232779954,-3.91317365592454,-3.71175764029954,-3.57748029654954,-3.44320295279954,-3.30892560904954,-3.24178693717454,-3.04037092154954,-3.04037092154954,-3.17464826529954,-3.30892560904954,-3.17464826529954,-3.17464826529954,-3.17464826529954,-3.04037092154954,-3.04037092154954,-2.97323224967454,-3.10750959342454,-2.97323224967454,-2.97323224967454,-2.90609357779954,-2.77181623404954,-2.63753889029954,-2.63753889029954,-2.50326154654954,-2.43612287467454,-2.50326154654954,-2.57040021842454,-2.57040021842454,-2.70467756217454,-2.90609357779954,-3.10750959342454,-3.37606428092454 ,Deleted,No Impulse 4,Direction,Left ,Gain,0.7128 ,Peak Velocity,214.8011 ,Eye,-0.728069825374832,2.07474729788546,2.7116080164291,-1.09009850402489,-3.58546530756722,-2.08884894981296,0.702149226751135,1.31431990433871,0.112073903853304,-1.68138262901449,-3.25907046404989,-2.16790991966906,-0.809705091597246,0.172117430645499,0.732743492605757,-1.06561281641145,-0.977436004399104,0.486046685930733,-0.590201956021262,-2.08012533632628,-1.2623022014893,0.267115817745008,-0.146846537310513,0.513989543980965,3.25188048239076,6.03967561817313,7.38832774558821,8.29773394796272,14.2481742739062,23.7076192997118,32.3516294038898,42.0398016919729,50.6069242002136,57.4952182203898,64.1737957176375,63.9425984628716,57.9486027989064,51.7353777999707,45.4466800772282,40.3257263695362,34.167757367118,26.143268136782,18.9099162623371,12.7616186437444,7.70469619467069,4.07166373032524,-2.12091941435542,-16.3681646184547,-33.543914123642,-45.0670727245948,-47.3476571712479,-42.1437730826504,-36.8790746836485,-27.8393520982679,-0.833317067592808,50.8302504899865,122.904196666757,196.244103525383,248.064846976855,274.222270165116,283.263720817146,283.153965118226,275.03342010669,258.401691469935,237.505295882585,213.125778943241,182.824510343812,146.801397393353,108.532203397519,73.8944148208184,50.6850898487538,41.4455475001165,41.3209018667489,46.6891898681248,54.6220581659615,59.485055944101,58.5435104803549,55.1936546296965,54.0348728077478,53.6451233652124,50.9903288571773,46.1383572531705,39.7881355681233,34.5705162941247,31.7838658064524,29.6881453153483,27.0688916359842,24.3133787639398,21.7383368180597,17.0320285180184,10.1553109477464,6.64777491002275,7.42451812589042,9.21796630036526,9.81315253195114,7.71378472403741,4.35710817987021,-1.49992365320492,-5.63653251744275,-2.43294523736645,0.499115829202637,-0.14092378429333,-0.98090279187355,-0.339624458994529,1.13682827956844,2.31904053891713,4.97274576889652,6.97572637779247,7.80486079812703,9.4707554742867,8.84298391807558,6.94879793993841,8.12877501327346,9.40954362483373,7.65945978708656,6.23915163470789,5.36824108175921,3.87384774061746,2.60455402596597,0.72284730062924,-1.45278507434148,-2.04241154489576,-0.915579009813265,-0.192596976380928,0.413485498445741,0.861573581481496,0.975183183121418,2.09515086210618,2.31740736754721,1.62634013530302,1.67503750776672,-0.0609688672329242,-1.93242068123191,-0.551750888080707,0.863215099994111,-1.18426009650297,-4.04753114908066,-3.94517513895691,-1.57090793191439,-0.585776332840154,-2.61048844059164,-3.37753490112826,-3.4236316577023,-4.37717085132182,-3.30035242474733,-0.977989794706163,1.33029098643607,2.23123209329697,0.415821242672953,-3.18674503479066,-3.59101736640212,0.290718392106654,1.95629220131757,0.980437306270032,-0.609775137673558,-0.736330466511764,2.48093917439497,4.64640073151132,3.4011654090966,1.45773378444085,1.68740408346177,2.29522249873606,-0.0224780896988007,-3.79072887846036,-4.27692747326502,-1.66154420521294,-2.20081082309371,-3.56122720628618,-1.59253628823544,-0.85851515641669,-2.36221072067714,-2.79359337548018,-2.72893228833928,-3.03716056901092,-4.33689297441356 ,Head,-3.60097883170579,-3.73525617545579,-3.93667219108079,-3.93667219108079,-4.00381086295579,-4.20522687858079,-4.33950422233079,-4.47378156608079,-4.74233625358079,-5.01089094108079,-5.27944562858079,-5.54800031608079,-5.88369367545579,-6.28652570670579,-6.62221906608079,-6.82363508170579,-7.22646711295579,-7.49502180045579,-7.83071515983079,-7.96499250358079,-8.09926984733079,-8.09926984733079,-7.76357648795579,-6.75649640983079,-5.14516828483079,-2.52676008170579,0.964450855794208,5.32846452766921,10.5652809339192,16.4734840589192,29.8340797620442,29.8340797620442,37.4207496839192,45.5445289807942,54.3396949964192,64.6790504651692,77.3011207776692,91.6016578870442,107.446384449544,124.163913746419,140.680027027669,156.994724293294,187.542819996419,187.542819996419,200.164890308919,208.355808277669,214.801120777669,214.264011402669,211.175632496419,207.013034840169,202.581882496419,197.412204762044,191.369724293294,184.655857105794,178.076267262044,170.758152027669,162.768650074544,154.510593433919,145.245456715169,134.704685230794,122.955417652669,110.064792652669,96.9727516370442,83.9478492932942,71.1915016370442,58.7037086682942,46.6858864026692,35.0708961682942,24.1272926526692,14.2579078870442,-1.98965070670579,-1.98965070670579,-9.03921125358079,-15.2831077379558,-20.7884788317058,-25.4881858629558,-29.3822288317058,-32.4706077379558,-34.8875999254558,-36.5660667223308,-37.3045921129558,-37.2374534410808,-36.4317893785808,-35.2904319567058,-33.7462425035808,-31.7320823473308,-29.6507835192058,-27.5023460192058,-25.2867698473308,-23.2726096910808,-20.7884788317058,-18.5057639879558,-16.4244651598308,-14.2088889879558,-12.0604514879558,-9.91201398795579,-8.09926984733079,-6.28652570670579,-4.74233625358079,-3.33242414420579,-2.12392805045579,-1.11684797233079,-0.176906566080793,0.494480152669207,0.964450855794208,1.56869890266921,1.83725359016921,2.03866960579421,2.24008562141921,2.30722429329421,2.37436296516921,2.24008562141921,1.90439226204421,1.56869890266921,1.09872819954421,0.763034840169208,0.360202808919208,0.0245094495442075,-0.915431956705792,-1.25112531608079,-1.72109601920579,-2.12392805045579,-2.52676008170579,-2.92959211295579,-3.39956281608079,-4.00381086295579,-4.33950422233079,-4.74233625358079,-5.21230695670579,-5.68227765983079,-5.95083234733079,-6.35366437858079,-6.55508039420579,-6.82363508170579,-7.02505109733079,-7.29360578483079,-7.29360578483079,-7.49502180045579,-7.56216047233079,-7.49502180045579,-7.49502180045579,-7.56216047233079,-7.62929914420579,-7.76357648795579,-7.76357648795579,-7.76357648795579,-7.89785383170579,-7.96499250358079,-8.09926984733079,-8.09926984733079,-8.09926984733079,-7.83071515983079,-7.76357648795579,-7.83071515983079,-7.76357648795579,-7.69643781608079,-7.62929914420579,-7.62929914420579,-7.49502180045579,-7.56216047233079,-7.42788312858079,-7.36074445670579,-7.36074445670579,-7.09218976920579,-6.95791242545579,-7.02505109733079,-6.89077375358079,-6.89077375358079,-6.89077375358079,-6.89077375358079,-7.02505109733079,-7.02505109733079,-7.15932844108079,-7.22646711295579,-7.22646711295579 ,Deleted,No
File ExchangeにあるJean-Luc GOUDIERのコードは、 前後との差が両方とも正になる部分を探すので、同じ値が続いていると検出出来ないが、 その様なデータは稀であるので、今回はこれを使用する。processfile(filename,50,-10,60)のパラメータが順にピーク検出の正の閾値、負の閾値(ここに負を入れると、 ピークが負で底打ちしていなくても検出する)、時間軸の閾値で、スクリプトと同じフォルダにdataというフォルダを作って、検査CSVデータを入れておけば、 それぞれの検査CSVデータに対して処理した結果をoutフォルダ(自動生成)に出力する。PDFの描画では、ピークの順番に描画を変え、ピーク検出結果をCSVに保存する。
function peaks=peak_detect(signal,threshold) // This function detect the peaks of a signal : // -------------------------------------------- // For an input row vector "signal", the function return // the position of the peaks of the signal. // // The ouput "peaks"is a row vector (size = number of peaks), // "peaks"=[] if no peak is found. // // Optional argument "threshold"eliminates the peaks under // the threshold value (noise floor). // // Clipped peaks (more than 2 samples of the signal at the same value) // are not detected. // ------------------------------------------------------------------- // Jean-Luc GOUDIER 11-2011 // ------------------------------------------------------------------- [nargout,nargin] = argn(0); if nargin==2 then ts=threshold; end; if nargin==1 then ts=min(signal); end; [r c]=size(signal); if r>1 then error("Error : signal is not a row vector"); end; Lg=c-1; d_s=diff(signal); dd_s=[d_s(1),d_s(1,:)]; // diff first shift d_s=[d_s(1,:),d_s(Lg)]; // diff size correction ddd_s=[dd_s(1),dd_s(1,1:Lg)]; // diff second shift Z=d_s.*dd_s; // diff zeros peaks=find(((Z<0 & d_s<0)|(Z==0 & d_s<0 & ddd_s>0)) & signal>ts); endfunction // ------------------------------------------------------------------- function processfile(filen,posedge,negedge,defaultedgemintime) file0 = mopen(filen) line0 = mgetl(file0) mclose(file0) linesize = size(line0)(1) ofile = mopen(strsubst(strsubst(filen,".csv",".peak.csv"),"data","out"),"a") close() subplot(3,2,1) f=get("current_figure") f.figure_size=[768 1024]; // width height // Left Right LA RP LP RA for i = 1:linesize if (line0(i) == "") then, continue end str = csvTextScan(line0(i),",",".","string") strlen = size(str)(2) if (strlen == 3) then, if (str(2) == "Direction") then, //printf("[%s]",str(3)) Left Right .. clear linep3 clear linep4 linep3 = csvTextScan(line0(i+3),",",".","string"); // Eye linep4 = csvTextScan(line0(i+4),",",".","string"); // Head 50ms~ >50 global data0 global data1 if(linep3(2) == "Eye") then ; data0 = strtod(linep3); end if(linep4(2) == "Eye") then ; data0 = strtod(linep4); end if(linep3(2) == "Head") then ; data1 = strtod(linep3); end if(linep4(2) == "Head") then ; data1 = strtod(linep4); end datan = data0 * -1. peak0 = peak_detect(data0,posedge) peakn = peak_detect(datan,negedge) printf("%d)", size(peak0)(2)); peakh = peak_detect(data1,50) if(size(peakh) > 0) edgemintime = peakh(1) + 10 else edgemintime = defaultedgemintime end if ( str(3) == "Right") then ; subplot(3,2,1); xtitle("Right"); end if ( str(3) == "Left") then ; subplot(3,2,2); xtitle("Left") ; end if ( str(3) == "LA") then ; subplot(3,2,3); xtitle("LA") ; end if ( str(3) == "LP") then ; subplot(3,2,4); xtitle("LP") ; end if ( str(3) == "RA") then ; subplot(3,2,5); xtitle("RA") ; end if ( str(3) == "RP") then ; subplot(3,2,6); xtitle("RP") ; end peak0f = peak0(find(peak0>edgemintime)) // find positive edge index if( size(peak0f) > 0 ) then, plot(data0,'b') else plot(data0,'r') end plot(data1,'g') for j = 1:size(peak0f)(2) peaknf = peakn(find(peakn>peak0f(j))) // find negative edge index if( size(peaknf) > 0 ) then, plot2d(peak0f(j),data0(peak0f(j)),-1*j-4) plot2d(peaknf(1),data0(peaknf(1)),-2) mfprintf(ofile,"%s,%d,%f,%f,%f,%f\n",str(3),j, peak0f(j),data0(peak0f(j)), peaknf(1),data0(peaknf(1))) end end end end end xs2pdf(0,strsubst(strsubst(filen,"csv","pdf"),"data","out")) mclose(ofile) close() endfunction // mode(0) // echo off funcprot(0) mkdir("data") mkdir("out") filelist = dir("data/*.csv"); for i = 1:size(filelist.name)(1) filename = filelist.name(i) printf("[%s]", filename); processfile(filename,50,-10,60) printf("\n"); end
ピークCSV出力サンプル (ファイル)
Left,1,62.000000,271.314814,100.000000,-20.682287 Left,2,77.000000,61.858017,100.000000,-20.682287 Left,3,95.000000,174.797122,100.000000,-20.682287 Left,4,128.000000,118.026256,132.000000,-12.629934 Left,5,163.000000,70.525389,167.000000,-11.097263 Left,1,65.000000,263.263990,101.000000,4.564604 Left,2,71.000000,253.611304,101.000000,4.564604 Left,1,71.000000,262.756659,93.000000,0.945633 Left,2,118.000000,201.654979,123.000000,-12.792478
Your aim is high and to the right. God gave us two eyes and ten fingers so we will type five times as much as we read. Shlomi Fish -- Shlomi Fish -- Aphorisms Collection ( http://www.shlomifish.org/humour.html#God_gave_us_two_eyes )