Table_extensions.cpp 164 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733
  1. /* Table_extensions.cpp
  2. *
  3. * Copyright (C) 1997-2018 David Weenink, Paul Boersma 2017
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. djmw 20020619 GPL header
  20. djmw 20040113 Added comment header for Peterson& Barney data.
  21. djmw 20040512 Corrected Peterson& Barney ARPABET-labeling.
  22. djmw 20041213 Added Table_createFromWeeninkData.
  23. djmw 20080125 Corrected mislabeling of vowels in the Peterson& Barney dataset according to Watrous
  24. djmw 20080508 Labeling back to original PB article.
  25. djmw 20110329 Table_get(Numeric|String)Value is now Table_get(Numeric|String)Value_Assert
  26. djmw 20131219 Improved Table_scatterPlotWithConfidenceIntervals
  27. */
  28. /* speaker type (m|w|c), sex(m|f), id, vowel_number, vowel_label
  29. F0, F1, F2, F3
  30. */
  31. #include "Discriminant.h"
  32. #include "Formula.h"
  33. #include "GraphicsP.h"
  34. #include "Graphics_extensions.h"
  35. #include "Index.h"
  36. #include "Matrix_extensions.h"
  37. #include "NUM2.h"
  38. #include <ctype.h>
  39. #include "Strings_extensions.h"
  40. #include "SSCP.h"
  41. #include "Table_extensions.h"
  42. static bool Table_selectedColumnPartIsNumeric (Table me, integer column, constINTVEC selectedRows) {
  43. if (column < 1 || column > my numberOfColumns) return false;
  44. for (integer irow = 1; irow <= selectedRows.size; irow ++) {
  45. if (! Table_isCellNumeric_ErrorFalse (me, selectedRows [irow], column)) return false;
  46. }
  47. return true;
  48. }
  49. // column and selectedRows are valid; *min & *max must have been initialized
  50. static void Table_columnExtremesFromSelectedRows (Table me, integer column, constINTVEC selectedRows, double *min, double *max) {
  51. double cmin = 1e308, cmax = - cmin;
  52. for (integer irow = 1; irow <= selectedRows.size; irow ++) {
  53. double val = Table_getNumericValue_Assert (me, selectedRows [irow], column);
  54. if (val < cmin) { cmin = val; }
  55. if (val > cmax) { cmax = val; }
  56. }
  57. *min = cmin;
  58. *max = cmax;
  59. }
  60. /*
  61. The Peterson & Barney data were once (1991) obtained by me (djmw) as a compressed tar-file
  62. by anonymous ftp from ftp://linc.cis.upenn.edu/pub,
  63. However, this site appears no longer to be an anonymous ftp site.
  64. The compressed tar file contained two files: a header file 'pb.header'
  65. and a data file 'verified_pb.data'.
  66. The header file reads:
  67. "This file contains the vowel formant data reported by Gordon E.
  68. Peterson and Harold L. Barney in their classic paper, "Control methods
  69. used in a study of the vowels", JASA 24(2) 175-184, 1952. This data
  70. was supplied in printed form by Ignatius Mattingly, April, 1990.
  71. The data consists of the formant values F0, F1, F2, and F3 for each of
  72. two repetitions of ten vowels by 76 speakers (1520 utterances). The
  73. vowels were pronounced in isolated words consisting of hVd. Of the
  74. speakers, 33 were men, 28 were women and 15 were children. Dr.
  75. Mattingly reported that he obtained from G. Peterson the information
  76. that children speakers 62, 63, 65, 66, 67, 68, 73 and 76 were female.
  77. The data are organized by speaker type, speaker, and vowel into 1520
  78. lines of 8 fields. The fields are: Speaker Type, Speaker Number,
  79. Phoneme Number, Phoneme Label, F0, F1, F2 and F3. The speaker types
  80. are type 1 (men), type 2 (women) and type 3 (children)."
  81. */
  82. autoTable Table_create_petersonBarney1952 () {
  83. integer nrows = 1520, ncols = 9;
  84. conststring32 columnLabels [9] = {U"Type", U"Sex", U"Speaker", U"Vowel", U"IPA", U"F0", U"F1", U"F2", U"F3"};
  85. conststring32 type [3] = {U"m", U"w", U"c"};
  86. // Wrong order before 20080125
  87. // char32 *vowel [10] = {U"iy", U"ih", U"eh", U"ae", U"aa", U"ao", U"uh", U"uw", U"ah", U"er"};
  88. // char32 *ipa [10] = {U"i", U"\\ic", U"\\ep", U"\\ae", U"\\as", U"\\ct", U"\\hs", U"u",
  89. // U"\\vt", U"\\er\\hr"};
  90. conststring32 vowel [10] = {U"iy", U"ih", U"eh", U"ae", U"ah", U"aa", U"ao", U"uh", U"uw", U"er"};
  91. // Watrous IPA symbols
  92. // char32 *ipa [10] = {U"i", U"\\ic", U"e", U"\\ae", U"\\vt", U"\\as", U"o", U"\\hs", U"u", U"\\er"};
  93. // P& B IPA symbols
  94. conststring32 ipa [10] = {U"i", U"\\ic", U"\\ef", U"\\ae", U"\\vt", U"\\as", U"\\ct", U"\\hs", U"u", U"\\er\\hr"};
  95. conststring32 sex [2] = {U"m", U"f"};
  96. struct pbdatum {
  97. short star; /* was there a * in front of the vowel-type? */
  98. short f [4]; /* f0, f1, f2, f3 */
  99. } pbdata [] = {
  100. {0, {160, 240, 2280, 2850}},
  101. {0, {186, 280, 2400, 2790}},
  102. {0, {203, 390, 2030, 2640}},
  103. {0, {192, 310, 1980, 2550}},
  104. {0, {161, 490, 1870, 2420}},
  105. {1, {155, 570, 1700, 2600}},
  106. {1, {140, 560, 1820, 2660}},
  107. {0, {180, 630, 1700, 2550}},
  108. {0, {144, 590, 1250, 2620}},
  109. {0, {148, 620, 1300, 2530}},
  110. {0, {148, 740, 1070, 2490}},
  111. {0, {170, 800, 1060, 2640}},
  112. {1, {161, 600, 970, 2280}},
  113. {1, {158, 660, 980, 2220}},
  114. {0, {163, 440, 1120, 2210}},
  115. {0, {190, 400, 1070, 2280}},
  116. {0, {160, 240, 1040, 2150}},
  117. {0, {157, 270, 930, 2280}},
  118. {0, {177, 370, 1520, 1670}},
  119. {0, {164, 460, 1330, 1590}},
  120. {0, {147, 220, 2220, 2910}},
  121. {0, {148, 210, 2360, 3250}},
  122. {0, {141, 410, 1890, 2680}},
  123. {0, {139, 420, 1850, 2500}},
  124. {0, {136, 500, 1760, 2590}},
  125. {1, {135, 510, 1710, 2380}},
  126. {0, {128, 690, 1610, 2560}},
  127. {0, {131, 700, 1690, 2580}},
  128. {1, {140, 650, 1080, 2420}},
  129. {1, {125, 625, 1060, 2490}},
  130. {0, {140, 650, 1040, 2450}},
  131. {0, {136, 670, 1100, 2430}},
  132. {0, {149, 580, 580, 2470}},
  133. {0, {140, 560, 560, 2410}},
  134. {0, {145, 450, 940, 1910}},
  135. {0, {141, 410, 830, 2240}},
  136. {0, {140, 280, 650, 3300}},
  137. {0, {137, 260, 660, 3300}},
  138. {0, {145, 510, 1210, 1570}},
  139. {0, {145, 510, 1130, 1510}},
  140. {0, {105, 250, 2180, 2680}},
  141. {0, {111, 244, 2300, 2780}},
  142. {0, {100, 400, 1930, 2610}},
  143. {0, {104, 400, 1990, 2700}},
  144. {0, {100, 550, 1810, 2500}},
  145. {0, {95, 540, 1810, 2480}},
  146. {0, {93, 630, 1710, 2400}},
  147. {0, {94, 658, 1755, 2305}},
  148. {1, {100, 600, 1200, 2320}},
  149. {0, {105, 612, 1160, 2350}},
  150. {0, {91, 640, 1080, 2140}},
  151. {0, {94, 720, 1090, 2230}},
  152. {0, {92, 550, 870, 2300}},
  153. {0, {120, 540, 840, 2280}},
  154. {0, {114, 460, 1150, 2290}},
  155. {0, {114, 456, 1030, 2300}},
  156. {0, {112, 340, 950, 2240}},
  157. {1, {112, 326, 900, 2190}},
  158. {0, {100, 500, 1370, 1780}},
  159. {0, {106, 530, 1330, 1800}},
  160. {0, {150, 300, 2240, 3400}},
  161. {0, {156, 280, 2450, 3200}},
  162. {1, {156, 450, 1960, 2400}},
  163. {0, {146, 440, 2050, 2360}},
  164. {0, {130, 570, 1780, 2410}},
  165. {0, {150, 555, 1890, 2440}},
  166. {0, {125, 750, 1610, 2340}},
  167. {0, {136, 770, 1580, 2350}},
  168. {0, {132, 660, 1200, 2330}},
  169. {1, {150, 675, 1140, 2380}},
  170. {0, {125, 750, 1100, 2550}},
  171. {0, {138, 800, 1120, 2500}},
  172. {0, {143, 540, 850, 2320}},
  173. {0, {150, 555, 890, 2370}},
  174. {0, {136, 460, 960, 2210}},
  175. {0, {156, 460, 1000, 2350}},
  176. {0, {140, 380, 950, 2050}},
  177. {0, {148, 385, 850, 2330}},
  178. {0, {150, 590, 1400, 1840}},
  179. {0, {145, 555, 1430, 1730}},
  180. {0, {140, 310, 2310, 2820}},
  181. {0, {131, 260, 2250, 2850}},
  182. {0, {137, 440, 2060, 2640}},
  183. {0, {134, 430, 1880, 2450}},
  184. {0, {140, 580, 1910, 2500}},
  185. {0, {137, 550, 1770, 2400}},
  186. {0, {143, 830, 1720, 2180}},
  187. {0, {135, 750, 1690, 2320}},
  188. {0, {136, 630, 1300, 1950}},
  189. {0, {130, 650, 1170, 2000}},
  190. {0, {131, 760, 1220, 2140}},
  191. {1, {126, 720, 1260, 2020}},
  192. {0, {136, 540, 970, 1980}},
  193. {0, {124, 550, 880, 1950}},
  194. {0, {133, 470, 1040, 1990}},
  195. {0, {132, 490, 990, 1920}},
  196. {0, {141, 380, 950, 2140}},
  197. {0, {133, 330, 800, 2130}},
  198. {0, {143, 560, 1510, 1800}},
  199. {0, {136, 510, 1460, 1700}},
  200. {0, {125, 312, 2350, 2800}},
  201. {0, {119, 330, 2430, 2870}},
  202. {0, {133, 420, 2000, 2660}},
  203. {0, {125, 313, 2000, 2750}},
  204. {0, {120, 600, 1860, 2500}},
  205. {0, {114, 570, 1830, 2570}},
  206. {0, {119, 676, 1670, 2540}},
  207. {0, {125, 725, 1687, 2500}},
  208. {1, {118, 680, 1150, 2560}},
  209. {0, {125, 726, 1270, 2560}},
  210. {0, {125, 740, 1100, 2680}},
  211. {1, {113, 670, 960, 2650}},
  212. {1, {120, 660, 1030, 2690}},
  213. {1, {125, 720, 960, 2700}},
  214. {0, {120, 456, 1080, 2520}},
  215. {0, {120, 450, 1140, 2600}},
  216. {0, {125, 313, 838, 2340}},
  217. {0, {125, 288, 938, 2450}},
  218. {0, {120, 503, 1305, 1775}},
  219. {0, {120, 505, 1320, 1750}},
  220. {0, {186, 320, 2320, 3120}},
  221. {0, {172, 310, 2280, 3020}},
  222. {1, {167, 470, 2000, 2660}},
  223. {0, {170, 410, 2040, 2715}},
  224. {1, {167, 630, 1900, 2860}},
  225. {0, {146, 614, 1840, 2770}},
  226. {0, {143, 740, 1800, 2450}},
  227. {0, {162, 775, 1810, 2200}},
  228. {1, {167, 620, 1240, 2410}},
  229. {0, {160, 640, 1250, 2400}},
  230. {1, {162, 650, 970, 2580}},
  231. {0, {163, 650, 980, 2350}},
  232. {0, {145, 430, 720, 2450}},
  233. {0, {171, 510, 800, 2500}},
  234. {1, {170, 460, 1120, 2150}},
  235. {1, {170, 493, 1120, 2300}},
  236. {0, {175, 380, 1040, 2260}},
  237. {1, {200, 400, 1000, 2350}},
  238. {0, {167, 570, 1300, 1750}},
  239. {0, {157, 565, 1370, 1710}},
  240. {1, {105, 230, 2480, 3200}},
  241. {0, {109, 218, 2380, 3100}},
  242. {1, {110, 320, 2200, 2680}},
  243. {0, {103, 206, 2130, 2570}},
  244. {1, {107, 430, 2100, 2630}},
  245. {1, {105, 515, 1760, 2470}},
  246. {1, {107, 514, 2060, 2600}},
  247. {1, {106, 552, 1820, 2500}},
  248. {0, {108, 640, 1300, 2300}},
  249. {0, {104, 624, 1350, 2410}},
  250. {1, {111, 714, 1170, 2420}},
  251. {1, {97, 650, 1150, 2350}},
  252. {1, {107, 590, 965, 2500}},
  253. {0, {109, 578, 970, 2460}},
  254. {0, {111, 467, 1110, 2400}},
  255. {0, {105, 475, 1220, 2310}},
  256. {0, {107, 270, 910, 2200}},
  257. {0, {108, 260, 975, 2320}},
  258. {0, {107, 460, 1400, 1790}},
  259. {0, {103, 425, 1410, 1760}},
  260. {0, {175, 316, 2200, 2800}},
  261. {0, {175, 280, 2275, 2775}},
  262. {0, {167, 450, 1820, 2475}},
  263. {0, {167, 434, 1850, 2425}},
  264. {0, {157, 582, 1725, 2375}},
  265. {0, {158, 586, 1800, 2425}},
  266. {0, {150, 600, 1750, 2375}},
  267. {1, {145, 582, 1775, 2375}},
  268. {1, {145, 626, 1125, 2200}},
  269. {0, {160, 641, 1120, 2225}},
  270. {0, {144, 708, 1054, 2420}},
  271. {1, {150, 705, 1050, 2375}},
  272. {0, {146, 614, 848, 2200}},
  273. {0, {143, 600, 860, 2175}},
  274. {0, {167, 500, 1000, 2325}},
  275. {0, {167, 500, 1000, 2325}},
  276. {0, {167, 334, 1150, 2200}},
  277. {0, {183, 312, 1020, 2300}},
  278. {0, {157, 518, 1305, 1570}},
  279. {0, {157, 504, 1210, 1510}},
  280. {0, {129, 260, 2260, 2820}},
  281. {0, {125, 250, 2200, 2825}},
  282. {0, {146, 400, 2040, 2500}},
  283. {0, {144, 389, 2000, 2425}},
  284. {0, {126, 500, 1870, 2500}},
  285. {0, {125, 500, 1775, 2450}},
  286. {0, {110, 660, 1650, 2500}},
  287. {0, {120, 624, 1700, 2475}},
  288. {0, {122, 650, 1220, 2550}},
  289. {0, {120, 672, 1260, 2500}},
  290. {0, {114, 750, 1080, 2680}},
  291. {0, {114, 777, 1026, 2625}},
  292. {0, {115, 580, 800, 2650}},
  293. {0, {117, 585, 819, 2625}},
  294. {1, {140, 480, 950, 2500}},
  295. {0, {127, 461, 993, 2350}},
  296. {0, {140, 280, 950, 2300}},
  297. {0, {133, 266, 920, 2300}},
  298. {0, {128, 500, 1340, 1700}},
  299. {0, {133, 532, 1275, 1600}},
  300. {0, {146, 248, 2225, 3100}},
  301. {0, {140, 238, 2175, 3075}},
  302. {0, {150, 405, 1925, 2550}},
  303. {0, {138, 416, 1940, 2600}},
  304. {1, {147, 588, 1790, 2500}},
  305. {1, {133, 586, 1725, 2650}},
  306. {0, {145, 725, 1700, 2425}},
  307. {0, {127, 710, 1650, 2220}},
  308. {1, {136, 586, 1078, 2300}},
  309. {0, {136, 627, 1038, 2360}},
  310. {1, {145, 725, 1046, 2325}},
  311. {1, {131, 746, 1018, 2300}},
  312. {0, {140, 560, 840, 2500}},
  313. {1, {140, 560, 924, 2350}},
  314. {0, {150, 495, 1080, 2275}},
  315. {0, {143, 430, 1030, 2275}},
  316. {0, {162, 290, 760, 2300}},
  317. {0, {157, 315, 850, 2025}},
  318. {0, {150, 511, 1561, 1876}},
  319. {0, {138, 530, 1450, 1887}},
  320. {0, {110, 220, 2410, 3000}},
  321. {0, {125, 240, 2440, 3280}},
  322. {0, {120, 450, 1880, 2450}},
  323. {0, {118, 380, 1930, 2420}},
  324. {0, {115, 560, 1650, 2300}},
  325. {0, {123, 560, 1720, 2300}},
  326. {0, {110, 680, 1720, 2330}},
  327. {0, {133, 630, 1680, 2280}},
  328. {1, {110, 560, 1430, 2250}},
  329. {1, {120, 560, 1390, 2240}},
  330. {1, {108, 800, 1330, 2260}},
  331. {0, {110, 740, 1240, 2280}},
  332. {1, {120, 600, 920, 2080}},
  333. {1, {133, 580, 910, 2000}},
  334. {0, {130, 400, 1200, 2210}},
  335. {0, {110, 420, 1230, 2230}},
  336. {0, {122, 300, 900, 2130}},
  337. {0, {123, 260, 1010, 2240}},
  338. {0, {125, 400, 1450, 1650}},
  339. {0, {128, 360, 1410, 1640}},
  340. {0, {142, 290, 2290, 2600}},
  341. {0, {135, 260, 2290, 2700}},
  342. {0, {132, 390, 1950, 2550}},
  343. {1, {135, 400, 1900, 2450}},
  344. {1, {124, 490, 1740, 2500}},
  345. {1, {125, 500, 1780, 2430}},
  346. {0, {125, 660, 1630, 2500}},
  347. {0, {132, 670, 1630, 2380}},
  348. {0, {140, 600, 1220, 2530}},
  349. {0, {125, 600, 1210, 2430}},
  350. {1, {125, 680, 1120, 2630}},
  351. {0, {128, 670, 1100, 2700}},
  352. {0, {127, 510, 720, 2450}},
  353. {0, {120, 480, 710, 2540}},
  354. {1, {133, 380, 910, 2350}},
  355. {0, {140, 440, 1030, 2400}},
  356. {0, {127, 350, 720, 2750}},
  357. {0, {140, 380, 740, 2880}},
  358. {0, {128, 430, 1370, 1610}},
  359. {0, {135, 440, 1360, 1600}},
  360. {0, {114, 228, 2350, 2860}},
  361. {0, {118, 220, 2350, 2920}},
  362. {1, {110, 407, 2070, 2500}},
  363. {1, {112, 420, 1900, 2450}},
  364. {0, {106, 445, 2020, 2420}},
  365. {0, {115, 470, 2020, 2500}},
  366. {0, {103, 721, 1680, 2400}},
  367. {0, {109, 750, 1710, 2440}},
  368. {1, {104, 552, 1122, 2500}},
  369. {1, {115, 580, 1150, 2600}},
  370. {0, {98, 686, 1078, 2570}},
  371. {1, {103, 700, 1050, 2680}},
  372. {0, {102, 560, 665, 2620}},
  373. {0, {106, 550, 650, 2700}},
  374. {0, {112, 448, 980, 2370}},
  375. {0, {104, 410, 940, 2370}},
  376. {0, {116, 232, 696, 2200}},
  377. {0, {117, 222, 665, 2080}},
  378. {0, {120, 432, 1300, 1400}},
  379. {0, {111, 420, 1300, 1570}},
  380. {0, {121, 230, 2100, 2850}},
  381. {0, {118, 240, 2000, 2980}},
  382. {0, {130, 365, 1900, 2340}},
  383. {0, {119, 300, 2040, 2560}},
  384. {1, {112, 440, 1980, 2310}},
  385. {1, {120, 410, 2050, 2500}},
  386. {1, {133, 620, 1710, 2110}},
  387. {0, {124, 660, 1800, 2150}},
  388. {0, {120, 660, 1000, 2380}},
  389. {0, {110, 660, 960, 2450}},
  390. {1, {122, 600, 830, 2250}},
  391. {1, {119, 620, 820, 2400}},
  392. {0, {117, 500, 620, 2250}},
  393. {0, {106, 550, 700, 2550}},
  394. {0, {140, 390, 730, 2180}},
  395. {0, {130, 360, 740, 2200}},
  396. {0, {131, 260, 720, 2100}},
  397. {0, {132, 260, 740, 2040}},
  398. {0, {125, 450, 1230, 1600}},
  399. {0, {127, 460, 1300, 1650}},
  400. {0, {150, 300, 2355, 3250}},
  401. {0, {150, 300, 2460, 3280}},
  402. {0, {160, 385, 2242, 2805}},
  403. {0, {150, 407, 2250, 2780}},
  404. {0, {140, 504, 2090, 2720}},
  405. {0, {146, 543, 1980, 2640}},
  406. {0, {133, 680, 1958, 2542}},
  407. {0, {141, 708, 1840, 2535}},
  408. {0, {150, 675, 1320, 2550}},
  409. {0, {150, 704, 1393, 2550}},
  410. {0, {137, 825, 1168, 2750}},
  411. {0, {135, 840, 1210, 2680}},
  412. {1, {143, 671, 1000, 2670}},
  413. {1, {147, 690, 968, 2660}},
  414. {0, {143, 443, 1273, 2430}},
  415. {0, {153, 459, 1286, 2410}},
  416. {0, {146, 395, 1300, 2160}},
  417. {0, {153, 400, 1320, 2150}},
  418. {0, {140, 532, 1500, 1890}},
  419. {0, {146, 538, 1460, 1818}},
  420. {0, {120, 264, 2290, 2700}},
  421. {0, {128, 256, 2305, 2635}},
  422. {0, {112, 380, 1880, 2440}},
  423. {0, {115, 346, 1930, 2390}},
  424. {0, {100, 510, 1780, 2300}},
  425. {0, {108, 520, 1730, 2275}},
  426. {0, {100, 630, 1770, 2350}},
  427. {0, {105, 630, 1642, 2170}},
  428. {0, {103, 601, 1273, 2130}},
  429. {1, {105, 590, 1283, 2150}},
  430. {1, {100, 750, 1150, 2440}},
  431. {0, {95, 703, 1092, 2320}},
  432. {0, {97, 565, 780, 2350}},
  433. {0, {106, 584, 849, 2460}},
  434. {0, {105, 420, 1100, 2140}},
  435. {0, {111, 422, 1200, 2175}},
  436. {0, {117, 315, 1080, 2260}},
  437. {0, {125, 326, 1125, 2210}},
  438. {0, {111, 444, 1300, 1625}},
  439. {0, {109, 469, 1288, 1600}},
  440. {0, {124, 210, 2100, 3090}},
  441. {0, {130, 220, 2080, 3180}},
  442. {0, {128, 280, 2000, 2710}},
  443. {0, {130, 310, 1950, 2670}},
  444. {0, {121, 470, 1910, 2580}},
  445. {1, {129, 490, 1930, 2650}},
  446. {0, {116, 640, 1620, 2200}},
  447. {0, {118, 650, 1580, 2360}},
  448. {0, {121, 610, 1100, 2230}},
  449. {0, {126, 620, 1120, 2330}},
  450. {1, {118, 700, 1100, 2240}},
  451. {1, {120, 670, 1100, 2220}},
  452. {0, {122, 460, 720, 2180}},
  453. {0, {118, 470, 690, 2200}},
  454. {0, {129, 320, 770, 1860}},
  455. {1, {130, 310, 790, 1920}},
  456. {0, {140, 210, 670, 1900}},
  457. {0, {148, 240, 730, 1850}},
  458. {0, {128, 390, 1320, 1550}},
  459. {0, {124, 420, 1240, 1510}},
  460. {0, {129, 190, 2650, 3280}},
  461. {0, {135, 190, 2700, 3170}},
  462. {0, {132, 370, 1750, 2700}},
  463. {0, {130, 370, 1800, 2750}},
  464. {1, {122, 370, 1680, 2560}},
  465. {1, {125, 375, 1700, 2500}},
  466. {1, {121, 550, 1570, 2600}},
  467. {1, {120, 530, 1610, 2650}},
  468. {1, {118, 570, 1050, 2500}},
  469. {1, {125, 590, 1100, 2480}},
  470. {1, {112, 640, 970, 2870}},
  471. {1, {122, 670, 980, 2900}},
  472. {1, {113, 560, 860, 2900}},
  473. {0, {121, 570, 820, 2820}},
  474. {1, {125, 350, 1000, 2500}},
  475. {1, {130, 380, 920, 2370}},
  476. {0, {130, 250, 1000, 2100}},
  477. {0, {140, 210, 960, 1940}},
  478. {0, {130, 360, 1300, 1920}},
  479. {0, {133, 370, 1300, 1760}},
  480. {0, {127, 250, 2180, 2660}},
  481. {0, {131, 260, 2210, 2780}},
  482. {0, {121, 400, 1900, 2440}},
  483. {0, {122, 350, 1980, 2480}},
  484. {1, {116, 560, 1670, 2310}},
  485. {1, {124, 530, 1700, 2380}},
  486. {0, {120, 680, 1470, 2280}},
  487. {0, {119, 620, 1580, 2320}},
  488. {0, {120, 620, 1100, 2390}},
  489. {1, {125, 640, 1110, 2370}},
  490. {1, {115, 630, 980, 2330}},
  491. {1, {121, 670, 940, 2380}},
  492. {0, {112, 560, 790, 2480}},
  493. {0, {120, 610, 840, 2420}},
  494. {0, {121, 360, 860, 2200}},
  495. {0, {120, 400, 840, 2200}},
  496. {0, {140, 280, 670, 2140}},
  497. {0, {126, 250, 720, 2190}},
  498. {0, {120, 480, 1410, 1760}},
  499. {0, {121, 470, 1330, 1700}},
  500. {0, {155, 280, 2400, 2910}},
  501. {0, {150, 300, 2320, 2960}},
  502. {1, {142, 410, 2060, 2680}},
  503. {0, {150, 450, 2050, 2670}},
  504. {0, {135, 540, 1900, 2530}},
  505. {0, {135, 540, 1920, 2520}},
  506. {0, {138, 620, 1800, 2440}},
  507. {0, {140, 690, 1820, 2480}},
  508. {1, {150, 630, 1200, 2600}},
  509. {0, {140, 680, 1290, 2600}},
  510. {0, {145, 740, 1110, 2500}},
  511. {1, {143, 700, 1060, 2720}},
  512. {1, {146, 600, 970, 2570}},
  513. {0, {138, 650, 880, 2660}},
  514. {0, {142, 430, 1130, 2440}},
  515. {0, {143, 430, 1150, 2420}},
  516. {0, {142, 280, 990, 2330}},
  517. {0, {145, 290, 1000, 2300}},
  518. {0, {150, 420, 1350, 1600}},
  519. {0, {150, 450, 1350, 1600}},
  520. {0, {135, 300, 2300, 2800}},
  521. {0, {135, 350, 2240, 2760}},
  522. {1, {136, 410, 2200, 2680}},
  523. {1, {138, 440, 2080, 2520}},
  524. {1, {133, 580, 1870, 2320}},
  525. {1, {127, 520, 1900, 2400}},
  526. {0, {130, 760, 1920, 2480}},
  527. {0, {132, 670, 1850, 2560}},
  528. {1, {139, 810, 1110, 2100}},
  529. {1, {131, 770, 1150, 2100}},
  530. {1, {141, 700, 1040, 2120}},
  531. {0, {125, 750, 1160, 2080}},
  532. {1, {133, 670, 920, 2240}},
  533. {1, {142, 570, 850, 2250}},
  534. {0, {140, 550, 970, 2200}},
  535. {1, {141, 490, 870, 2240}},
  536. {0, {150, 300, 600, 2300}},
  537. {0, {148, 230, 570, 2100}},
  538. {0, {140, 560, 1520, 2100}},
  539. {0, {140, 540, 1570, 2050}},
  540. {0, {125, 240, 2100, 2900}},
  541. {0, {119, 240, 2150, 2860}},
  542. {0, {130, 380, 1870, 2450}},
  543. {0, {120, 430, 1710, 2350}},
  544. {1, {119, 580, 1770, 2500}},
  545. {1, {117, 570, 1750, 2400}},
  546. {1, {115, 760, 1580, 2440}},
  547. {0, {110, 715, 1500, 2300}},
  548. {1, {124, 620, 880, 2500}},
  549. {1, {124, 650, 1000, 2520}},
  550. {0, {119, 710, 950, 2520}},
  551. {1, {120, 690, 960, 2520}},
  552. {0, {125, 460, 610, 2500}},
  553. {0, {120, 470, 710, 2500}},
  554. {0, {125, 390, 900, 2100}},
  555. {0, {125, 460, 920, 2140}},
  556. {0, {125, 250, 690, 2080}},
  557. {0, {130, 270, 650, 2050}},
  558. {0, {122, 540, 1280, 1720}},
  559. {0, {118, 510, 1280, 1650}},
  560. {0, {148, 280, 2450, 2700}},
  561. {0, {160, 288, 2500, 2880}},
  562. {0, {160, 400, 2080, 2530}},
  563. {0, {153, 384, 2110, 2500}},
  564. {1, {138, 590, 1900, 2200}},
  565. {1, {153, 583, 1840, 2250}},
  566. {0, {145, 680, 1850, 2400}},
  567. {0, {140, 685, 1780, 2160}},
  568. {0, {143, 660, 1370, 2110}},
  569. {1, {145, 680, 1300, 2100}},
  570. {1, {140, 760, 1260, 2120}},
  571. {0, {135, 770, 1140, 2020}},
  572. {0, {145, 500, 800, 1850}},
  573. {0, {132, 600, 1000, 2000}},
  574. {0, {157, 380, 1060, 1950}},
  575. {0, {150, 470, 1220, 2150}},
  576. {0, {162, 324, 800, 2220}},
  577. {0, {139, 290, 800, 2150}},
  578. {0, {150, 560, 1350, 1780}},
  579. {0, {150, 600, 1470, 1820}},
  580. {0, {110, 250, 2190, 3000}},
  581. {0, {106, 254, 2085, 2890}},
  582. {0, {111, 330, 1967, 2670}},
  583. {0, {108, 430, 1940, 2590}},
  584. {0, {116, 464, 2100, 2700}},
  585. {0, {105, 504, 1995, 2780}},
  586. {0, {94, 595, 1900, 2700}},
  587. {0, {100, 670, 1860, 2500}},
  588. {0, {96, 620, 1200, 2420}},
  589. {0, {105, 630, 1127, 2420}},
  590. {0, {100, 750, 1160, 2360}},
  591. {0, {96, 740, 1155, 2330}},
  592. {0, {101, 460, 740, 2300}},
  593. {1, {105, 494, 789, 2420}},
  594. {0, {113, 400, 1020, 2200}},
  595. {0, {128, 450, 1028, 2160}},
  596. {0, {140, 392, 1000, 2120}},
  597. {0, {116, 350, 898, 2140}},
  598. {0, {117, 547, 1340, 1688}},
  599. {0, {128, 512, 1280, 1570}},
  600. {0, {123, 246, 2185, 2730}},
  601. {0, {133, 267, 2280, 2800}},
  602. {0, {140, 420, 2300, 2800}},
  603. {0, {120, 384, 2110, 2620}},
  604. {0, {120, 480, 1920, 2540}},
  605. {1, {112, 551, 1788, 2450}},
  606. {0, {114, 628, 1837, 2570}},
  607. {1, {111, 622, 1890, 2560}},
  608. {0, {114, 628, 1254, 2470}},
  609. {0, {114, 617, 1255, 2480}},
  610. {1, {117, 690, 1072, 2660}},
  611. {1, {103, 630, 1000, 2530}},
  612. {0, {117, 510, 700, 2650}},
  613. {0, {120, 504, 756, 2540}},
  614. {0, {122, 465, 990, 2440}},
  615. {0, {125, 462, 976, 2450}},
  616. {0, {120, 324, 708, 2440}},
  617. {0, {157, 387, 786, 2518}},
  618. {0, {122, 488, 1468, 1712}},
  619. {0, {118, 472, 1465, 1725}},
  620. {0, {138, 275, 2060, 2800}},
  621. {0, {136, 270, 2020, 2790}},
  622. {0, {133, 349, 2030, 2760}},
  623. {0, {136, 340, 1940, 2560}},
  624. {1, {120, 444, 1800, 2500}},
  625. {1, {127, 380, 1800, 2440}},
  626. {0, {125, 688, 1600, 2300}},
  627. {0, {122, 660, 1570, 2380}},
  628. {1, {128, 565, 1157, 2310}},
  629. {0, {130, 550, 1150, 2250}},
  630. {0, {125, 712, 1024, 2250}},
  631. {0, {125, 670, 1080, 2300}},
  632. {0, {125, 550, 913, 2360}},
  633. {0, {126, 550, 890, 2280}},
  634. {0, {128, 360, 1028, 2160}},
  635. {1, {140, 390, 1060, 2150}},
  636. {0, {133, 294, 930, 2050}},
  637. {0, {140, 280, 1000, 2160}},
  638. {0, {125, 440, 1250, 1625}},
  639. {0, {130, 480, 1160, 1520}},
  640. {0, {125, 320, 2160, 2900}},
  641. {0, {133, 267, 2230, 3000}},
  642. {0, {115, 440, 1750, 2400}},
  643. {0, {116, 390, 1780, 2450}},
  644. {0, {117, 525, 1800, 2480}},
  645. {0, {110, 520, 1750, 2390}},
  646. {0, {111, 660, 1600, 2400}},
  647. {0, {120, 720, 1680, 2430}},
  648. {0, {117, 600, 1250, 2300}},
  649. {1, {125, 575, 1170, 2240}},
  650. {1, {111, 730, 1160, 2340}},
  651. {0, {117, 860, 1280, 2470}},
  652. {0, {114, 560, 810, 2290}},
  653. {0, {116, 584, 840, 2280}},
  654. {0, {130, 455, 970, 2140}},
  655. {0, {120, 456, 1040, 2038}},
  656. {0, {125, 350, 820, 2130}},
  657. {0, {128, 366, 772, 2058}},
  658. {1, {111, 450, 1420, 1870}},
  659. {0, {118, 472, 1430, 1840}},
  660. {0, {133, 333, 2305, 3200}},
  661. {0, {131, 326, 2260, 3030}},
  662. {1, {125, 375, 2188, 2750}},
  663. {1, {133, 400, 2150, 2680}},
  664. {1, {125, 500, 1980, 2480}},
  665. {1, {150, 480, 1950, 2340}},
  666. {0, {116, 640, 1710, 2450}},
  667. {0, {123, 615, 1720, 2220}},
  668. {0, {116, 583, 1110, 2360}},
  669. {1, {117, 608, 1120, 2700}},
  670. {0, {111, 777, 1170, 2600}},
  671. {0, {114, 750, 1175, 2820}},
  672. {1, {105, 630, 891, 2519}},
  673. {1, {114, 572, 924, 2660}},
  674. {0, {125, 438, 975, 2300}},
  675. {0, {140, 420, 938, 2300}},
  676. {0, {133, 333, 800, 2130}},
  677. {0, {140, 320, 840, 2150}},
  678. {0, {120, 480, 1320, 1870}},
  679. {0, {127, 483, 1335, 1844}},
  680. {0, {166, 267, 2300, 2940}},
  681. {0, {156, 220, 2300, 2900}},
  682. {0, {154, 431, 2040, 2460}},
  683. {0, {155, 360, 2010, 2400}},
  684. {1, {150, 565, 1950, 2500}},
  685. {0, {180, 540, 2000, 2450}},
  686. {1, {143, 600, 2000, 2570}},
  687. {0, {138, 590, 1950, 2460}},
  688. {1, {157, 630, 1140, 2200}},
  689. {1, {186, 630, 1170, 2280}},
  690. {1, {146, 730, 1048, 2450}},
  691. {0, {155, 730, 1130, 2320}},
  692. {1, {150, 600, 900, 2400}},
  693. {1, {178, 640, 890, 2280}},
  694. {1, {160, 448, 960, 2200}},
  695. {0, {196, 450, 1000, 2180}},
  696. {0, {167, 333, 835, 2170}},
  697. {0, {198, 280, 750, 2170}},
  698. {0, {163, 488, 1300, 1600}},
  699. {0, {163, 490, 1380, 1620}},
  700. {0, {120, 312, 2380, 2900}},
  701. {0, {120, 300, 2350, 3000}},
  702. {0, {140, 490, 2000, 2620}},
  703. {1, {140, 490, 1960, 2600}},
  704. {0, {125, 640, 2000, 2620}},
  705. {0, {111, 555, 1870, 2540}},
  706. {0, {112, 697, 1610, 2540}},
  707. {0, {114, 684, 1634, 2510}},
  708. {0, {115, 633, 1260, 2530}},
  709. {1, {120, 660, 1213, 2460}},
  710. {0, {112, 730, 1203, 2700}},
  711. {0, {107, 752, 1125, 2620}},
  712. {0, {108, 507, 755, 2420}},
  713. {0, {116, 538, 816, 2450}},
  714. {0, {114, 456, 1040, 2300}},
  715. {0, {120, 480, 1120, 2160}},
  716. {1, {123, 344, 960, 2150}},
  717. {0, {125, 350, 1000, 2250}},
  718. {0, {112, 539, 1370, 1800}},
  719. {0, {117, 549, 1353, 1728}},
  720. {0, {146, 292, 2500, 3150}},
  721. {0, {133, 266, 2370, 3100}},
  722. {0, {143, 372, 2220, 2640}},
  723. {0, {131, 350, 2130, 2610}},
  724. {1, {133, 574, 1840, 2260}},
  725. {1, {133, 563, 1960, 2450}},
  726. {0, {125, 650, 1738, 2400}},
  727. {0, {130, 663, 1820, 2400}},
  728. {0, {137, 600, 1370, 2180}},
  729. {1, {125, 625, 1312, 2250}},
  730. {0, {133, 735, 1070, 2100}},
  731. {0, {117, 713, 1180, 2200}},
  732. {0, {125, 625, 875, 2180}},
  733. {1, {115, 700, 1000, 2250}},
  734. {0, {150, 420, 1100, 2000}},
  735. {0, {140, 420, 1120, 2100}},
  736. {0, {125, 350, 980, 2200}},
  737. {0, {133, 320, 918, 2100}},
  738. {0, {143, 554, 1480, 1800}},
  739. {0, {128, 484, 1505, 1890}},
  740. {0, {143, 286, 2415, 2860}},
  741. {0, {150, 300, 2415, 2860}},
  742. {1, {140, 400, 1980, 2500}},
  743. {1, {145, 407, 2095, 2620}},
  744. {1, {125, 525, 1988, 2610}},
  745. {0, {144, 553, 1935, 2530}},
  746. {0, {133, 640, 1773, 2490}},
  747. {0, {133, 640, 1840, 2560}},
  748. {0, {143, 672, 1272, 2640}},
  749. {0, {146, 658, 1241, 2560}},
  750. {0, {130, 780, 1170, 2640}},
  751. {0, {131, 788, 1115, 2645}},
  752. {1, {138, 633, 891, 2500}},
  753. {1, {150, 600, 935, 2550}},
  754. {0, {175, 490, 1102, 2420}},
  755. {0, {154, 492, 1077, 2306}},
  756. {1, {160, 320, 960, 2240}},
  757. {0, {160, 320, 960, 2290}},
  758. {0, {143, 543, 1310, 1643}},
  759. {0, {145, 508, 1309, 1600}},
  760. {1, {230, 370, 2670, 3100}},
  761. {0, {234, 390, 2760, 3060}},
  762. {0, {234, 468, 2330, 2930}},
  763. {0, {205, 410, 2380, 2950}},
  764. {0, {190, 550, 2200, 2880}},
  765. {0, {191, 570, 2100, 3040}},
  766. {0, {200, 800, 1980, 2810}},
  767. {0, {192, 860, 1920, 2850}},
  768. {0, {227, 635, 1200, 3250}},
  769. {0, {200, 700, 1200, 3100}},
  770. {1, {210, 880, 1240, 2870}},
  771. {0, {188, 830, 1200, 2880}},
  772. {0, {207, 570, 830, 3300}},
  773. {1, {200, 700, 1000, 3130}},
  774. {0, {240, 410, 940, 3040}},
  775. {0, {225, 450, 970, 3190}},
  776. {0, {238, 480, 955, 2960}},
  777. {1, {208, 395, 810, 2900}},
  778. {0, {200, 500, 1850, 2100}},
  779. {0, {200, 560, 1750, 2100}},
  780. {0, {225, 270, 2760, 3550}},
  781. {0, {240, 290, 2700, 3350}},
  782. {0, {245, 460, 2500, 3220}},
  783. {0, {220, 410, 2400, 3240}},
  784. {0, {220, 620, 2300, 3200}},
  785. {0, {210, 630, 2300, 3170}},
  786. {0, {220, 820, 2180, 2850}},
  787. {0, {195, 740, 2120, 3070}},
  788. {0, {240, 800, 1300, 2900}},
  789. {0, {225, 760, 1400, 2830}},
  790. {0, {214, 850, 1120, 2620}},
  791. {0, {190, 880, 1220, 2850}},
  792. {0, {228, 460, 900, 2830}},
  793. {1, {222, 440, 880, 2850}},
  794. {0, {250, 500, 1040, 2750}},
  795. {0, {245, 490, 1000, 2720}},
  796. {0, {250, 400, 940, 2720}},
  797. {0, {245, 410, 860, 2700}},
  798. {0, {225, 440, 1560, 1750}},
  799. {0, {210, 420, 1600, 1750}},
  800. {0, {210, 290, 2700, 3020}},
  801. {0, {215, 280, 2630, 3240}},
  802. {1, {211, 420, 2300, 2950}},
  803. {0, {211, 420, 2220, 2980}},
  804. {1, {207, 640, 2120, 2900}},
  805. {1, {221, 700, 2000, 2900}},
  806. {0, {212, 1000, 1830, 2820}},
  807. {0, {204, 980, 1800, 2820}},
  808. {1, {205, 780, 1410, 2720}},
  809. {0, {208, 710, 1450, 2750}},
  810. {0, {205, 950, 1280, 2600}},
  811. {0, {210, 870, 1260, 2740}},
  812. {0, {203, 610, 900, 2710}},
  813. {0, {210, 630, 840, 2700}},
  814. {0, {211, 440, 1050, 2780}},
  815. {0, {210, 420, 1050, 2740}},
  816. {0, {222, 380, 860, 2500}},
  817. {0, {208, 330, 750, 2740}},
  818. {0, {208, 580, 1450, 1720}},
  819. {0, {212, 540, 1560, 1900}},
  820. {0, {210, 294, 2800, 3100}},
  821. {0, {222, 270, 2880, 3160}},
  822. {0, {202, 420, 2430, 3030}},
  823. {0, {212, 420, 2370, 2930}},
  824. {1, {200, 580, 2180, 2770}},
  825. {1, {217, 540, 2160, 2770}},
  826. {0, {200, 820, 1970, 2620}},
  827. {0, {210, 840, 2000, 2700}},
  828. {1, {208, 690, 1200, 2900}},
  829. {0, {201, 666, 1206, 2900}},
  830. {1, {200, 800, 1200, 2920}},
  831. {1, {190, 760, 1140, 2850}},
  832. {0, {200, 560, 760, 2800}},
  833. {0, {207, 560, 770, 3000}},
  834. {1, {215, 430, 1075, 2580}},
  835. {0, {213, 430, 1000, 2700}},
  836. {0, {220, 330, 840, 2550}},
  837. {0, {213, 280, 850, 2500}},
  838. {0, {205, 430, 1800, 1930}},
  839. {0, {200, 420, 1740, 1960}},
  840. {0, {175, 350, 2800, 3160}},
  841. {0, {187, 338, 2870, 3300}},
  842. {0, {200, 400, 2540, 3200}},
  843. {0, {210, 420, 2680, 3000}},
  844. {0, {180, 518, 2470, 3200}},
  845. {0, {200, 600, 2400, 3150}},
  846. {0, {171, 773, 2000, 2870}},
  847. {0, {175, 875, 2100, 2970}},
  848. {1, {183, 733, 1468, 2700}},
  849. {0, {200, 740, 1280, 2900}},
  850. {1, {178, 730, 1210, 2740}},
  851. {1, {175, 735, 1220, 2850}},
  852. {0, {160, 560, 960, 2850}},
  853. {0, {192, 536, 850, 2850}},
  854. {0, {212, 424, 1040, 2780}},
  855. {0, {200, 520, 1060, 2670}},
  856. {0, {190, 380, 770, 2900}},
  857. {0, {187, 340, 750, 2780}},
  858. {1, {177, 490, 2120, 2480}},
  859. {0, {197, 493, 1930, 2300}},
  860. {0, {250, 325, 2700, 3100}},
  861. {0, {225, 310, 2750, 3225}},
  862. {0, {214, 350, 2580, 3000}},
  863. {0, {267, 390, 2700, 3200}},
  864. {0, {233, 560, 2330, 2800}},
  865. {0, {200, 520, 2500, 3000}},
  866. {0, {171, 806, 1970, 2600}},
  867. {0, {150, 825, 1860, 2550}},
  868. {0, {186, 708, 1485, 2760}},
  869. {0, {188, 676, 1500, 2590}},
  870. {0, {200, 800, 1200, 2800}},
  871. {1, {205, 714, 1154, 2850}},
  872. {0, {267, 530, 800, 2780}},
  873. {1, {180, 485, 810, 2750}},
  874. {0, {214, 450, 1460, 2550}},
  875. {0, {233, 467, 1400, 2450}},
  876. {0, {225, 450, 1080, 2350}},
  877. {0, {200, 400, 1000, 2400}},
  878. {0, {193, 524, 1700, 2130}},
  879. {0, {180, 507, 1800, 2380}},
  880. {0, {200, 300, 3100, 3400}},
  881. {1, {216, 300, 3100, 3500}},
  882. {0, {214, 428, 2570, 3000}},
  883. {0, {220, 440, 2640, 3080}},
  884. {0, {210, 528, 2540, 3170}},
  885. {1, {210, 504, 2520, 3200}},
  886. {0, {187, 940, 2250, 2760}},
  887. {0, {200, 820, 2200, 2920}},
  888. {0, {204, 816, 1450, 2700}},
  889. {1, {214, 858, 1500, 2700}},
  890. {0, {200, 960, 1280, 3000}},
  891. {1, {180, 1040, 1300, 3000}},
  892. {0, {220, 520, 880, 2500}},
  893. {0, {217, 574, 890, 2510}},
  894. {1, {233, 466, 1330, 2750}},
  895. {1, {233, 466, 1165, 2800}},
  896. {0, {180, 300, 850, 2800}},
  897. {1, {175, 350, 840, 2750}},
  898. {0, {216, 432, 1790, 2060}},
  899. {0, {219, 360, 1900, 2320}},
  900. {0, {225, 337, 2700, 3300}},
  901. {0, {233, 340, 2720, 3200}},
  902. {0, {237, 474, 2370, 3095}},
  903. {0, {237, 475, 2400, 3090}},
  904. {0, {229, 526, 2360, 3090}},
  905. {0, {233, 580, 2360, 3150}},
  906. {1, {230, 690, 2185, 2990}},
  907. {1, {220, 660, 2200, 3020}},
  908. {1, {225, 675, 1551, 2923}},
  909. {0, {233, 690, 1630, 2900}},
  910. {0, {222, 845, 1334, 2890}},
  911. {0, {233, 888, 1290, 2800}},
  912. {0, {225, 631, 923, 2250}},
  913. {0, {233, 543, 980, 2300}},
  914. {0, {233, 537, 1360, 2920}},
  915. {0, {240, 480, 1345, 2680}},
  916. {0, {235, 400, 1180, 2760}},
  917. {0, {233, 396, 1120, 2560}},
  918. {0, {225, 450, 1640, 2250}},
  919. {0, {233, 489, 1630, 2090}},
  920. {0, {225, 225, 2760, 3900}},
  921. {0, {230, 230, 2850, 3800}},
  922. {0, {238, 429, 2560, 3200}},
  923. {1, {230, 430, 2575, 3100}},
  924. {0, {214, 579, 2570, 3300}},
  925. {0, {214, 536, 2570, 3100}},
  926. {0, {205, 823, 2220, 2870}},
  927. {0, {200, 800, 2100, 2900}},
  928. {0, {250, 750, 1500, 2750}},
  929. {0, {217, 738, 1300, 2820}},
  930. {0, {200, 840, 1300, 3100}},
  931. {1, {206, 990, 1340, 3100}},
  932. {0, {214, 579, 856, 2790}},
  933. {0, {205, 545, 905, 2750}},
  934. {1, {233, 490, 1220, 2610}},
  935. {1, {250, 513, 1500, 2650}},
  936. {0, {250, 400, 1250, 2500}},
  937. {0, {225, 405, 1080, 2500}},
  938. {0, {233, 466, 1860, 2260}},
  939. {0, {225, 540, 1780, 2220}},
  940. {0, {240, 290, 3000, 3840}},
  941. {0, {250, 325, 2900, 3500}},
  942. {0, {250, 500, 2370, 3120}},
  943. {1, {238, 476, 2380, 3090}},
  944. {0, {238, 760, 2380, 3205}},
  945. {0, {233, 746, 2290, 3030}},
  946. {0, {206, 1008, 1990, 2870}},
  947. {0, {200, 1040, 2000, 2800}},
  948. {0, {220, 830, 1540, 2860}},
  949. {0, {237, 900, 1510, 2840}},
  950. {0, {206, 970, 1343, 3018}},
  951. {1, {236, 592, 1230, 2600}},
  952. {0, {233, 650, 900, 2920}},
  953. {0, {229, 687, 1060, 2780}},
  954. {1, {233, 512, 1211, 2630}},
  955. {0, {233, 467, 1167, 2595}},
  956. {0, {250, 450, 875, 2750}},
  957. {0, {233, 420, 935, 2710}},
  958. {0, {230, 622, 1750, 2070}},
  959. {0, {225, 652, 1710, 2043}},
  960. {0, {255, 275, 2800, 3310}},
  961. {0, {245, 245, 2800, 3300}},
  962. {0, {267, 534, 2500, 3250}},
  963. {0, {264, 528, 2640, 3370}},
  964. {0, {238, 700, 2380, 3250}},
  965. {0, {250, 750, 2480, 3000}},
  966. {0, {237, 1020, 1900, 2960}},
  967. {0, {233, 1005, 2050, 2870}},
  968. {0, {263, 750, 1500, 2850}},
  969. {0, {250, 850, 1400, 2750}},
  970. {0, {258, 978, 1290, 2840}},
  971. {0, {246, 935, 1230, 2730}},
  972. {0, {250, 500, 750, 2750}},
  973. {0, {243, 632, 850, 2850}},
  974. {0, {250, 350, 1170, 2750}},
  975. {0, {266, 450, 1000, 2800}},
  976. {0, {256, 358, 640, 2560}},
  977. {0, {250, 300, 750, 2500}},
  978. {0, {260, 520, 1560, 1820}},
  979. {0, {250, 500, 1500, 1750}},
  980. {0, {236, 236, 2790, 3760}},
  981. {0, {242, 242, 2770, 3800}},
  982. {0, {222, 444, 2555, 3110}},
  983. {0, {242, 420, 2700, 3120}},
  984. {0, {226, 634, 2325, 2940}},
  985. {0, {225, 608, 2475, 3100}},
  986. {0, {210, 1010, 2060, 2900}},
  987. {0, {200, 980, 2160, 2920}},
  988. {0, {217, 818, 1450, 2500}},
  989. {0, {200, 750, 1280, 2650}},
  990. {0, {220, 820, 1200, 2640}},
  991. {0, {210, 900, 1120, 2900}},
  992. {0, {220, 440, 749, 2640}},
  993. {0, {210, 567, 752, 2600}},
  994. {1, {204, 460, 1045, 2504}},
  995. {0, {240, 480, 1105, 2400}},
  996. {0, {250, 420, 1000, 2500}},
  997. {0, {275, 350, 1100, 2400}},
  998. {0, {217, 487, 1500, 1780}},
  999. {0, {206, 467, 1420, 1640}},
  1000. {0, {225, 360, 2920, 3400}},
  1001. {0, {233, 340, 2840, 3300}},
  1002. {0, {257, 514, 2570, 3070}},
  1003. {0, {238, 500, 2680, 3260}},
  1004. {0, {238, 650, 2495, 3090}},
  1005. {1, {216, 650, 2380, 3030}},
  1006. {0, {225, 1020, 2030, 2700}},
  1007. {0, {225, 1000, 2200, 2770}},
  1008. {0, {225, 788, 1462, 2920}},
  1009. {0, {217, 736, 1500, 2900}},
  1010. {1, {214, 987, 1330, 2830}},
  1011. {0, {214, 1009, 1415, 3080}},
  1012. {1, {226, 672, 1084, 2495}},
  1013. {0, {209, 627, 1045, 2504}},
  1014. {0, {250, 500, 1200, 2450}},
  1015. {0, {230, 460, 1150, 2880}},
  1016. {0, {267, 420, 990, 2860}},
  1017. {0, {190, 380, 893, 2920}},
  1018. {0, {246, 610, 1630, 2020}},
  1019. {0, {225, 585, 1700, 1850}},
  1020. {0, {285, 285, 2900, 3500}},
  1021. {0, {286, 310, 2900, 3400}},
  1022. {0, {297, 480, 2670, 3260}},
  1023. {1, {220, 440, 2620, 3380}},
  1024. {0, {173, 550, 2370, 3140}},
  1025. {0, {260, 520, 2340, 3040}},
  1026. {0, {167, 790, 2180, 3020}},
  1027. {0, {280, 840, 2160, 3020}},
  1028. {0, {280, 840, 1400, 2750}},
  1029. {0, {270, 760, 1330, 2950}},
  1030. {0, {252, 900, 1290, 2750}},
  1031. {1, {260, 900, 1240, 3110}},
  1032. {0, {175, 700, 1050, 2750}},
  1033. {0, {190, 720, 1080, 3030}},
  1034. {0, {286, 540, 1200, 2860}},
  1035. {0, {205, 570, 1200, 2970}},
  1036. {0, {328, 400, 980, 2630}},
  1037. {0, {290, 440, 990, 2900}},
  1038. {0, {286, 570, 2000, 2480}},
  1039. {0, {260, 510, 1850, 2350}},
  1040. {0, {170, 340, 2750, 3120}},
  1041. {0, {238, 360, 2760, 3120}},
  1042. {0, {167, 480, 2390, 2950}},
  1043. {1, {194, 520, 2450, 3000}},
  1044. {0, {220, 620, 2520, 2920}},
  1045. {0, {222, 620, 2440, 2880}},
  1046. {0, {222, 1110, 2160, 2700}},
  1047. {0, {214, 1070, 1960, 2750}},
  1048. {1, {217, 820, 1240, 2600}},
  1049. {1, {216, 860, 1300, 2670}},
  1050. {0, {150, 840, 1110, 2930}},
  1051. {0, {170, 850, 1120, 2850}},
  1052. {0, {200, 500, 700, 2930}},
  1053. {0, {212, 380, 720, 2700}},
  1054. {0, {235, 400, 940, 2820}},
  1055. {0, {214, 380, 860, 2680}},
  1056. {0, {196, 330, 760, 2870}},
  1057. {0, {188, 350, 710, 2760}},
  1058. {0, {182, 550, 1780, 2080}},
  1059. {0, {201, 600, 1750, 2000}},
  1060. {0, {200, 320, 2360, 2980}},
  1061. {0, {203, 304, 2380, 3050}},
  1062. {1, {211, 444, 2220, 2740}},
  1063. {1, {210, 420, 2090, 2780}},
  1064. {0, {200, 500, 2350, 2830}},
  1065. {0, {200, 600, 2200, 2700}},
  1066. {1, {192, 845, 1700, 2300}},
  1067. {0, {187, 860, 1724, 2530}},
  1068. {0, {200, 720, 1440, 2380}},
  1069. {0, {191, 707, 1470, 2440}},
  1070. {0, {200, 700, 1080, 2420}},
  1071. {1, {192, 767, 1150, 2590}},
  1072. {0, {200, 600, 860, 2410}},
  1073. {0, {200, 600, 900, 2400}},
  1074. {0, {210, 546, 1090, 2400}},
  1075. {0, {210, 462, 1240, 2310}},
  1076. {0, {257, 360, 930, 2260}},
  1077. {0, {220, 440, 1100, 2300}},
  1078. {0, {200, 540, 1400, 1800}},
  1079. {0, {204, 460, 1350, 1560}},
  1080. {0, {203, 406, 2600, 2945}},
  1081. {1, {200, 400, 2600, 3100}},
  1082. {0, {200, 460, 2300, 2800}},
  1083. {0, {210, 420, 2305, 2835}},
  1084. {0, {190, 570, 2100, 2720}},
  1085. {0, {207, 538, 2175, 2880}},
  1086. {0, {189, 850, 1853, 2685}},
  1087. {0, {193, 830, 1800, 2620}},
  1088. {0, {200, 720, 1500, 2560}},
  1089. {0, {200, 800, 1400, 2420}},
  1090. {0, {194, 915, 1280, 2530}},
  1091. {0, {206, 723, 1196, 2600}},
  1092. {0, {192, 575, 1073, 2490}},
  1093. {0, {200, 600, 1100, 2600}},
  1094. {0, {202, 520, 1210, 2420}},
  1095. {0, {212, 468, 1275, 2550}},
  1096. {0, {207, 370, 1000, 2470}},
  1097. {0, {205, 330, 970, 2460}},
  1098. {0, {200, 560, 1600, 1900}},
  1099. {0, {206, 514, 1540, 1955}},
  1100. {0, {240, 380, 2880, 3360}},
  1101. {0, {250, 380, 2820, 3300}},
  1102. {1, {233, 514, 2600, 2930}},
  1103. {0, {237, 473, 2660, 2970}},
  1104. {0, {223, 567, 2460, 3122}},
  1105. {0, {224, 521, 2460, 2920}},
  1106. {0, {218, 808, 2070, 2880}},
  1107. {1, {203, 678, 2420, 3080}},
  1108. {0, {200, 800, 1340, 2700}},
  1109. {1, {214, 772, 1280, 2660}},
  1110. {0, {183, 843, 1190, 2860}},
  1111. {0, {205, 740, 1160, 2780}},
  1112. {1, {222, 623, 1022, 2700}},
  1113. {0, {220, 594, 990, 2640}},
  1114. {1, {240, 480, 960, 2820}},
  1115. {0, {242, 484, 900, 2640}},
  1116. {0, {233, 370, 933, 2520}},
  1117. {0, {250, 325, 750, 2500}},
  1118. {0, {225, 450, 1680, 2050}},
  1119. {1, {233, 466, 1630, 1865}},
  1120. {0, {200, 320, 2750, 3100}},
  1121. {0, {178, 356, 2755, 3200}},
  1122. {0, {194, 388, 2622, 3050}},
  1123. {0, {194, 426, 2460, 3040}},
  1124. {0, {187, 592, 2242, 2765}},
  1125. {1, {191, 535, 2290, 2870}},
  1126. {1, {188, 750, 2060, 2770}},
  1127. {1, {162, 650, 2110, 2618}},
  1128. {0, {187, 618, 1518, 2700}},
  1129. {0, {183, 624, 1430, 2660}},
  1130. {0, {163, 766, 1180, 2340}},
  1131. {0, {167, 750, 1065, 2640}},
  1132. {1, {170, 595, 918, 2600}},
  1133. {1, {176, 630, 985, 2630}},
  1134. {0, {200, 420, 1200, 2600}},
  1135. {0, {200, 460, 1260, 2640}},
  1136. {0, {187, 375, 1124, 2685}},
  1137. {1, {188, 375, 1143, 2700}},
  1138. {0, {180, 504, 1565, 1835}},
  1139. {0, {183, 513, 1578, 1830}},
  1140. {0, {280, 357, 2800, 3360}},
  1141. {0, {275, 340, 2860, 3350}},
  1142. {0, {290, 480, 2600, 3060}},
  1143. {0, {292, 465, 2598, 3060}},
  1144. {1, {250, 700, 2350, 2980}},
  1145. {0, {240, 737, 2325, 3100}},
  1146. {0, {200, 960, 2100, 3000}},
  1147. {0, {217, 1030, 2200, 3260}},
  1148. {0, {275, 920, 1512, 2950}},
  1149. {0, {260, 910, 1688, 3050}},
  1150. {0, {275, 990, 1237, 2360}},
  1151. {0, {267, 987, 1172, 3180}},
  1152. {0, {267, 587, 1068, 3270}},
  1153. {0, {293, 560, 990, 3150}},
  1154. {1, {275, 520, 1350, 3190}},
  1155. {1, {280, 510, 1415, 3130}},
  1156. {0, {300, 420, 1045, 3060}},
  1157. {0, {300, 390, 960, 3030}},
  1158. {0, {230, 460, 1860, 2250}},
  1159. {0, {214, 504, 1820, 2290}},
  1160. {0, {200, 240, 2760, 3700}},
  1161. {0, {220, 220, 2850, 3800}},
  1162. {0, {228, 319, 2500, 3020}},
  1163. {0, {216, 324, 2500, 3010}},
  1164. {0, {220, 616, 2380, 2900}},
  1165. {0, {212, 615, 2300, 2800}},
  1166. {1, {212, 710, 2120, 2600}},
  1167. {1, {210, 690, 2250, 2680}},
  1168. {0, {221, 800, 1520, 2380}},
  1169. {0, {210, 780, 1470, 2400}},
  1170. {0, {199, 995, 1392, 2290}},
  1171. {0, {200, 1000, 1400, 2440}},
  1172. {0, {205, 656, 944, 2250}},
  1173. {0, {200, 720, 960, 2380}},
  1174. {0, {223, 335, 1049, 2470}},
  1175. {0, {210, 420, 1009, 2300}},
  1176. {0, {219, 329, 877, 2550}},
  1177. {0, {230, 340, 900, 2530}},
  1178. {0, {206, 400, 1380, 1560}},
  1179. {0, {201, 400, 1240, 1480}},
  1180. {0, {220, 286, 2800, 3550}},
  1181. {0, {241, 289, 2800, 3400}},
  1182. {0, {225, 383, 2420, 3080}},
  1183. {0, {240, 384, 2400, 3050}},
  1184. {1, {209, 418, 2430, 3110}},
  1185. {0, {230, 460, 2300, 3050}},
  1186. {0, {187, 861, 2100, 2800}},
  1187. {0, {224, 896, 2040, 3000}},
  1188. {0, {218, 654, 1160, 2800}},
  1189. {0, {230, 690, 1195, 2770}},
  1190. {0, {208, 860, 1103, 2700}},
  1191. {0, {212, 806, 1060, 2850}},
  1192. {0, {202, 606, 910, 2900}},
  1193. {0, {201, 583, 860, 2840}},
  1194. {0, {225, 340, 900, 2650}},
  1195. {0, {235, 470, 1100, 2560}},
  1196. {0, {205, 308, 1025, 2650}},
  1197. {0, {235, 329, 1151, 2560}},
  1198. {0, {213, 533, 1425, 1830}},
  1199. {0, {214, 535, 1412, 1800}},
  1200. {0, {236, 307, 2670, 3150}},
  1201. {0, {245, 340, 2700, 3250}},
  1202. {0, {231, 417, 2300, 3000}},
  1203. {1, {239, 410, 2200, 2910}},
  1204. {1, {222, 644, 2250, 3000}},
  1205. {0, {224, 670, 2300, 2880}},
  1206. {1, {224, 784, 1800, 2750}},
  1207. {1, {234, 820, 1750, 2890}},
  1208. {0, {225, 765, 1300, 2700}},
  1209. {0, {221, 730, 1390, 2790}},
  1210. {1, {225, 834, 1282, 2800}},
  1211. {0, {212, 850, 1270, 2760}},
  1212. {1, {229, 688, 1029, 2750}},
  1213. {0, {222, 670, 1040, 2640}},
  1214. {0, {251, 427, 1506, 2640}},
  1215. {0, {240, 460, 1370, 2610}},
  1216. {0, {236, 378, 1416, 2580}},
  1217. {0, {239, 380, 1430, 2610}},
  1218. {0, {230, 460, 1200, 1909}},
  1219. {0, {225, 410, 1580, 1800}},
  1220. {0, {256, 384, 2860, 3210}},
  1221. {0, {250, 375, 3000, 3400}},
  1222. {0, {230, 460, 2665, 3140}},
  1223. {0, {233, 467, 2680, 3150}},
  1224. {0, {229, 640, 2400, 2860}},
  1225. {0, {233, 630, 2530, 3030}},
  1226. {1, {233, 700, 2560, 3150}},
  1227. {1, {225, 675, 2510, 3145}},
  1228. {1, {240, 768, 1440, 2855}},
  1229. {0, {234, 794, 1447, 2920}},
  1230. {0, {227, 978, 1362, 2724}},
  1231. {0, {233, 933, 1350, 2610}},
  1232. {0, {240, 700, 1080, 2810}},
  1233. {0, {240, 720, 1090, 2840}},
  1234. {0, {243, 500, 1215, 2870}},
  1235. {0, {239, 500, 1240, 2860}},
  1236. {0, {263, 470, 1000, 2820}},
  1237. {0, {272, 378, 950, 2990}},
  1238. {0, {243, 480, 1410, 1700}},
  1239. {0, {243, 493, 1580, 1775}},
  1240. {0, {268, 320, 2900, 3200}},
  1241. {0, {263, 290, 2750, 3050}},
  1242. {1, {258, 460, 2380, 2940}},
  1243. {1, {251, 480, 2260, 2980}},
  1244. {1, {246, 640, 2220, 2900}},
  1245. {1, {250, 670, 2250, 2960}},
  1246. {0, {243, 950, 1970, 2890}},
  1247. {0, {244, 980, 1950, 2920}},
  1248. {1, {251, 750, 1280, 2760}},
  1249. {0, {258, 770, 1340, 2800}},
  1250. {1, {250, 950, 1130, 3160}},
  1251. {1, {256, 850, 1150, 2940}},
  1252. {0, {242, 530, 870, 2680}},
  1253. {0, {250, 600, 900, 2770}},
  1254. {1, {250, 600, 1225, 2500}},
  1255. {1, {264, 630, 1320, 2560}},
  1256. {0, {258, 440, 1290, 2530}},
  1257. {0, {269, 460, 1080, 2640}},
  1258. {0, {250, 600, 1500, 2000}},
  1259. {0, {254, 610, 1520, 1950}},
  1260. {0, {234, 280, 2690, 3040}},
  1261. {0, {261, 280, 2740, 2980}},
  1262. {0, {260, 470, 2500, 3400}},
  1263. {0, {262, 440, 2480, 3240}},
  1264. {0, {242, 730, 2300, 3100}},
  1265. {0, {260, 750, 2340, 3120}},
  1266. {0, {233, 860, 2070, 2880}},
  1267. {0, {240, 890, 1920, 2710}},
  1268. {0, {257, 770, 1540, 2840}},
  1269. {0, {257, 800, 1410, 2860}},
  1270. {0, {240, 790, 1250, 3080}},
  1271. {1, {241, 820, 1210, 2960}},
  1272. {0, {234, 408, 695, 3040}},
  1273. {0, {246, 420, 590, 3100}},
  1274. {0, {251, 500, 1230, 2520}},
  1275. {0, {256, 480, 1230, 2750}},
  1276. {0, {263, 419, 1050, 2850}},
  1277. {0, {278, 390, 1060, 2800}},
  1278. {0, {220, 420, 1720, 1900}},
  1279. {0, {255, 510, 1680, 1890}},
  1280. {0, {208, 270, 2820, 3450}},
  1281. {0, {225, 250, 2880, 3350}},
  1282. {0, {220, 370, 2530, 3060}},
  1283. {0, {250, 400, 2600, 3120}},
  1284. {0, {214, 640, 2360, 3020}},
  1285. {0, {219, 650, 2430, 3040}},
  1286. {0, {205, 900, 2090, 3000}},
  1287. {0, {200, 860, 2160, 2870}},
  1288. {0, {214, 750, 1540, 2800}},
  1289. {0, {214, 770, 1530, 2780}},
  1290. {0, {195, 920, 1350, 2550}},
  1291. {1, {210, 920, 1470, 2690}},
  1292. {0, {194, 720, 1110, 2420}},
  1293. {0, {200, 700, 1100, 2780}},
  1294. {0, {222, 470, 1200, 2900}},
  1295. {0, {237, 470, 1190, 2800}},
  1296. {0, {240, 380, 980, 3100}},
  1297. {0, {188, 340, 920, 3050}},
  1298. {0, {222, 530, 1670, 2050}},
  1299. {0, {200, 500, 1720, 1900}},
  1300. {0, {258, 310, 2740, 3200}},
  1301. {0, {262, 262, 2680, 3170}},
  1302. {0, {262, 450, 2310, 3020}},
  1303. {0, {263, 472, 2270, 2950}},
  1304. {1, {245, 640, 1980, 2920}},
  1305. {1, {235, 700, 2110, 2940}},
  1306. {0, {194, 810, 1860, 2620}},
  1307. {0, {234, 890, 1800, 2700}},
  1308. {1, {230, 710, 1340, 2780}},
  1309. {1, {245, 740, 1470, 2940}},
  1310. {1, {225, 830, 1020, 2650}},
  1311. {1, {219, 830, 1095, 2610}},
  1312. {0, {240, 600, 850, 2760}},
  1313. {0, {253, 455, 810, 2750}},
  1314. {0, {282, 400, 1070, 2530}},
  1315. {0, {250, 450, 1050, 2450}},
  1316. {0, {260, 290, 670, 2380}},
  1317. {0, {275, 330, 630, 2460}},
  1318. {0, {240, 500, 1630, 2040}},
  1319. {0, {243, 490, 1580, 2190}},
  1320. {0, {228, 460, 3300, 3950}},
  1321. {0, {200, 400, 3400, 3850}},
  1322. {1, {205, 600, 2550, 4000}},
  1323. {1, {205, 610, 2500, 4100}},
  1324. {1, {225, 600, 2750, 3600}},
  1325. {1, {210, 760, 2500, 3850}},
  1326. {0, {200, 1000, 2300, 3900}},
  1327. {1, {200, 800, 2500, 4050}},
  1328. {1, {200, 1000, 1750, 3550}},
  1329. {0, {223, 1110, 1690, 4040}},
  1330. {1, {205, 1220, 1560, 3650}},
  1331. {1, {200, 1300, 1800, 3450}},
  1332. {0, {219, 660, 1100, 3850}},
  1333. {1, {217, 690, 1090, 3900}},
  1334. {1, {206, 620, 1420, 3700}},
  1335. {0, {220, 620, 1410, 3520}},
  1336. {0, {233, 440, 900, 3900}},
  1337. {0, {200, 400, 650, 3800}},
  1338. {0, {210, 610, 2300, 2900}},
  1339. {0, {200, 450, 2150, 2550}},
  1340. {0, {290, 320, 3500, 4260}},
  1341. {0, {305, 350, 3400, 4100}},
  1342. {0, {322, 640, 3200, 3660}},
  1343. {0, {325, 650, 3000, 3800}},
  1344. {0, {270, 850, 2900, 3680}},
  1345. {1, {285, 700, 3120, 3750}},
  1346. {0, {256, 1130, 2560, 3500}},
  1347. {0, {285, 1140, 2000, 3560}},
  1348. {0, {310, 1130, 1740, 3670}},
  1349. {0, {300, 1000, 1800, 3450}},
  1350. {1, {265, 1170, 1500, 3440}},
  1351. {1, {283, 980, 1300, 3100}},
  1352. {1, {265, 530, 1060, 3450}},
  1353. {1, {272, 540, 1080, 3000}},
  1354. {0, {285, 560, 1440, 3500}},
  1355. {0, {294, 570, 1450, 3500}},
  1356. {0, {333, 350, 1280, 3650}},
  1357. {0, {290, 340, 1160, 2950}},
  1358. {1, {275, 560, 1740, 2460}},
  1359. {0, {302, 600, 1800, 2200}},
  1360. {0, {240, 380, 3140, 3700}},
  1361. {0, {258, 310, 3350, 3650}},
  1362. {1, {290, 580, 2760, 3400}},
  1363. {0, {250, 500, 2660, 3500}},
  1364. {1, {250, 780, 2450, 3400}},
  1365. {1, {240, 672, 2550, 3400}},
  1366. {1, {240, 660, 2900, 3370}},
  1367. {1, {215, 760, 2850, 3300}},
  1368. {0, {250, 880, 1500, 3200}},
  1369. {0, {243, 850, 1700, 3250}},
  1370. {0, {250, 940, 1380, 2400}},
  1371. {0, {276, 1200, 1500, 3160}},
  1372. {0, {250, 750, 1250, 3450}},
  1373. {0, {225, 675, 950, 3240}},
  1374. {0, {300, 610, 1500, 3300}},
  1375. {0, {275, 500, 1370, 3500}},
  1376. {0, {256, 300, 1280, 3150}},
  1377. {0, {250, 400, 1300, 3700}},
  1378. {0, {250, 500, 1540, 1700}},
  1379. {0, {242, 580, 1620, 1790}},
  1380. {0, {291, 410, 3200, 3800}},
  1381. {0, {264, 420, 3400, 3900}},
  1382. {1, {291, 580, 2900, 3820}},
  1383. {1, {280, 560, 2840, 3900}},
  1384. {1, {292, 810, 2640, 4200}},
  1385. {1, {270, 780, 2720, 4100}},
  1386. {0, {270, 1080, 2480, 3950}},
  1387. {0, {245, 1050, 2420, 4000}},
  1388. {1, {286, 970, 1600, 3950}},
  1389. {1, {250, 800, 1680, 3800}},
  1390. {1, {275, 1040, 1350, 3850}},
  1391. {0, {250, 1100, 1460, 4250}},
  1392. {1, {286, 770, 1150, 3950}},
  1393. {1, {273, 710, 1200, 3900}},
  1394. {1, {285, 680, 1420, 3800}},
  1395. {0, {278, 640, 1350, 3950}},
  1396. {0, {300, 420, 1110, 3640}},
  1397. {0, {280, 505, 1050, 3400}},
  1398. {0, {320, 640, 1940, 2820}},
  1399. {0, {265, 610, 2100, 2600}},
  1400. {0, {330, 460, 2800, 3550}},
  1401. {0, {333, 490, 2730, 3550}},
  1402. {1, {310, 560, 2500, 3450}},
  1403. {1, {310, 580, 2500, 3450}},
  1404. {1, {286, 800, 2300, 3750}},
  1405. {1, {310, 835, 2420, 3740}},
  1406. {0, {282, 950, 2150, 3650}},
  1407. {0, {310, 1000, 2150, 3700}},
  1408. {0, {293, 880, 1700, 3750}},
  1409. {0, {340, 900, 1600, 3650}},
  1410. {1, {299, 990, 1410, 3750}},
  1411. {0, {280, 1050, 1320, 3730}},
  1412. {1, {285, 770, 940, 3750}},
  1413. {1, {333, 680, 1020, 3700}},
  1414. {0, {322, 550, 1195, 3750}},
  1415. {0, {350, 550, 1340, 3500}},
  1416. {1, {316, 600, 1200, 3600}},
  1417. {0, {345, 550, 1100, 3470}},
  1418. {0, {310, 805, 1705, 2420}},
  1419. {0, {310, 710, 1700, 2400}},
  1420. {0, {210, 340, 3400, 4320}},
  1421. {0, {227, 590, 3610, 4220}},
  1422. {0, {235, 680, 3250, 4380}},
  1423. {1, {220, 440, 3000, 3790}},
  1424. {0, {212, 660, 2900, 3610}},
  1425. {1, {216, 610, 2760, 3650}},
  1426. {0, {214, 1240, 2700, 3640}},
  1427. {0, {215, 1050, 2550, 3550}},
  1428. {0, {216, 820, 1470, 3500}},
  1429. {1, {211, 970, 1410, 3200}},
  1430. {0, {218, 1090, 1380, 3050}},
  1431. {1, {212, 860, 1250, 2800}},
  1432. {0, {211, 800, 1220, 3700}},
  1433. {0, {214, 640, 1070, 3000}},
  1434. {0, {219, 660, 1360, 3700}},
  1435. {0, {214, 730, 1500, 3600}},
  1436. {0, {220, 620, 1100, 3250}},
  1437. {0, {216, 600, 1280, 3650}},
  1438. {0, {222, 670, 2130, 2360}},
  1439. {0, {205, 760, 2240, 2460}},
  1440. {0, {253, 330, 3250, 3720}},
  1441. {0, {262, 340, 3100, 3400}},
  1442. {1, {250, 500, 2500, 3640}},
  1443. {1, {278, 530, 2630, 3640}},
  1444. {1, {255, 710, 2550, 3560}},
  1445. {1, {250, 750, 2480, 3470}},
  1446. {0, {233, 1140, 2260, 3640}},
  1447. {0, {245, 1110, 2230, 3380}},
  1448. {0, {256, 770, 1540, 3500}},
  1449. {0, {257, 800, 1490, 3300}},
  1450. {0, {240, 940, 1400, 3400}},
  1451. {1, {245, 930, 1370, 3120}},
  1452. {0, {240, 530, 860, 3400}},
  1453. {0, {240, 520, 910, 3420}},
  1454. {0, {255, 510, 1250, 3320}},
  1455. {0, {260, 520, 1140, 3320}},
  1456. {0, {274, 360, 660, 3050}},
  1457. {0, {260, 310, 730, 3500}},
  1458. {0, {250, 550, 1500, 1800}},
  1459. {0, {239, 480, 1650, 1960}},
  1460. {0, {250, 300, 2950, 3600}},
  1461. {0, {270, 320, 3210, 3600}},
  1462. {0, {290, 550, 2610, 3560}},
  1463. {1, {286, 540, 2570, 3600}},
  1464. {0, {280, 700, 2500, 3580}},
  1465. {0, {263, 600, 2360, 3400}},
  1466. {0, {260, 970, 2400, 3200}},
  1467. {0, {250, 950, 2270, 3200}},
  1468. {0, {270, 780, 1650, 3350}},
  1469. {1, {250, 720, 1500, 3240}},
  1470. {1, {278, 950, 1200, 2950}},
  1471. {1, {250, 920, 1080, 2770}},
  1472. {1, {262, 790, 1050, 2900}},
  1473. {0, {250, 750, 1000, 2500}},
  1474. {0, {275, 540, 1430, 3320}},
  1475. {0, {263, 530, 1580, 3200}},
  1476. {0, {295, 420, 1500, 3010}},
  1477. {0, {260, 450, 1330, 2840}},
  1478. {0, {272, 570, 1880, 2400}},
  1479. {0, {255, 510, 1610, 1910}},
  1480. {0, {235, 280, 2820, 3400}},
  1481. {0, {244, 317, 3125, 3500}},
  1482. {0, {230, 460, 2520, 3300}},
  1483. {0, {212, 420, 2480, 3140}},
  1484. {0, {235, 657, 2300, 3300}},
  1485. {0, {232, 672, 2275, 3300}},
  1486. {0, {231, 808, 1950, 3300}},
  1487. {0, {225, 870, 2000, 3200}},
  1488. {0, {236, 706, 1410, 3200}},
  1489. {0, {211, 720, 1480, 2880}},
  1490. {1, {250, 950, 1350, 3100}},
  1491. {1, {227, 910, 1360, 2950}},
  1492. {0, {203, 700, 1120, 3070}},
  1493. {0, {230, 690, 920, 2760}},
  1494. {0, {250, 475, 1250, 3150}},
  1495. {0, {212, 460, 1210, 2750}},
  1496. {0, {244, 403, 1100, 2950}},
  1497. {0, {242, 363, 920, 2900}},
  1498. {0, {226, 452, 1580, 1810}},
  1499. {0, {232, 510, 1550, 1740}},
  1500. {0, {230, 280, 3140, 3830}},
  1501. {0, {250, 300, 3400, 3950}},
  1502. {1, {225, 450, 2700, 3650}},
  1503. {1, {250, 400, 2840, 3700}},
  1504. {0, {215, 580, 2650, 3550}},
  1505. {1, {220, 620, 2660, 3770}},
  1506. {0, {240, 910, 2370, 3160}},
  1507. {0, {233, 930, 2350, 3450}},
  1508. {0, {250, 770, 1650, 3420}},
  1509. {0, {230, 690, 1600, 3350}},
  1510. {1, {242, 970, 1450, 3260}},
  1511. {1, {225, 1010, 1650, 3150}},
  1512. {0, {232, 670, 1160, 3550}},
  1513. {0, {225, 720, 1260, 3400}},
  1514. {0, {216, 500, 1640, 3580}},
  1515. {0, {250, 450, 1440, 3500}},
  1516. {0, {290, 350, 1160, 3260}},
  1517. {0, {273, 330, 1090, 3350}},
  1518. {0, {240, 430, 1800, 2400}},
  1519. {0, {233, 470, 1840, 2400}},
  1520. {0, {275, 330, 3050, 3800}},
  1521. {0, {286, 340, 2860, 3610}},
  1522. {0, {280, 500, 2720, 3360}},
  1523. {0, {230, 600, 2750, 3550}},
  1524. {0, {245, 735, 2450, 3300}},
  1525. {0, {258, 780, 2560, 3300}},
  1526. {0, {235, 940, 2020, 2580}},
  1527. {0, {232, 1070, 2320, 2900}},
  1528. {0, {268, 860, 1530, 3100}},
  1529. {0, {256, 970, 1500, 3050}},
  1530. {1, {245, 780, 1250, 3180}},
  1531. {1, {236, 970, 970, 3120}},
  1532. {1, {258, 825, 1210, 3100}},
  1533. {1, {300, 930, 930, 2900}},
  1534. {0, {260, 490, 1460, 2860}},
  1535. {0, {286, 570, 1320, 2840}},
  1536. {0, {275, 470, 1400, 2800}},
  1537. {0, {286, 370, 1160, 2800}},
  1538. {0, {268, 510, 1660, 2100}},
  1539. {0, {250, 480, 1700, 1830}},
  1540. {0, {295, 380, 3200, 4000}},
  1541. {0, {267, 350, 3250, 3700}},
  1542. {0, {294, 380, 2960, 3800}},
  1543. {0, {300, 520, 2900, 3600}},
  1544. {0, {280, 670, 2790, 3600}},
  1545. {1, {275, 620, 2750, 3500}},
  1546. {0, {262, 1070, 2380, 3100}},
  1547. {0, {275, 1130, 2320, 3110}},
  1548. {1, {290, 700, 1730, 2960}},
  1549. {0, {270, 725, 1570, 2900}},
  1550. {0, {278, 1110, 1630, 2780}},
  1551. {0, {280, 1130, 1400, 3000}},
  1552. {1, {292, 580, 930, 2950}},
  1553. {0, {270, 540, 1070, 3000}},
  1554. {0, {300, 450, 1350, 3000}},
  1555. {0, {320, 520, 1600, 3150}},
  1556. {0, {307, 460, 1460, 3070}},
  1557. {0, {300, 400, 1700, 3000}},
  1558. {0, {300, 540, 1770, 2040}},
  1559. {0, {286, 540, 2050, 2300}},
  1560. {0, {300, 300, 3250, 3850}},
  1561. {0, {275, 275, 3280, 3800}},
  1562. {0, {286, 570, 2850, 3400}},
  1563. {0, {267, 485, 2630, 3450}},
  1564. {0, {264, 650, 2880, 3500}},
  1565. {0, {284, 570, 2900, 3600}},
  1566. {0, {260, 1300, 2280, 3130}},
  1567. {0, {260, 1300, 2160, 3300}},
  1568. {0, {275, 850, 1540, 3020}},
  1569. {0, {262, 840, 1580, 2880}},
  1570. {0, {250, 1230, 1300, 3200}},
  1571. {0, {286, 1090, 1230, 2980}},
  1572. {0, {265, 850, 850, 2920}},
  1573. {1, {285, 685, 1030, 2900}},
  1574. {0, {283, 540, 1420, 3050}},
  1575. {0, {300, 600, 1440, 2900}},
  1576. {0, {280, 390, 1340, 2830}},
  1577. {0, {284, 340, 1110, 3080}},
  1578. {0, {280, 530, 1650, 1740}},
  1579. {0, {286, 550, 1660, 1770}},
  1580. {0, {265, 370, 2950, 3400}},
  1581. {0, {290, 370, 2910, 3480}},
  1582. {0, {271, 515, 2740, 3280}},
  1583. {0, {290, 485, 2600, 3200}},
  1584. {0, {262, 630, 2520, 3150}},
  1585. {0, {272, 565, 2440, 3120}},
  1586. {0, {262, 970, 2030, 2880}},
  1587. {0, {275, 915, 2130, 2900}},
  1588. {0, {270, 810, 1600, 3230}},
  1589. {1, {280, 760, 1530, 3180}},
  1590. {1, {270, 810, 1350, 2940}},
  1591. {0, {275, 1000, 1360, 3000}},
  1592. {1, {270, 535, 970, 2960}},
  1593. {1, {275, 550, 1080, 2850}},
  1594. {1, {275, 550, 1420, 3040}},
  1595. {0, {295, 570, 1500, 3000}},
  1596. {0, {283, 510, 1700, 3020}},
  1597. {1, {278, 500, 1640, 3050}},
  1598. {0, {261, 522, 1830, 2350}},
  1599. {0, {282, 530, 1800, 2250}},
  1600. {0, {320, 350, 3240, 3760}},
  1601. {0, {344, 344, 3120, 3640}},
  1602. {0, {308, 590, 2760, 3500}},
  1603. {0, {320, 540, 2900, 3500}},
  1604. {0, {307, 830, 2750, 3650}},
  1605. {0, {308, 800, 2640, 3540}},
  1606. {0, {294, 1140, 2450, 3230}},
  1607. {0, {239, 1130, 2550, 3150}},
  1608. {0, {310, 930, 1540, 3120}},
  1609. {0, {315, 950, 1670, 3150}},
  1610. {0, {350, 1190, 1470, 3150}},
  1611. {1, {314, 1070, 1460, 2950}},
  1612. {0, {300, 910, 1200, 3180}},
  1613. {0, {330, 830, 1250, 3250}},
  1614. {0, {327, 630, 1310, 3270}},
  1615. {0, {322, 610, 1550, 3400}},
  1616. {0, {345, 520, 1250, 3460}},
  1617. {0, {334, 500, 1140, 3380}},
  1618. {0, {308, 740, 1850, 2160}},
  1619. {0, {328, 660, 1830, 2200}}
  1620. };
  1621. try {
  1622. autoTable me = Table_create (nrows, ncols);
  1623. for (integer i = 1; i <= nrows; i ++) {
  1624. TableRow row = my rows.at [i];
  1625. int vowel_id = ( (i - 1) % 20) / 2 + 1; /* 1 - 10 */
  1626. int speaker_id = (i - 1) / 20 + 1; /* 1 - 76 */
  1627. int speaker_type, speaker_sex;
  1628. if (speaker_id <= 33) { /* 33 men */
  1629. speaker_type = 0; speaker_sex = 0;
  1630. } else if (speaker_id <= (33 + 28)) { /* 28 women */
  1631. speaker_type = 1; speaker_sex = 1;
  1632. } else { /*15 children */
  1633. speaker_type = 2; speaker_sex = 0;
  1634. if (speaker_id == 62 || speaker_id == 63 ||
  1635. (speaker_id >= 65 && speaker_id <= 68) ||
  1636. speaker_id == 73 || speaker_id == 76) {
  1637. speaker_sex = 1;
  1638. }
  1639. }
  1640. row -> cells [1]. string = Melder_dup (type [speaker_type]);
  1641. row -> cells [2]. string = Melder_dup (sex [speaker_sex]);
  1642. row -> cells [3]. string = Melder_dup (Melder_integer (speaker_id));
  1643. row -> cells [4]. string = Melder_dup (vowel [vowel_id - 1]);
  1644. row -> cells [5]. string = Melder_dup (ipa [vowel_id - 1]);
  1645. for (integer j = 0; j <= 3; j ++) {
  1646. row -> cells [j + 6]. string = Melder_dup (Melder_integer (pbdata [i - 1].f [j]));
  1647. }
  1648. }
  1649. for (integer j = 1; j <= ncols; j ++) {
  1650. Table_setColumnLabel (me.get(), j, columnLabels [j - 1]);
  1651. my columnHeaders [j]. numericized = false;
  1652. }
  1653. return me;
  1654. } catch (MelderError) {
  1655. Melder_throw (U"Table not created from Peterson & Barney data.");
  1656. }
  1657. }
  1658. autoTable Table_create_polsVanNierop1973 () {
  1659. integer nrows = 900, ncols = 10;
  1660. conststring32 columnLabels [10] = {U"Sex", U"Speaker", U"Vowel", U"IPA", U"F1", U"F2", U"F3", U"L1", U"L2", U"L3"};
  1661. conststring32 vowel [12] = {U"oe", U"aa", U"oo", U"a", U"eu", U"ie", U"uu", U"ee", U"u", U"e", U"o", U"i"};
  1662. conststring32 ipa [12] = {U"u", U"a", U"o", U"\\as", U"\\o/", U"i", U"y", U"e", U"\\yc", U"\\ep", U"\\ct", U"\\ic"};
  1663. conststring32 sex [2] = {U"m", U"f"};
  1664. struct polsdatum {
  1665. short f [3]; /* frequency F1, F2, F3 */
  1666. short l [3]; /* level f1, f2, f3 */
  1667. } polsdata [] = {
  1668. /* 50*12 males */
  1669. /* male 1 */
  1670. {{320, 630, 2560}, {6, 13, 48}}, /* poet */
  1671. {{780, 1300, 2460}, {6, 8, 30}}, /* paat */
  1672. {{500, 940, 2420}, {3, 12, 35}}, /* poot */
  1673. {{720, 1060, 2420}, {3, 8, 27}}, /* pat */
  1674. {{430, 1580, 2260}, {2, 24, 36}}, /* peut */
  1675. {{280, 2300, 2780}, {14, 22, 27}}, /* piet */
  1676. {{320, 1680, 2140}, {6, 23, 30}}, /* puut */
  1677. {{420, 2000, 2620}, {5, 20, 23}}, /* peet */
  1678. {{420, 1540, 2380}, {4, 19, 24}}, /* put */
  1679. {{600, 1720, 2700}, {3, 17, 29}}, /* pet */
  1680. {{520, 1000, 2520}, {4, 13, 31}}, /* pot */
  1681. {{350, 2000, 2520}, {7, 19, 18}}, /* pit */
  1682. /* male 2 */
  1683. {{440, 780, 2600}, {7, 20, 35}},
  1684. {{940, 1300, 2780}, {5, 13, 26}},
  1685. {{500, 740, 2700}, {7, 11, 32}},
  1686. {{800, 1000, 2480}, {11, 11, 31}},
  1687. {{460, 1500, 2300}, {10, 20, 20}},
  1688. {{320, 2400, 3040}, {9, 28, 27}},
  1689. {{340, 1600, 2050}, {7, 30, 32}},
  1690. {{420, 2200, 2650}, {4, 10, 12}},
  1691. {{540, 1370, 2320}, {6, 23, 31}},
  1692. {{760, 1660, 2600}, {8, 13, 18}},
  1693. {{560, 800, 2800}, {5, 17, 37}},
  1694. {{430, 2030, 2660}, {7, 18, 17}},
  1695. /* male 3 */
  1696. {{280, 740, 2160}, {8, 32, 46}},
  1697. {{860, 1500, 2580}, {7, 13, 19}},
  1698. {{480, 820, 2280}, {4, 11, 33}},
  1699. {{680, 1020, 2460}, {9, 14, 25}},
  1700. {{360, 1520, 2080}, {5, 16, 21}},
  1701. {{270, 2040, 2860}, {5, 18, 18}},
  1702. {{280, 1600, 1900}, {5, 16, 21}},
  1703. {{380, 1940, 2580}, {5, 15, 17}},
  1704. {{400, 1520, 2120}, {4, 21, 24}},
  1705. {{560, 1840, 2520}, {7, 18, 22}},
  1706. {{500, 820, 2520}, {3, 11, 30}},
  1707. {{350, 2000, 2660}, {4, 15, 19}},
  1708. /* male 4 */
  1709. {{360, 820, 2220}, {6, 11, 30}},
  1710. {{840, 1300, 2280}, {9, 7, 22}},
  1711. {{500, 900, 2320}, {7, 13, 35}},
  1712. {{680, 1000, 2480}, {12, 12, 27}},
  1713. {{440, 1320, 2060}, {5, 12, 27}},
  1714. {{240, 2060, 2580}, {5, 20, 23}},
  1715. {{300, 1540, 2020}, {4, 18, 24}},
  1716. {{460, 1920, 2460}, {7, 18, 17}},
  1717. {{480, 1320, 2200}, {6, 15, 22}},
  1718. {{660, 1660, 2340}, {7, 16, 21}},
  1719. {{500, 800, 2520}, {7, 14, 34}},
  1720. {{440, 1920, 2380}, {3, 19, 18}},
  1721. /* male 5 */
  1722. {{440, 880, 2300}, {6, 22, 41}},
  1723. {{820, 1420, 2180}, {6, 7, 28}},
  1724. {{540, 960, 2460}, {4, 10, 28}},
  1725. {{780, 1040, 2620}, {8, 10, 32}},
  1726. {{540, 1540, 2160}, {2, 17, 19}},
  1727. {{300, 2300, 2900}, {5, 23, 30}},
  1728. {{360, 1860, 2200}, {2, 15, 15}},
  1729. {{520, 1960, 2400}, {4, 21, 21}},
  1730. {{560, 1440, 2280}, {2, 17, 27}},
  1731. {{700, 1720, 2300}, {7, 13, 22}},
  1732. {{600, 880, 3000}, {5, 5, 25}},
  1733. {{560, 1920, 2400}, {5, 22, 25}},
  1734. /* male 6 */
  1735. {{260, 700, 2550}, {3, 24, 45}},
  1736. {{820, 1460, 2760}, {10, 15, 27}},
  1737. {{450, 900, 2460}, {19, 20, 45}},
  1738. {{700, 1080, 2660}, {13, 22, 32}},
  1739. {{460, 1750, 2300}, {7, 32, 40}},
  1740. {{240, 2500, 3000}, {3, 33, 37}},
  1741. {{260, 2100, 2500}, {10, 37, 43}},
  1742. {{300, 2320, 2860}, {8, 26, 26}},
  1743. {{440, 1700, 2660}, {7, 27, 32}},
  1744. {{560, 2080, 2840}, {12, 15, 16}},
  1745. {{550, 900, 2740}, {7, 25, 30}},
  1746. {{340, 2340, 3000}, {8, 31, 31}},
  1747. /* male 7 */
  1748. {{280, 860, 2340}, {5, 15, 33}},
  1749. {{800, 1320, 2540}, {7, 14, 26}},
  1750. {{520, 920, 2600}, {8, 15, 33}},
  1751. {{600, 1000, 2760}, {7, 7, 25}},
  1752. {{450, 1660, 2260}, {7, 20, 24}},
  1753. {{260, 2340, 2640}, {3, 17, 20}},
  1754. {{280, 1780, 2160}, {3, 25, 29}},
  1755. {{400, 2040, 2400}, {9, 19, 21}},
  1756. {{460, 1560, 2400}, {4, 19, 22}},
  1757. {{620, 1760, 2560}, {6, 18, 25}},
  1758. {{560, 960, 2760}, {9, 16, 33}},
  1759. {{340, 2000, 2600}, {6, 14, 18}},
  1760. /* male 8 */
  1761. {{320, 880, 2200}, {6, 16, 40}},
  1762. {{800, 1160, 2600}, {6, 13, 26}},
  1763. {{560, 980, 2360}, {5, 8, 35}},
  1764. {{700, 1080, 2540}, {10, 14, 34}},
  1765. {{500, 1480, 2300}, {8, 17, 29}},
  1766. {{280, 2080, 2620}, {3, 27, 27}},
  1767. {{320, 1760, 2060}, {4, 25, 32}},
  1768. {{400, 1940, 2540}, {9, 17, 22}},
  1769. {{400, 1560, 2280}, {6, 18, 28}},
  1770. {{540, 1860, 2540}, {4, 14, 19}},
  1771. {{560, 920, 2320}, {8, 13, 32}},
  1772. {{340, 1960, 2480}, {6, 13, 17}},
  1773. /* male 9 */
  1774. {{300, 680, 2400}, {3, 19, 32}},
  1775. {{860, 1300, 2660}, {12, 18, 26}},
  1776. {{500, 940, 2500}, {3, 13, 33}},
  1777. {{700, 1120, 2620}, {9, 17, 24}},
  1778. {{500, 1500, 2280}, {3, 17, 22}},
  1779. {{300, 2380, 2960}, {2, 20, 22}},
  1780. {{300, 1760, 2160}, {1, 19, 23}},
  1781. {{480, 2100, 2580}, {4, 15, 15}},
  1782. {{500, 1580, 2400}, {5, 12, 22}},
  1783. {{640, 1700, 2620}, {3, 15, 19}},
  1784. {{560, 900, 2940}, {4, 8, 31}},
  1785. {{400, 2040, 2600}, {7, 17, 19}},
  1786. /* male 10 */
  1787. {{360, 900, 2220}, {11, 21, 46}},
  1788. {{880, 1400, 2660}, {9, 17, 29}},
  1789. {{460, 940, 2400}, {3, 13, 37}},
  1790. {{660, 1040, 2660}, {5, 5, 31}},
  1791. {{460, 1580, 2360}, {4, 22, 26}},
  1792. {{340, 2200, 2920}, {14, 30, 26}},
  1793. {{400, 1880, 2800}, {12, 19, 33}},
  1794. {{460, 2080, 2800}, {4, 18, 17}},
  1795. {{460, 1480, 2260}, {5, 27, 31}},
  1796. {{600, 1860, 2640}, {7, 18, 23}},
  1797. {{520, 860, 2880}, {2, 24, 32}},
  1798. {{460, 2100, 2800}, {6, 19, 22}},
  1799. /* male 11 */
  1800. {{320, 830, 2060}, {5, 16, 45}},
  1801. {{820, 1340, 2200}, {7, 9, 26}},
  1802. {{520, 840, 2040}, {7, 13, 31}},
  1803. {{660, 1060, 2300}, {8, 9, 28}},
  1804. {{440, 1520, 2040}, {7, 16, 22}},
  1805. {{300, 2100, 2600}, {5, 23, 30}},
  1806. {{300, 1740, 2040}, {2, 17, 19}},
  1807. {{340, 2040, 2460}, {5, 20, 24}},
  1808. {{500, 1440, 2200}, {8, 17, 21}},
  1809. {{600, 1760, 2380}, {10, 15, 19}},
  1810. {{560, 900, 2300}, {9, 10, 28}},
  1811. {{300, 1960, 2400}, {7, 22, 24}},
  1812. /* male 12 */
  1813. {{400, 860, 2700}, {7, 15, 46}},
  1814. {{940, 1520, 3040}, {10, 19, 33}},
  1815. {{580, 1040, 2960}, {5, 17, 42}},
  1816. {{860, 1280, 3000}, {8, 19, 34}},
  1817. {{480, 1600, 2620}, {7, 15, 32}},
  1818. {{300, 2500, 2880}, {3, 29, 29}},
  1819. {{300, 1670, 2350}, {3, 31, 39}},
  1820. {{480, 2220, 2640}, {7, 30, 31}},
  1821. {{380, 1600, 2540}, {4, 22, 33}},
  1822. {{630, 2140, 2880}, {7, 27, 27}},
  1823. {{640, 900, 3000}, {8, 13, 39}},
  1824. {{360, 2220, 2780}, {5, 23, 31}},
  1825. /* male 13 */
  1826. {{260, 780, 2460}, {5, 20, 44}},
  1827. {{900, 1560, 2860}, {9, 13, 26}},
  1828. {{440, 850, 2600}, {3, 17, 42}},
  1829. {{860, 1140, 2820}, {10, 12, 30}},
  1830. {{460, 1580, 2400}, {3, 19, 27}},
  1831. {{260, 2560, 3240}, {3, 28, 34}},
  1832. {{300, 1960, 2500}, {2, 31, 29}},
  1833. {{460, 2320, 2960}, {6, 25, 27}},
  1834. {{460, 1600, 2460}, {6, 22, 30}},
  1835. {{680, 2100, 2940}, {14, 19, 25}},
  1836. {{540, 800, 2740}, {7, 13, 36}},
  1837. {{380, 2500, 2980}, {7, 20, 23}},
  1838. /* male 14 */
  1839. {{340, 720, 2500}, {6, 16, 47}},
  1840. {{900, 1500, 3020}, {10, 13, 33}},
  1841. {{450, 900, 2700}, {4, 16, 42}},
  1842. {{600, 1000, 2720}, {12, 10, 31}},
  1843. {{420, 1740, 2560}, {8, 21, 25}},
  1844. {{360, 2500, 3000}, {8, 10, 13}},
  1845. {{360, 1900, 2420}, {6, 16, 12}},
  1846. {{380, 1780, 2420}, {4, 36, 18}},
  1847. {{500, 1640, 2620}, {4, 23, 29}},
  1848. {{600, 1940, 2700}, {3, 16, 19}},
  1849. {{500, 800, 2800}, {3, 10, 38}},
  1850. {{400, 2360, 2740}, {7, 13, 27}},
  1851. /* male 15 */
  1852. {{360, 780, 2320}, {5, 23, 50}},
  1853. {{860, 1420, 2420}, {8, 15, 35}},
  1854. {{440, 840, 2480}, {9, 20, 38}},
  1855. {{660, 980, 2500}, {6, 13, 33}},
  1856. {{460, 1660, 2200}, {2, 21, 31}},
  1857. {{300, 2360, 2960}, {7, 29, 27}},
  1858. {{320, 1740, 2220}, {2, 28, 30}},
  1859. {{400, 2240, 2560}, {5, 23, 24}},
  1860. {{480, 1420, 2220}, {6, 23, 37}},
  1861. {{680, 1640, 2340}, {9, 21, 28}},
  1862. {{560, 860, 2780}, {4, 15, 44}},
  1863. {{440, 2120, 2500}, {2, 22, 23}},
  1864. /* male 16 */
  1865. {{360, 760, 2300}, {7, 23, 52}},
  1866. {{660, 1000, 2500}, {9, 15, 35}},
  1867. {{500, 920, 2520}, {7, 15, 37}},
  1868. {{780, 1060, 2380}, {5, 9, 38}},
  1869. {{440, 1560, 2260}, {7, 25, 31}},
  1870. {{280, 2200, 2880}, {7, 43, 38}},
  1871. {{380, 1720, 2200}, {7, 29, 39}},
  1872. {{360, 2140, 2620}, {3, 26, 28}},
  1873. {{360, 1600, 2400}, {4, 26, 33}},
  1874. {{520, 1800, 2480}, {8, 32, 35}},
  1875. {{540, 920, 2640}, {6, 20, 44}},
  1876. {{340, 2080, 2680}, {3, 28, 27}},
  1877. /* male 17 */
  1878. {{400, 820, 2200}, {5, 15, 48}},
  1879. {{1100, 1480, 2260}, {10, 14, 30}},
  1880. {{520, 940, 2560}, {5, 15, 43}},
  1881. {{660, 940, 2820}, {11, 11, 35}},
  1882. {{500, 1720, 2400}, {5, 19, 23}},
  1883. {{360, 2300, 3260}, {11, 25, 17}},
  1884. {{360, 2100, 2420}, {10, 19, 20}},
  1885. {{440, 2360, 2860}, {6, 20, 25}},
  1886. {{500, 1760, 2600}, {6, 15, 25}},
  1887. {{660, 1840, 2620}, {7, 17, 24}},
  1888. {{540, 860, 2860}, {3, 9, 41}},
  1889. {{400, 2440, 3000}, {5, 28, 30}},
  1890. /* male 18 */
  1891. {{360, 860, 2520}, {6, 15, 35}},
  1892. {{740, 1300, 2660}, {7, 9, 22}},
  1893. {{460, 800, 2620}, {3, 20, 35}},
  1894. {{740, 1040, 2800}, {15, 13, 30}},
  1895. {{440, 1400, 2200}, {4, 21, 25}},
  1896. {{340, 2040, 2500}, {6, 18, 20}},
  1897. {{340, 1340, 2040}, {3, 15, 25}},
  1898. {{420, 1760, 2420}, {6, 18, 21}},
  1899. {{460, 1380, 2200}, {6, 20, 22}},
  1900. {{560, 1640, 2400}, {9, 13, 19}},
  1901. {{540, 920, 2520}, {9, 10, 23}},
  1902. {{400, 1800, 2400}, {8, 19, 21}},
  1903. /* male 19 */
  1904. {{320, 840, 2360}, {5, 20, 45}},
  1905. {{780, 1140, 2740}, {8, 15, 36}},
  1906. {{460, 1020, 2700}, {6, 11, 43}},
  1907. {{800, 1100, 2720}, {15, 17, 42}},
  1908. {{440, 1500, 2500}, {5, 23, 37}},
  1909. {{260, 2000, 2680}, {4, 39, 40}},
  1910. {{300, 1540, 2100}, {5, 33, 42}},
  1911. {{400, 1900, 2680}, {6, 25, 34}},
  1912. {{440, 1500, 2400}, {4, 26, 42}},
  1913. {{600, 1700, 2640}, {18, 33, 40}},
  1914. {{500, 800, 3000}, {5, 20, 47}},
  1915. {{400, 2000, 2500}, {5, 27, 37}},
  1916. /* male 20 */
  1917. {{400, 960, 2400}, {10, 16, 37}},
  1918. {{800, 1220, 2380}, {7, 13, 25}},
  1919. {{500, 1080, 2500}, {10, 14, 31}},
  1920. {{780, 1100, 2600}, {10, 11, 30}},
  1921. {{400, 1480, 2380}, {8, 20, 25}},
  1922. {{280, 2380, 2720}, {6, 23, 24}},
  1923. {{300, 1760, 2220}, {5, 14, 22}},
  1924. {{400, 2000, 2600}, {4, 20, 24}},
  1925. {{440, 1500, 2440}, {4, 15, 20}},
  1926. {{440, 1800, 2620}, {12, 18, 22}},
  1927. {{460, 860, 2600}, {12, 13, 33}},
  1928. {{400, 2040, 2640}, {3, 18, 23}},
  1929. /* male 21 */
  1930. {{300, 700, 2100}, {3, 15, 37}},
  1931. {{800, 1100, 2300}, {11, 15, 30}},
  1932. {{420, 700, 2440}, {5, 12, 33}},
  1933. {{660, 920, 2520}, {6, 9, 32}},
  1934. {{400, 1300, 2000}, {2, 22, 30}},
  1935. {{300, 1940, 2620}, {5, 25, 24}},
  1936. {{260, 1920, 2900}, {4, 21, 31}},
  1937. {{300, 1900, 2340}, {4, 20, 24}},
  1938. {{400, 1200, 2000}, {4, 20, 29}},
  1939. {{540, 1500, 2280}, {4, 15, 22}},
  1940. {{400, 740, 2580}, {3, 11, 34}},
  1941. {{300, 1900, 2380}, {2, 20, 20}},
  1942. /* male 22 */
  1943. {{400, 780, 2500}, {6, 14, 40}},
  1944. {{760, 1260, 2620}, {6, 14, 30}},
  1945. {{540, 860, 2600}, {4, 7, 34}},
  1946. {{660, 1100, 2460}, {9, 12, 30}},
  1947. {{540, 1460, 2260}, {5, 12, 20}},
  1948. {{300, 2300, 2800}, {7, 20, 17}},
  1949. {{300, 1980, 2900}, {6, 14, 32}},
  1950. {{420, 2100, 2600}, {4, 17, 21}},
  1951. {{500, 1440, 2300}, {4, 18, 26}},
  1952. {{540, 1900, 2600}, {10, 20, 22}},
  1953. {{550, 900, 3000}, {5, 11, 34}},
  1954. {{300, 2200, 2700}, {6, 14, 20}},
  1955. /* male 23 */
  1956. {{360, 900, 2140}, {3, 14, 37}},
  1957. {{800, 1250, 2650}, {12, 13, 26}},
  1958. {{520, 960, 2200}, {5, 7, 28}},
  1959. {{760, 1120, 2700}, {12, 10, 29}},
  1960. {{400, 1500, 2160}, {7, 20, 30}},
  1961. {{300, 2260, 3000}, {4, 18, 17}},
  1962. {{320, 1800, 2500}, {6, 17, 32}},
  1963. {{460, 2020, 2800}, {3, 10, 16}},
  1964. {{500, 1500, 2300}, {7, 15, 23}},
  1965. {{640, 1600, 2500}, {8, 22, 32}},
  1966. {{550, 940, 2420}, {7, 12, 40}},
  1967. {{460, 2100, 2880}, {2, 21, 24}},
  1968. /* male 24 */
  1969. {{360, 860, 2460}, {4, 15, 33}},
  1970. {{840, 1400, 2500}, {5, 8, 20}},
  1971. {{460, 900, 2520}, {1, 8, 31}},
  1972. {{620, 1020, 2770}, {7, 6, 26}},
  1973. {{410, 1460, 2360}, {2, 11, 18}},
  1974. {{270, 2140, 2580}, {2, 15, 21}},
  1975. {{300, 1870, 2300}, {1, 11, 16}},
  1976. {{360, 2000, 2520}, {2, 17, 19}},
  1977. {{400, 1520, 2400}, {2, 12, 17}},
  1978. {{600, 1600, 2580}, {3, 12, 20}},
  1979. {{500, 900, 2700}, {2, 11, 33}},
  1980. {{360, 1940, 2550}, {1, 19, 21}},
  1981. /* male 25 */
  1982. {{360, 860, 2200}, {8, 22, 46}},
  1983. {{880, 1240, 2400}, {7, 14, 25}},
  1984. {{460, 920, 3300}, {2, 11, 40}},
  1985. {{600, 1000, 2600}, {4, 7, 32}},
  1986. {{400, 1440, 2160}, {2, 31, 37}},
  1987. {{360, 2240, 2760}, {6, 23, 21}},
  1988. {{380, 1660, 2000}, {13, 16, 26}},
  1989. {{460, 2000, 2520}, {5, 23, 32}},
  1990. {{460, 1500, 2300}, {7, 17, 25}},
  1991. {{540, 1700, 2460}, {10, 22, 35}},
  1992. {{540, 1000, 2600}, {8, 13, 40}},
  1993. {{340, 2040, 2580}, {9, 27, 30}},
  1994. /* male 26 */
  1995. {{400, 800, 2500}, {6, 23, 42}},
  1996. {{960, 1300, 2640}, {9, 8, 29}},
  1997. {{460, 860, 2460}, {7, 16, 39}},
  1998. {{740, 1140, 2400}, {9, 10, 30}},
  1999. {{400, 1600, 2400}, {6, 21, 25}},
  2000. {{360, 2500, 2840}, {10, 19, 20}},
  2001. {{360, 1800, 2400}, {8, 21, 27}},
  2002. {{360, 2080, 2680}, {5, 14, 16}},
  2003. {{400, 1620, 2440}, {5, 15, 21}},
  2004. {{600, 1940, 2600}, {5, 13, 23}},
  2005. {{560, 980, 2900}, {5, 13, 32}},
  2006. {{400, 2060, 2540}, {5, 21, 21}},
  2007. /* male 27 */
  2008. {{300, 900, 2300}, {3, 15, 38}},
  2009. {{780, 1300, 2400}, {9, 18, 32}},
  2010. {{550, 1000, 2480}, {5, 10, 35}},
  2011. {{680, 1050, 2550}, {5, 10, 35}},
  2012. {{520, 1480, 2400}, {5, 16, 27}},
  2013. {{260, 2180, 2560}, {1, 30, 30}},
  2014. {{250, 1720, 2220}, {1, 26, 32}},
  2015. {{360, 2100, 2650}, {4, 31, 25}},
  2016. {{440, 1440, 2440}, {4, 21, 26}},
  2017. {{600, 1600, 2500}, {5, 15, 27}},
  2018. {{560, 950, 2700}, {3, 10, 40}},
  2019. {{360, 1900, 2600}, {3, 26, 31}},
  2020. /* male 28 */
  2021. {{280, 740, 2500}, {3, 20, 45}},
  2022. {{780, 1300, 2840}, {4, 12, 25}},
  2023. {{440, 860, 2860}, {5, 13, 41}},
  2024. {{440, 700, 3040}, {9, 10, 37}},
  2025. {{450, 1520, 2320}, {2, 25, 30}},
  2026. {{220, 2340, 2960}, {1, 35, 36}},
  2027. {{240, 1800, 2140}, {3, 36, 37}},
  2028. {{300, 2200, 2600}, {4, 28, 33}},
  2029. {{440, 1500, 2480}, {3, 26, 37}},
  2030. {{500, 1660, 2620}, {10, 30, 38}},
  2031. {{420, 700, 3000}, {4, 12, 35}},
  2032. {{300, 2140, 2760}, {6, 32, 31}},
  2033. /* male 29 */
  2034. {{340, 660, 2320}, {4, 13, 37}},
  2035. {{640, 1250, 2480}, {10, 16, 29}},
  2036. {{560, 1000, 2480}, {10, 14, 31}},
  2037. {{720, 1150, 2600}, {10, 13, 26}},
  2038. {{480, 1400, 2160}, {9, 22, 28}},
  2039. {{300, 2040, 2640}, {5, 20, 22}},
  2040. {{280, 1540, 1960}, {3, 21, 23}},
  2041. {{460, 1760, 2320}, {7, 19, 20}},
  2042. {{440, 1550, 2200}, {8, 16, 23}},
  2043. {{480, 1660, 1960}, {10, 16, 23}},
  2044. {{480, 840, 2840}, {9, 12, 28}},
  2045. {{400, 1780, 2360}, {7, 20, 23}},
  2046. /* male 30 */
  2047. {{360, 800, 2540}, {1, 11, 40}},
  2048. {{600, 1300, 2600}, {6, 8, 27}},
  2049. {{500, 860, 2440}, {2, 7, 36}},
  2050. {{750, 1140, 2640}, {4, 9, 30}},
  2051. {{460, 1400, 2340}, {1, 23, 28}},
  2052. {{340, 2300, 2620}, {2, 26, 25}},
  2053. {{300, 1540, 2300}, {5, 25, 35}},
  2054. {{440, 2000, 2540}, {1, 14, 19}},
  2055. {{440, 1360, 2360}, {1, 19, 26}},
  2056. {{620, 1840, 2560}, {3, 18, 23}},
  2057. {{520, 820, 2680}, {2, 7, 34}},
  2058. {{420, 2000, 2640}, {1, 20, 25}}, /*L2 (10) corrected 20021211 */
  2059. /* male 31 */
  2060. {{340, 740, 2240}, {5, 15, 44}},
  2061. {{820, 1200, 2250}, {5, 17, 40}},
  2062. {{440, 820, 2540}, {3, 13, 37}},
  2063. {{760, 1060, 2340}, {8, 15, 42}},
  2064. {{460, 1540, 2380}, {3, 21, 25}},
  2065. {{280, 2260, 2620}, {8, 31, 32}},
  2066. {{300, 1800, 2220}, {6, 36, 37}},
  2067. {{460, 1900, 2260}, {3, 34, 31}},
  2068. {{380, 1540, 2400}, {15, 36, 40}},
  2069. {{500, 1740, 2400}, {4, 26, 39}},
  2070. {{460, 840, 2580}, {7, 28, 35}},
  2071. {{320, 2100, 2460}, {7, 30, 27}},
  2072. /* male 32 */
  2073. {{360, 900, 2200}, {5, 18, 39}},
  2074. {{640, 1280, 2340}, {7, 15, 26}},
  2075. {{460, 920, 2360}, {7, 14, 33}},
  2076. {{720, 1200, 2580}, {11, 14, 26}},
  2077. {{420, 1520, 2260}, {6, 17, 23}},
  2078. {{400, 2000, 2560}, {5, 15, 20}},
  2079. {{380, 1700, 2100}, {6, 18, 21}},
  2080. {{440, 1740, 2420}, {4, 14, 17}},
  2081. {{500, 1520, 2440}, {5, 14, 21}},
  2082. {{580, 1540, 2460}, {5, 12, 24}},
  2083. {{580, 1020, 2700}, {9, 13, 30}},
  2084. {{460, 1720, 2400}, {7, 22, 20}},
  2085. /* male 33 */
  2086. {{400, 700, 2600}, {4, 17, 45}},
  2087. {{900, 1440, 2600}, {10, 17, 36}},
  2088. {{460, 860, 2600}, {7, 18, 45}},
  2089. {{680, 1000, 2200}, {7, 13, 39}},
  2090. {{460, 1600, 2540}, {5, 28, 37}},
  2091. {{300, 2260, 2880}, {7, 28, 26}},
  2092. {{320, 1860, 2200}, {7, 22, 28}},
  2093. {{440, 2180, 2660}, {3, 24, 28}},
  2094. {{380, 1560, 2360}, {8, 26, 33}},
  2095. {{620, 1720, 2060}, {6, 21, 28}},
  2096. {{600, 860, 2900}, {12, 18, 37}},
  2097. {{440, 2040, 2600}, {4, 26, 30}},
  2098. /* male 34 */
  2099. {{370, 900, 2230}, {3, 17, 35}},
  2100. {{700, 1200, 2580}, {12, 17, 30}},
  2101. {{500, 840, 2460}, {4, 13, 37}},
  2102. {{720, 1080, 2640}, {7, 13, 37}},
  2103. {{440, 1300, 2220}, {4, 20, 31}},
  2104. {{300, 2040, 2580}, {7, 25, 25}},
  2105. {{320, 1540, 2080}, {8, 21, 23}},
  2106. {{380, 1860, 2450}, {7, 24, 33}},
  2107. {{460, 1200, 2360}, {3, 20, 30}},
  2108. {{580, 1500, 2380}, {9, 22, 25}},
  2109. {{480, 820, 2580}, {8, 15, 32}},
  2110. {{400, 1800, 2360}, {6, 23, 26}},
  2111. /* male 35 */
  2112. {{280, 1040, 2340}, {7, 26, 41}},
  2113. {{820, 1300, 2760}, {10, 15, 32}},
  2114. {{440, 1220, 2580}, {6, 18, 29}},
  2115. {{600, 1040, 2540}, {8, 13, 27}},
  2116. {{420, 1560, 2480}, {6, 22, 26}},
  2117. {{300, 2160, 2700}, {5, 29, 30}},
  2118. {{250, 1760, 2320}, {9, 30, 38}},
  2119. {{440, 1940, 2550}, {5, 25, 28}},
  2120. {{400, 1600, 2460}, {8, 26, 29}},
  2121. {{580, 1820, 2460}, {5, 23, 30}},
  2122. {{460, 860, 2660}, {5, 21, 37}},
  2123. {{400, 2100, 2640}, {8, 27, 27}},
  2124. /* male 36 */
  2125. {{360, 740, 2160}, {2, 21, 40}},
  2126. {{660, 1260, 2540}, {10, 18, 21}},
  2127. {{500, 900, 2600}, {9, 20, 30}},
  2128. {{640, 1000, 2880}, {11, 17, 29}},
  2129. {{460, 1300, 2140}, {8, 19, 25}},
  2130. {{300, 1900, 2580}, {11, 18, 22}},
  2131. {{320, 1660, 2060}, {9, 17, 20}},
  2132. {{400, 1780, 2320}, {8, 20, 21}},
  2133. {{380, 1360, 2200}, {6, 20, 25}},
  2134. {{540, 1600, 2260}, {8, 21, 22}},
  2135. {{540, 860, 2720}, {7, 20, 32}},
  2136. {{400, 1740, 2340}, {5, 22, 23}},
  2137. /* male 37 */
  2138. {{300, 900, 2140}, {5, 21, 39}},
  2139. {{700, 1240, 2460}, {10, 18, 28}},
  2140. {{480, 960, 2140}, {4, 12, 32}},
  2141. {{640, 1120, 2480}, {9, 14, 32}},
  2142. {{460, 1520, 2160}, {4, 18, 25}},
  2143. {{320, 2120, 2600}, {10, 20, 26}},
  2144. {{320, 1800, 2200}, {8, 25, 27}},
  2145. {{320, 1920, 2460}, {8, 21, 27}},
  2146. {{480, 1460, 2260}, {5, 22, 27}},
  2147. {{600, 1600, 2480}, {7, 17, 24}},
  2148. {{500, 950, 2450}, {4, 14, 38}},
  2149. {{460, 1820, 2480}, {6, 18, 26}},
  2150. /* male 38 */
  2151. {{320, 760, 2080}, {11, 23, 41}},
  2152. {{840, 1180, 2700}, {13, 20, 37}},
  2153. {{500, 920, 2400}, {13, 17, 37}},
  2154. {{660, 1060, 2700}, {13, 17, 36}},
  2155. {{440, 1400, 2220}, {5, 32, 37}},
  2156. {{280, 2240, 2700}, {14, 29, 35}},
  2157. {{300, 1640, 2080}, {12, 31, 31}},
  2158. {{440, 2040, 2600}, {11, 19, 24}},
  2159. {{400, 1460, 2160}, {8, 32, 38}},
  2160. {{580, 1700, 1900}, {13, 26, 26}},
  2161. {{500, 840, 2920}, {10, 18, 40}},
  2162. {{360, 2060, 2440}, {7, 21, 27}},
  2163. /* male 39 */
  2164. {{320, 760, 2480}, {9, 21, 46}},
  2165. {{700, 1420, 2680}, {9, 16, 31}},
  2166. {{500, 940, 2500}, {4, 16, 41}},
  2167. {{700, 1060, 2720}, {8, 10, 38}},
  2168. {{440, 1580, 2260}, {11, 34, 39}},
  2169. {{260, 2200, 2700}, {5, 29, 32}},
  2170. {{200, 1600, 2060}, {7, 33, 34}},
  2171. {{400, 2200, 2600}, {13, 29, 31}},
  2172. {{380, 1500, 2220}, {8, 25, 37}},
  2173. {{540, 1750, 2420}, {8, 23, 32}},
  2174. {{520, 820, 2560}, {10, 19, 43}},
  2175. {{400, 1700, 2320}, {3, 38, 23}},
  2176. /* male 40 */
  2177. {{300, 680, 1920}, {7, 28, 48}},
  2178. {{740, 1200, 2550}, {8, 10, 24}},
  2179. {{420, 860, 2420}, {7, 17, 37}},
  2180. {{640, 1120, 2500}, {12, 17, 37}},
  2181. {{360, 1500, 2180}, {3, 27, 35}},
  2182. {{280, 2160, 2920}, {4, 27, 31}},
  2183. {{260, 1560, 2050}, {2, 26, 27}},
  2184. {{360, 2020, 2500}, {4, 26, 28}},
  2185. {{440, 1400, 2320}, {4, 21, 32}},
  2186. {{460, 1660, 2460}, {5, 19, 27}},
  2187. {{500, 840, 2580}, {6, 14, 35}},
  2188. {{360, 1920, 2560}, {3, 31, 31}},
  2189. /* male 41 */
  2190. {{360, 880, 2320}, {2, 12, 43}},
  2191. {{840, 1200, 2500}, {12, 17, 37}},
  2192. {{580, 1060, 2300}, {11, 10, 32}},
  2193. {{580, 1100, 2680}, {8, 12, 33}},
  2194. {{560, 1600, 2200}, {9, 22, 27}},
  2195. {{300, 2260, 2800}, {5, 25, 26}},
  2196. {{320, 1760, 2100}, {5, 23, 25}},
  2197. {{500, 2020, 2660}, {5, 17, 21}},
  2198. {{420, 1520, 2320}, {1, 20, 28}},
  2199. {{700, 1800, 2620}, {8, 17, 22}},
  2200. {{540, 860, 2720}, {7, 13, 35}},
  2201. {{420, 2080, 2600}, {4, 21, 25}},
  2202. /* male 42 */
  2203. {{420, 800, 2400}, {5, 15, 40}},
  2204. {{800, 1400, 2900}, {9, 16, 41}},
  2205. {{420, 820, 2480}, {5, 8, 40}},
  2206. {{600, 1200, 2760}, {6, 12, 34}},
  2207. {{400, 1560, 2120}, {2, 20, 31}},
  2208. {{320, 2360, 2820}, {8, 25, 27}},
  2209. {{340, 1680, 2240}, {9, 19, 35}},
  2210. {{400, 2180, 2760}, {2, 19, 20}},
  2211. {{400, 1440, 2360}, {3, 15, 26}},
  2212. {{700, 1700, 2340}, {11, 18, 29}},
  2213. {{500, 780, 2840}, {7, 14, 38}},
  2214. {{380, 2120, 2720}, {2, 21, 25}},
  2215. /* male 43 */
  2216. {{300, 760, 2020}, {3, 16, 38}},
  2217. {{740, 1200, 2360}, {8, 15, 29}},
  2218. {{460, 860, 2200}, {8, 12, 39}},
  2219. {{620, 900, 2500}, {8, 12, 27}},
  2220. {{400, 1340, 2100}, {7, 20, 31}},
  2221. {{240, 2000, 2340}, {2, 22, 28}},
  2222. {{240, 1580, 1860}, {3, 16, 24}},
  2223. {{360, 1640, 2080}, {5, 19, 26}},
  2224. {{400, 1340, 2060}, {3, 16, 28}},
  2225. {{580, 1400, 2120}, {6, 13, 24}},
  2226. {{500, 800, 2460}, {6, 6, 31}},
  2227. {{440, 1720, 2100}, {7, 19, 24}},
  2228. /* male 44 */
  2229. {{260, 800, 2400}, {3, 16, 48}},
  2230. {{780, 1300, 2700}, {6, 14, 28}},
  2231. {{480, 900, 2500}, {5, 8, 35}},
  2232. {{620, 1000, 2820}, {5, 9, 28}},
  2233. {{420, 1400, 2300}, {3, 18, 29}},
  2234. {{240, 2040, 2680}, {1, 31, 28}},
  2235. {{260, 1580, 2260}, {3, 31, 28}},
  2236. {{380, 2000, 2600}, {5, 29, 26}},
  2237. {{420, 1420, 2400}, {2, 21, 26}},
  2238. {{540, 1640, 2440}, {5, 19, 26}},
  2239. {{480, 840, 2800}, {6, 13, 32}},
  2240. {{280, 1960, 2560}, {5, 27, 28}},
  2241. /* male 45 */
  2242. {{300, 840, 3060}, {3, 10, 38}},
  2243. {{800, 1220, 2280}, {6, 10, 26}},
  2244. {{500, 920, 2120}, {6, 8, 31}},
  2245. {{700, 1020, 2600}, {3, 11, 28}},
  2246. {{400, 1260, 2020}, {6, 17, 24}},
  2247. {{260, 1960, 2440}, {1, 22, 22}},
  2248. {{300, 1480, 1940}, {2, 18, 22}},
  2249. {{440, 1880, 2380}, {6, 17, 17}},
  2250. {{320, 1400, 2140}, {5, 18, 27}},
  2251. {{500, 1560, 2300}, {7, 18, 22}},
  2252. {{540, 780, 2400}, {8, 13, 34}},
  2253. {{360, 1860, 2300}, {4, 20, 21}},
  2254. /* male 46 */
  2255. {{320, 860, 2380}, {3, 19, 41}},
  2256. {{660, 1400, 2540}, {11, 20, 27}},
  2257. {{520, 940, 2580}, {7, 11, 34}},
  2258. {{700, 1040, 2720}, {4, 8, 23}},
  2259. {{400, 1600, 2280}, {2, 27, 29}},
  2260. {{320, 2340, 3140}, {3, 33, 29}},
  2261. {{300, 1860, 2160}, {2, 25, 25}},
  2262. {{420, 2200, 2760}, {1, 17, 23}},
  2263. {{460, 2320, 3360}, {2, 33, 37}},
  2264. {{500, 2100, 2760}, {6, 23, 38}},
  2265. {{600, 920, 2700}, {8, 17, 29}},
  2266. {{420, 2200, 2740}, {3, 30, 32}},
  2267. /* male 47 */
  2268. {{360, 800, 2120}, {3, 18, 33}},
  2269. {{700, 1220, 2760}, {6, 13, 27}},
  2270. {{540, 940, 2640}, {2, 8, 33}},
  2271. {{620, 1080, 2800}, {4, 10, 33}},
  2272. {{500, 1400, 2200}, {6, 18, 25}},
  2273. {{320, 2240, 2940}, {2, 22, 27}},
  2274. {{320, 1800, 2100}, {1, 26, 27}},
  2275. {{420, 2040, 2400}, {3, 19, 24}},
  2276. {{460, 1440, 2140}, {1, 13, 25}},
  2277. {{600, 1600, 2520}, {6, 13, 27}},
  2278. {{560, 700, 2780}, {5, 11, 31}},
  2279. {{440, 1920, 2560}, {3, 22, 24}},
  2280. /* male 48 */
  2281. {{300, 760, 1900}, {3, 17, 42}},
  2282. {{800, 1260, 2740}, {7, 10, 28}},
  2283. {{460, 840, 1840}, {4, 13, 38}},
  2284. {{540, 900, 2400}, {10, 14, 28}},
  2285. {{420, 1380, 2100}, {2, 16, 29}},
  2286. {{220, 2080, 2900}, {2, 28, 21}},
  2287. {{220, 1760, 2120}, {1, 22, 25}},
  2288. {{440, 2060, 2780}, {1, 19, 21}},
  2289. {{440, 1440, 2560}, {3, 19, 31}},
  2290. {{580, 1400, 2100}, {5, 15, 22}},
  2291. {{520, 900, 2300}, {3, 10, 32}},
  2292. {{420, 1720, 2720}, {6, 22, 21}},
  2293. /* male 49 */
  2294. {{320, 1000, 2220}, {3, 24, 43}},
  2295. {{700, 1280, 2500}, {3, 13, 30}},
  2296. {{460, 1060, 2380}, {4, 13, 31}},
  2297. {{620, 1100, 2840}, {10, 18, 33}},
  2298. {{340, 1440, 2260}, {4, 21, 30}},
  2299. {{280, 2140, 2580}, {3, 31, 32}},
  2300. {{280, 1820, 2220}, {2, 36, 35}},
  2301. {{340, 2100, 2500}, {2, 29, 31}},
  2302. {{380, 1460, 2400}, {2, 26, 38}},
  2303. {{500, 1640, 2500}, {7, 27, 31}},
  2304. {{500, 960, 2720}, {4, 17, 31}},
  2305. {{420, 1960, 2700}, {1, 32, 32}},
  2306. /* male 50 */
  2307. {{340, 780, 2020}, {11, 22, 36}},
  2308. {{660, 1220, 2500}, {9, 14, 22}},
  2309. {{420, 760, 2440}, {2, 17, 33}},
  2310. {{560, 1000, 2600}, {6, 13, 25}},
  2311. {{400, 1320, 2120}, {8, 18, 21}},
  2312. {{300, 1860, 2440}, {6, 22, 22}},
  2313. {{280, 1600, 1900}, {6, 16, 19}},
  2314. {{340, 1740, 2260}, {3, 12, 17}},
  2315. {{400, 1360, 2160}, {4, 16, 22}},
  2316. {{520, 1580, 2240}, {2, 12, 16}},
  2317. {{380, 800, 2560}, {7, 11, 25}},
  2318. {{360, 1740, 2260}, {5, 14, 17}},
  2319. /* 25*12 females */
  2320. {{250, 800, 2450}, {0, 8, 45}}, /* poet */
  2321. {{950, 1500, 2650}, {5, 14, 30}}, /* paat */
  2322. {{500, 1050, 2600}, {3, 5, 38}}, /* poot */
  2323. {{720, 1100, 2950}, {8, 2, 24}}, /* pat */
  2324. {{500, 1800, 2500}, {6, 14, 30}}, /* peut */
  2325. {{280, 2500, 3100}, {0, 32, 26}}, /* piet */
  2326. {{250, 1700, 2200}, {0, 18, 21}}, /* puut */
  2327. {{500, 2350, 2750}, {2, 12, 12}}, /* peet */
  2328. {{520, 1550, 2400}, {4, 15, 27}}, /* put */
  2329. {{750, 2000, 2600}, {4, 20, 20}}, /* pet */
  2330. {{550, 900, 2800}, {6, 3, 34}}, /* pot */
  2331. {{480, 2150, 2650}, {5, 20, 22}}, /* pit */
  2332. /* female 2 */
  2333. {{300, 750, 2700}, {0, 10, 50}},
  2334. {{1100, 1500, 3000}, {6, 9, 28}}, /* djmw 20021212 L3 (was 20) */
  2335. {{520, 900, 2800}, {2, 8, 30}},
  2336. {{800, 1150, 3000}, {2, 12, 34}}, /* djmw 20021212 F3 (was 300 in Van Nierop data!)*/
  2337. {{450, 1600, 2950}, {2, 22, 31}},
  2338. {{250, 2700, 3300}, {0, 27, 31}},
  2339. {{300, 1900, 2650}, {0, 23, 33}},
  2340. {{550, 2300, 3000}, {0, 17, 22}},
  2341. {{450, 1900, 2800}, {0, 20, 32}},
  2342. {{700, 2150, 3100}, {0, 22, 30}},
  2343. {{600, 950, 2800}, {0, 10, 40}},
  2344. {{350, 2450, 2900}, {0, 27, 28}},
  2345. /* female 3 */
  2346. {{350, 800, 2700}, {0, 19, 50}},
  2347. {{1000, 1450, 2800}, {7, 7, 34}},
  2348. {{500, 1000, 2600}, {4, 11, 45}},
  2349. {{650, 1000, 2700}, {7, 1, 29}},
  2350. {{460, 1650, 2400}, {2, 21, 35}},
  2351. {{250, 2450, 2900}, {0, 30, 26}},
  2352. {{250, 1750, 2500}, {0, 22, 31}},
  2353. {{480, 2600, 3600}, {4, 22, 33}},
  2354. {{450, 1650, 2600}, {2, 16, 32}},
  2355. {{650, 2450, 2800}, {6, 19, 20}},
  2356. {{650, 1050, 2800}, {1, 10, 42}},
  2357. {{350, 2600, 3200}, {0, 24, 35}},
  2358. /* female 4 */
  2359. {{350, 750, 2500}, {1, 10, 36}},
  2360. {{1000, 1550, 2900}, {6, 14, 18}},
  2361. {{450, 950, 2450}, {2, 6, 30}},
  2362. {{800, 1100, 3200}, {6, 6, 26}},
  2363. {{450, 1900, 2400}, {3, 14, 14}},
  2364. {{250, 2450, 3050}, {0, 15, 22}},
  2365. {{300, 1900, 2350}, {0, 12, 15}},
  2366. {{450, 2250, 2850}, {3, 16, 12}},
  2367. {{430, 1700, 2650}, {2, 12, 17}},
  2368. {{600, 2250, 2950}, {4, 12, 15}},
  2369. {{600, 850, 3200}, {4, 3, 30}},
  2370. {{430, 2500, 3000}, {2, 16, 24}},
  2371. /* female 5 */
  2372. {{300, 900, 2700}, {0, 12, 42}},
  2373. {{750, 1600, 2800}, {2, 15, 24}},
  2374. {{480, 950, 2600}, {2, 13, 32}},
  2375. {{800, 1200, 2900}, {3, 13, 30}},
  2376. {{430, 1500, 2600}, {1, 20, 25}},
  2377. {{250, 2800, 3150}, { -1, 22, 32}},
  2378. {{300, 1400, 2500}, {0, 24, 28}},
  2379. {{420, 2400, 2900}, {2, 27, 27}},
  2380. {{500, 1650, 2850}, {1, 16, 25}},
  2381. {{750, 1900, 3000}, {4, 25, 30}},
  2382. {{600, 1200, 2850}, {3, 17, 23}},
  2383. {{490, 1950, 2900}, {2, 29, 28}},
  2384. /* female 6 */
  2385. {{300, 750, 2350}, {2, 8, 37}}, /* djmw 20021212 L2 (was 0) */
  2386. {{950, 1400, 2400}, {2, 12, 23}},
  2387. {{650, 1100, 2200}, {4, 8, 34}}, /* djmw 20021212 L2 (was 0) */
  2388. {{900, 1100, 2600}, {2, 6, 26}}, /* djmw 20021212 L3 (was 20) */
  2389. {{490, 1700, 2400}, {1, 18, 24}}, /* djmw 20021212 L2 (was 14) */
  2390. {{300, 2500, 2800}, {0, 16, 21}},
  2391. {{300, 1800, 2400}, {0, 10, 14}},
  2392. {{470, 2400, 2750}, {2, 17, 19}},
  2393. {{570, 1750, 2550}, {0, 17, 18}}, /* djmw 20021212 L3 (was 19) */
  2394. {{700, 1750, 2400}, {0, 10, 16}},
  2395. {{600, 1200, 2500}, {0, 18, 28}}, /* djmw 20021212 L2,3 (was 10,20) */
  2396. {{440, 2250, 2700}, {0, 17, 18}},
  2397. /* female 7 */
  2398. {{350, 850, 2600}, { -1, 16, 38}},
  2399. {{950, 1200, 2900}, {7, 9, 40}},
  2400. {{550, 1050, 2500}, {2, 6, 38}},
  2401. {{850, 1200, 2800}, { -1, 12, 39}},
  2402. {{440, 1800, 2500}, {0, 24, 30}},
  2403. {{300, 2300, 3000}, { -1, 22, 30}},
  2404. {{350, 1850, 2400}, { -1, 23, 27}},
  2405. {{460, 2400, 2900}, {1, 28, 30}}, /* djmw 20021212 L2 (was 20) */
  2406. {{490, 1650, 2700}, {1, 22, 28}},
  2407. {{650, 1700, 2750}, {2, 28, 28}}, /* djmw 20021212 L2 (was 20) */
  2408. {{450, 700, 3000}, {6, 2, 33}}, /* djmw 20021212 L2 (was 8) */
  2409. {{440, 2550, 3000}, {1, 40, 41}},
  2410. /* female 8 */
  2411. {{350, 1000, 2500}, {2, 19, 40}},
  2412. {{950, 1400, 2700}, {8, 14, 29}},
  2413. {{500, 950, 2450}, {6, 10, 34}},
  2414. {{850, 1230, 2950}, {8, 19, 42}},
  2415. {{520, 1650, 2600}, {6, 22, 28}},
  2416. {{250, 2500, 3000}, {0, 25, 30}},
  2417. {{250, 1750, 2300}, {0, 23, 29}},
  2418. {{510, 2250, 2850}, {4, 30, 24}},
  2419. {{650, 1600, 2600}, {6, 18, 26}},
  2420. {{720, 1750, 2650}, {4, 19, 27}},
  2421. {{750, 1150, 2650}, {2, 15, 37}},
  2422. {{510, 2050, 2950}, {2, 22, 23}},
  2423. /* female 9 */
  2424. {{300, 850, 2650}, {0, 14, 43}},
  2425. {{950, 1350, 2700}, {4, 6, 25}},
  2426. {{550, 900, 2700}, {5, 4, 37}},
  2427. {{930, 1300, 2800}, {0, 15, 35}},
  2428. {{550, 1500, 2400}, {0, 10, 22}},
  2429. {{280, 2450, 3000}, {0, 13, 21}},
  2430. {{300, 1650, 2400}, {0, 26, 32}},
  2431. {{530, 2400, 3000}, {0, 4, 14}},
  2432. {{600, 1600, 2000}, {0, 14, 16}},
  2433. {{850, 1950, 2800}, {1, 12, 19}},
  2434. {{750, 1050, 2900}, {2, 4, 32}},
  2435. {{550, 2300, 2800}, {1, 14, 22}},
  2436. /* female 10 */
  2437. {{350, 800, 2500}, {0, 21, 44}},
  2438. {{1100, 1450, 2900}, {5, 9, 31}},
  2439. {{400, 850, 2600}, {0, 5, 46}},
  2440. {{750, 1050, 2950}, {4, 9, 25}},
  2441. {{420, 1650, 2550}, {0, 17, 38}},
  2442. {{300, 2450, 3050}, { -1, 28, 35}},
  2443. {{280, 1850, 2500}, { -1, 20, 30}},
  2444. {{420, 2400, 2800}, {1, 25, 29}},
  2445. {{420, 1500, 2350}, {0, 22, 34}},
  2446. {{650, 1850, 2800}, {2, 28, 31}},
  2447. {{550, 800, 2800}, {4, 7, 44}},
  2448. {{420, 2350, 2750}, {2, 27, 28}},
  2449. /* female 11 */
  2450. {{300, 800, 2850}, { -1, 22, 54}},
  2451. {{1150, 1550, 2850}, {6, 9, 26}},
  2452. {{600, 1000, 2700}, {3, 9, 30}},
  2453. {{750, 1100, 2700}, {2, 10, 34}},
  2454. {{500, 1800, 2550}, {3, 17, 24}},
  2455. {{250, 2400, 3100}, {0, 27, 35}},
  2456. {{250, 2000, 3650}, {0, 30, 36}},
  2457. {{420, 2400, 2900}, {5, 28, 31}}, /* djmw 20021212 L2,3 (was 20,34) */
  2458. {{470, 1700, 2500}, {4, 26, 37}}, /* djmw 20021212 L2 (was 20) */
  2459. {{700, 1880, 2650}, {2, 21, 26}},
  2460. {{650, 900, 2650}, {5, 4, 33}},
  2461. {{490, 2250, 2650}, {3, 22, 26}},
  2462. /* female 12 */
  2463. {{300, 900, 2500}, { -1, 20, 39}},
  2464. {{950, 1500, 2700}, {3, 16, 20}},
  2465. {{450, 1000, 2650}, {2, 8, 35}},
  2466. {{600, 1050, 2800}, {4, 4, 33}},
  2467. {{420, 1650, 2500}, {1, 14, 22}},
  2468. {{250, 2300, 2850}, {0, 30, 24}},
  2469. {{300, 1800, 2300}, { -1, 21, 28}},
  2470. {{400, 2100, 2700}, {0, 29, 20}},
  2471. {{420, 1650, 2450}, {0, 17, 28}},
  2472. {{550, 1800, 2650}, {2, 19, 20}},
  2473. {{450, 1050, 2800}, {2, 10, 26}},
  2474. {{420, 1850, 2700}, {0, 27, 26}},
  2475. /* female 13 */
  2476. {{300, 850, 2800}, {0, 19, 47}},
  2477. {{1100, 1400, 2800}, {6, 10, 25}},
  2478. {{550, 900, 2900}, {2, 16, 44}},
  2479. {{700, 1050, 2750}, {4, 6, 33}},
  2480. {{490, 1700, 2500}, {0, 33, 35}},
  2481. {{300, 2500, 2950}, {0, 40, 35}},
  2482. {{300, 1900, 2450}, {0, 24, 36}},
  2483. {{500, 2500, 3000}, {4, 31, 32}},
  2484. {{460, 1450, 2500}, {6, 33, 38}},
  2485. {{700, 1700, 2700}, {1, 18, 30}},
  2486. {{500, 800, 2700}, {2, 6, 38}},
  2487. {{550, 2250, 2750}, {3, 28, 26}},
  2488. /* female 14 */
  2489. {{350, 900, 3600}, {0, 16, 44}},
  2490. {{950, 1420, 2950}, {5, 7, 26}},
  2491. {{400, 1000, 2400}, {0, 12, 36}},
  2492. {{600, 950, 2650}, {4, 7, 31}},
  2493. {{420, 1400, 2500}, {1, 21, 24}},
  2494. {{300, 2500, 2850}, {0, 26, 27}},
  2495. {{250, 1450, 2200}, {0, 29, 36}},
  2496. {{420, 1950, 2700}, {0, 20, 20}},
  2497. {{410, 1550, 2400}, {0, 20, 28}},
  2498. {{600, 1650, 2600}, {3, 9, 21}},
  2499. {{430, 880, 2950}, {2, 6, 32}},
  2500. {{410, 1950, 2250}, {0, 31, 30}},
  2501. /* female 15 */
  2502. {{350, 1000, 2350}, {0, 29, 41}},
  2503. {{850, 1100, 2800}, {2, 5, 25}},
  2504. {{600, 1000, 2800}, {2, 6, 30}},
  2505. {{850, 1400, 2600}, {1, 20, 31}},
  2506. {{470, 2000, 2550}, {2, 16, 18}},
  2507. {{250, 2650, 3250}, {0, 31, 40}},
  2508. {{300, 2000, 2400}, {0, 23, 24}},
  2509. {{430, 2400, 2900}, {1, 22, 27}},
  2510. {{460, 1900, 2500}, {2, 25, 28}},
  2511. {{650, 1900, 2900}, {2, 19, 23}},
  2512. {{600, 900, 2400}, {3, 7, 35}},
  2513. {{460, 2400, 2900}, {1, 26, 27}},
  2514. /* female 16 */
  2515. {{300, 850, 3300}, {0, 20, 52}},
  2516. {{1050, 1400, 2450}, {6, 8, 31}},
  2517. {{500, 950, 2400}, {4, 10, 44}},
  2518. {{850, 1050, 2850}, {6, 7, 37}},
  2519. {{480, 1650, 2300}, {2, 14, 32}},
  2520. {{300, 3000, 4200}, {0, 32, 36}},
  2521. {{300, 1900, 2450}, {0, 27, 37}},
  2522. {{460, 2450, 3000}, {1, 32, 30}},
  2523. {{500, 1550, 3100}, {2, 18, 40}},
  2524. {{650, 1800, 2700}, {2, 22, 32}},
  2525. {{450, 750, 2850}, {4, 2, 38}},
  2526. {{440, 2200, 2900}, {0, 30, 29}},
  2527. /* female 17 */
  2528. {{320, 850, 2500}, {0, 18, 50}}, /* djmw 20021212 L2 (was 10) */
  2529. {{1100, 1350, 2900}, {7, 9, 25}},
  2530. {{450, 900, 2600}, {2, 8, 39}}, /* djmw 20021212 L3 (was 30) */
  2531. {{800, 1200, 2800}, {2, 14, 32}},
  2532. {{480, 1800, 2500}, {2, 24, 29}},
  2533. {{300, 2600, 3000}, {0, 32, 32}},
  2534. {{300, 1900, 2400}, {0, 25, 28}},
  2535. {{460, 2300, 2900}, {2, 26, 29}},
  2536. {{480, 1800, 2650}, {2, 27, 28}}, /* djmw 20021212 L3 (was 20) */
  2537. {{650, 1850, 3000}, {4, 22, 34}},
  2538. {{550, 800, 2850}, {4, 4, 30}},
  2539. {{470, 2200, 3000}, {2, 28, 33}}, /* djmw 20021212 L2 (was 20) */
  2540. /* female 18 */
  2541. {{350, 750, 2550}, {0, 14, 48}}, /* djmw 20021212 L3 (was 40) */
  2542. {{1050, 1700, 2850}, {0, 14, 22}},
  2543. {{550, 1000, 2600}, {3, 4, 32}},
  2544. {{750, 1150, 2950}, {5, 3, 30}},
  2545. {{550, 1750, 2600}, {2, 12, 19}},
  2546. {{300, 2400, 3000}, {0, 21, 22}},
  2547. {{300, 1950, 2500}, {0, 18, 22}},
  2548. {{510, 2200, 3000}, {1, 24, 27}},
  2549. {{490, 1750, 2450}, {2, 23, 29}},
  2550. {{600, 2200, 3000}, {3, 14, 23}},
  2551. {{700, 850, 2900}, {6, 6, 38}},
  2552. {{540, 2200, 3000}, {9, 22, 22}},
  2553. /* female 19 */
  2554. {{350, 950, 2800}, {0, 24, 51}},
  2555. {{1000, 1500, 2900}, {6, 10, 26}},
  2556. {{450, 950, 2800}, {2, 16, 48}},
  2557. {{700, 1050, 3000}, {5, 5, 35}},
  2558. {{450, 1700, 2450}, {4, 23, 28}},
  2559. {{250, 2600, 3000}, {0, 28, 34}},
  2560. {{330, 1900, 2700}, {0, 30, 42}},
  2561. {{520, 2500, 2900}, {2, 28, 30}},
  2562. {{450, 1700, 2800}, {1, 24, 30}},
  2563. {{700, 1850, 3000}, {2, 23, 24}},
  2564. {{600, 900, 3150}, {2, 12, 38}},
  2565. {{490, 2400, 3100}, {2, 35, 31}},
  2566. /* female 20 */
  2567. {{300, 950, 2650}, {1, 21, 29}},
  2568. {{680, 1250, 2600}, {3, 23, 50}},
  2569. {{400, 850, 2700}, {3, 16, 44}},
  2570. {{500, 1050, 3000}, {4, 13, 42}},
  2571. {{390, 1550, 2500}, {2, 28, 35}},
  2572. {{250, 2300, 2900}, {0, 36, 38}},
  2573. {{250, 1950, 3600}, {0, 34, 45}},
  2574. {{420, 2100, 2600}, {2, 25, 34}},
  2575. {{420, 2100, 2600}, {2, 26, 34}},
  2576. {{600, 1500, 2800}, {5, 25, 36}},
  2577. {{450, 750, 2800}, {2, 11, 48}},
  2578. {{440, 2050, 2700}, {1, 27, 38}},
  2579. /* female 21 */
  2580. {{330, 750, 2900}, {1, 8, 44}},
  2581. {{1150, 1500, 2750}, {3, 8, 35}},
  2582. {{530, 950, 2850}, {0, 8, 40}},
  2583. {{850, 1050, 3000}, {5, 5, 36}},
  2584. {{500, 1700, 2700}, {0, 20, 31}},
  2585. {{300, 2600, 3100}, { -1, 23, 28}},
  2586. {{300, 1800, 2400}, {0, 22, 27}},
  2587. {{520, 2550, 3050}, {0, 22, 26}},
  2588. {{520, 1650, 2550}, {0, 20, 28}},
  2589. {{700, 1850, 2900}, {0, 16, 24}},
  2590. {{650, 1100, 2900}, { -1, 11, 36}},
  2591. {{450, 2300, 2800}, {0, 16, 17}},
  2592. /* female 22 */
  2593. {{300, 850, 2800}, {0, 15, 42}},
  2594. {{1080, 1400, 2750}, {2, 3, 21}},
  2595. {{480, 950, 2300}, {0, 6, 30}},
  2596. {{800, 1100, 2800}, {3, 3, 28}},
  2597. {{470, 1800, 2500}, {0, 12, 23}},
  2598. {{300, 2350, 2850}, { -1, 31, 31}},
  2599. {{300, 2100, 2600}, { -1, 25, 31}},
  2600. {{460, 2600, 2900}, {0, 20, 23}},
  2601. {{470, 1800, 2500}, {0, 16, 29}},
  2602. {{600, 2000, 2700}, {2, 13, 11}},
  2603. {{500, 750, 2650}, {4, 2, 24}},
  2604. {{500, 2300, 2750}, {0, 20, 22}},
  2605. /* female 23 */
  2606. {{350, 700, 2800}, {0, 10, 46}},
  2607. {{950, 1500, 2900}, {0, 19, 23}},
  2608. {{530, 980, 2850}, {0, 14, 34}},
  2609. {{750, 1100, 3000}, {4, 1, 27}},
  2610. {{520, 1800, 2450}, {2, 20, 25}},
  2611. {{300, 2550, 2950}, {0, 22, 24}},
  2612. {{300, 1950, 2450}, {0, 30, 31}},
  2613. {{500, 2300, 2800}, {0, 21, 29}},
  2614. {{550, 1700, 2750}, {0, 21, 24}},
  2615. {{650, 1850, 2700}, { -1, 16, 20}},
  2616. {{650, 980, 2650}, {1, 4, 34}},
  2617. {{500, 2400, 2800}, {4, 16, 18}},
  2618. /* female 24 */
  2619. {{300, 900, 2900}, {0, 12, 45}},
  2620. {{900, 1650, 2850}, {1, 6, 23}},
  2621. {{500, 900, 2300}, {0, 4, 39}},
  2622. {{750, 1150, 2750}, {2, 6, 27}},
  2623. {{550, 1650, 2500}, {0, 16, 24}},
  2624. {{300, 2500, 2850}, {0, 27, 34}},
  2625. {{250, 1850, 2300}, {0, 30, 26}},
  2626. {{490, 2400, 2850}, {2, 16, 18}},
  2627. {{520, 1800, 2450}, {3, 22, 23}},
  2628. {{650, 2100, 2800}, {2, 14, 13}},
  2629. {{550, 1100, 3900}, {2, 11, 32}},
  2630. {{510, 2350, 2950}, {1, 24, 23}}, /* djmw 20021212 L3 (was 33) */
  2631. /* female 25 */
  2632. {{300, 800, 3700}, {0, 13, 50}}, /* djmw 20021212 L2 (was 17) */
  2633. {{1000, 1450, 2650}, {4, 7, 24}},
  2634. {{550, 1000, 2850}, {8, 10, 43}},
  2635. {{750, 1050, 3000}, {2, 6, 33}},
  2636. {{500, 1550, 2400}, {4, 16, 25}},
  2637. {{250, 2400, 2950}, {0, 26, 24}},
  2638. {{300, 1800, 2400}, {0, 26, 26}},
  2639. {{490, 2300, 2800}, {8, 15, 20}},
  2640. {{550, 1550, 2500}, {1, 14, 25}},
  2641. {{700, 1950, 2750}, {0, 4, 13}},
  2642. {{630, 980, 2850}, {5, 7, 39}},
  2643. {{490, 2300, 2900}, {4, 17, 22}}
  2644. };
  2645. try {
  2646. autoTable me = Table_create (nrows, ncols);
  2647. for (integer i = 1; i <= nrows; i ++) {
  2648. TableRow row = my rows.at [i];
  2649. int vowel_id = ( (i - 1) % 12) + 1; /* 1 - 12 */
  2650. int speaker_id = (i - 1) / 12 + 1; /* 1 - 75 */
  2651. int speaker_sex = ( speaker_id <= 50 ? 0 : 1 );
  2652. row -> cells [1]. string = Melder_dup (sex [speaker_sex]);
  2653. row -> cells [2]. string = Melder_dup (Melder_integer (speaker_id));
  2654. row -> cells [3]. string = Melder_dup (vowel [vowel_id - 1]);
  2655. row -> cells [4]. string = Melder_dup (ipa [vowel_id - 1]);
  2656. for (integer j = 0; j <= 2; j ++) {
  2657. row -> cells [j + 5]. string = Melder_dup (Melder_integer (polsdata [i - 1]. f [j]));
  2658. row -> cells [j + 8]. string = Melder_dup (Melder_integer (polsdata [i - 1]. l [j]));
  2659. }
  2660. }
  2661. for (integer j = 1; j <= ncols; j ++) {
  2662. Table_setColumnLabel (me.get(), j, columnLabels [j - 1]);
  2663. my columnHeaders [j]. numericized = false;
  2664. }
  2665. return me;
  2666. } catch (MelderError) {
  2667. Melder_throw (U"Table not created from Pols & van Nierop data.");
  2668. }
  2669. }
  2670. autoTable Table_create_weenink1983 () {
  2671. integer nrows = 360, ncols = 9;
  2672. conststring32 columnLabels [9] = {U"Type", U"Sex", U"Speaker", U"Vowel", U"IPA", U"F0", U"F1", U"F2", U"F3"};
  2673. conststring32 type [3] = {U"m", U"w", U"c"};
  2674. /* Our order: "oe", "o", "oo", "a", "aa", "u", "eu", "uu", "ie", "i", "ee", "e"
  2675. to Pols & van Nierop order */
  2676. int order [13] = { 0, 1, 5, 3, 4, 7, 9, 8, 11, 6, 12, 2, 10};
  2677. conststring32 vowel [13] = {U"", U"oe", U"aa", U"oo", U"a", U"eu", U"ie", U"uu", U"ee", U"u", U"e", U"o", U"i"};
  2678. conststring32 ipa [13] = {U"", U"u", U"a", U"o", U"\\as", U"\\o/", U"i", U"y", U"e", U"\\yc", U"\\ep", U"\\ct", U"\\ic"};
  2679. conststring32 sex [2] = {U"m", U"f"};
  2680. struct weeninkdatum {
  2681. short f [4]; // f0, f1, f2, f3
  2682. } weeninkdata [] = {
  2683. {{182, 335, 748, 2332}},
  2684. {{170, 435, 669, 2886}},
  2685. {{164, 488, 911, 2362}},
  2686. {{170, 671, 1005, 2822}},
  2687. {{160, 787, 1372, 3313}},
  2688. {{165, 396, 1624, 2374}},
  2689. {{165, 472, 1585, 2344}},
  2690. {{180, 293, 1791, 2177}},
  2691. {{176, 314, 2149, 3215}},
  2692. {{164, 393, 2120, 2694}},
  2693. {{161, 454, 1982, 2673}},
  2694. {{165, 502, 1902, 2632}},
  2695. /* Speaker 2 */
  2696. {{161, 308, 709, 2222}},
  2697. {{155, 461, 760, 2632}},
  2698. {{148, 510, 907, 2532}},
  2699. {{153, 645, 1004, 2604}},
  2700. {{145, 758, 1244, 2658}},
  2701. {{155, 449, 1489, 2279}},
  2702. {{145, 454, 1388, 2308}},
  2703. {{162, 314, 1620, 2111}},
  2704. {{158, 303, 1984, 2835}},
  2705. {{150, 429, 1888, 2502}},
  2706. {{156, 460, 1748, 2442}},
  2707. {{150, 580, 1679, 2383}},
  2708. /* Speaker 3 */
  2709. {{124, 343, 719, 2107}},
  2710. {{124, 519, 818, 1975}},
  2711. {{125, 532, 937, 2044}},
  2712. {{126, 721, 1135, 2077}},
  2713. {{125, 850, 1328, 2299}},
  2714. {{131, 390, 1307, 2177}},
  2715. {{129, 481, 1438, 2203}},
  2716. {{127, 270, 1705, 2068}},
  2717. {{121, 275, 2081, 2882}},
  2718. {{129, 377, 2044, 2638}},
  2719. {{131, 464, 1949, 2536}},
  2720. {{124, 645, 1854, 2488}},
  2721. /* Speaker 4 */
  2722. {{119, 322, 590, 2146}},
  2723. {{110, 438, 703, 2392}},
  2724. {{106, 489, 845, 2157}},
  2725. {{120, 708, 1126, 2302}},
  2726. {{107, 818, 1333, 2312}},
  2727. {{109, 406, 1505, 2133}},
  2728. {{109, 422, 1518, 2116}},
  2729. {{115, 298, 1581, 2162}},
  2730. {{119, 268, 2189, 2950}},
  2731. {{109, 400, 2151, 2870}},
  2732. {{108, 420, 2075, 2495}},
  2733. {{108, 550, 1905, 2383}},
  2734. /* Speaker 5 */
  2735. {{132, 282, 656, 2355}},
  2736. {{118, 462, 662, 2852}},
  2737. {{117, 482, 797, 2531}},
  2738. {{115, 723, 1036, 2456}},
  2739. {{117, 732, 1356, 2562}},
  2740. {{118, 454, 1516, 2178}},
  2741. {{119, 466, 1484, 2139}},
  2742. {{129, 271, 1642, 2154}},
  2743. {{122, 255, 2390, 2787}},
  2744. {{120, 353, 2114, 2507}},
  2745. {{114, 441, 2020, 2392}},
  2746. {{122, 601, 1858, 2315}},
  2747. /* Speaker 6 */
  2748. {{155, 275, 560, 2397}},
  2749. {{141, 395, 705, 2802}},
  2750. {{149, 419, 831, 1824}},
  2751. {{142, 674, 1113, 2455}},
  2752. {{137, 696, 1262, 2778}},
  2753. {{148, 419, 1493, 2242}},
  2754. {{148, 422, 1599, 2319}},
  2755. {{157, 291, 1585, 2160}},
  2756. {{152, 281, 2324, 3124}},
  2757. {{144, 358, 2269, 2936}},
  2758. {{146, 426, 2174, 2786}},
  2759. {{140, 560, 1941, 2722}},
  2760. /* Speaker 7 */
  2761. {{165, 315, 703, 2304}},
  2762. {{138, 531, 837, 2338}},
  2763. {{130, 471, 838, 2391}},
  2764. {{135, 713, 1218, 2466}},
  2765. {{140, 807, 1478, 2390}},
  2766. {{126, 467, 1639, 2227}},
  2767. {{135, 504, 1520, 2268}},
  2768. {{151, 341, 1738, 2246}},
  2769. {{145, 302, 2255, 2887}},
  2770. {{140, 379, 2183, 2614}},
  2771. {{133, 400, 2198, 2551}},
  2772. {{137, 587, 2024, 2516}},
  2773. /* Speaker 8 */
  2774. {{179, 361, 730, 2256}},
  2775. {{168, 500, 714, 2782}},
  2776. {{165, 495, 961, 2405}},
  2777. {{162, 642, 988, 2308}},
  2778. {{156, 921, 1409, 2909}},
  2779. {{166, 451, 1482, 2657}},
  2780. {{175, 505, 1546, 2443}},
  2781. {{177, 341, 1705, 2291}},
  2782. {{176, 285, 2288, 2817}},
  2783. {{173, 364, 2126, 2907}},
  2784. {{153, 492, 2102, 2778}},
  2785. {{158, 628, 1777, 2903}},
  2786. /* Speaker 9 */
  2787. {{180, 358, 700, 2672}},
  2788. {{177, 524, 759, 2784}},
  2789. {{169, 557, 856, 2727}},
  2790. {{178, 685, 1075, 2677}},
  2791. {{168, 855, 1311, 2701}},
  2792. {{170, 499, 1496, 2725}},
  2793. {{170, 502, 1385, 2112}},
  2794. {{178, 348, 1504, 2129}},
  2795. {{176, 318, 2252, 2846}},
  2796. {{169, 422, 2186, 2816}},
  2797. {{159, 509, 1941, 2732}},
  2798. {{165, 582, 1920, 2773}},
  2799. /* Speaker 10 */
  2800. {{161, 277, 592, 2493}},
  2801. {{141, 490, 718, 2757}},
  2802. {{137, 392, 692, 2512}},
  2803. {{142, 642, 991, 2707}},
  2804. {{144, 753, 1306, 2617}},
  2805. {{140, 388, 1570, 2175}},
  2806. {{139, 357, 1675, 2105}},
  2807. {{156, 248, 1846, 2117}},
  2808. {{148, 258, 2280, 3350}},
  2809. {{149, 367, 2129, 2731}},
  2810. {{142, 357, 2163, 2624}},
  2811. {{143, 581, 1865, 2572}},
  2812. /* Speaker 11 */
  2813. {{282, 305, 842, 2366}},
  2814. {{273, 557, 986, 2677}},
  2815. {{277, 606, 1090, 2422}},
  2816. {{274, 819, 1327, 2819}},
  2817. {{277, 938, 1580, 2953}},
  2818. {{278, 503, 1826, 2518}},
  2819. {{274, 579, 1630, 2501}},
  2820. {{286, 312, 2065, 3737}},
  2821. {{282, 291, 2540, 3225}},
  2822. {{278, 506, 2270, 3040}},
  2823. {{277, 559, 2245, 2846}},
  2824. {{277, 770, 2137, 2919}},
  2825. /* Speaker 12 */
  2826. {{255, 307, 738, 2529}},
  2827. {{265, 505, 938, 2641}},
  2828. {{228, 524, 1067, 2510}},
  2829. {{233, 902, 1183, 2603}},
  2830. {{215, 841, 1504, 2712}},
  2831. {{239, 464, 1655, 2556}},
  2832. {{234, 443, 1754, 2607}},
  2833. {{245, 303, 1762, 2460}},
  2834. {{241, 277, 2439, 3407}},
  2835. {{262, 490, 2371, 3198}},
  2836. {{228, 484, 2044, 2593}},
  2837. {{234, 495, 2296, 3204}},
  2838. /* Speaker 13 */
  2839. {{298, 309, 627, 3029}},
  2840. {{267, 785, 918, 2956}},
  2841. {{259, 600, 948, 2684}},
  2842. {{257, 893, 1136, 2844}},
  2843. {{245, 1028, 1498, 2715}},
  2844. {{258, 501, 1746, 2529}},
  2845. {{265, 536, 1799, 2601}},
  2846. {{280, 282, 1391, 2520}},
  2847. {{270, 275, 2664, 3174}},
  2848. {{260, 511, 2320, 2882}},
  2849. {{255, 506, 2482, 2846}},
  2850. {{258, 783, 2027, 2606}},
  2851. /* Speaker 14 */
  2852. {{187, 327, 586, 2463}},
  2853. {{177, 520, 690, 2828}},
  2854. {{175, 540, 956, 2599}},
  2855. {{178, 596, 1023, 2750}},
  2856. {{184, 692, 1382, 2432}},
  2857. {{186, 397, 1658, 2422}},
  2858. {{175, 512, 1674, 2458}},
  2859. {{186, 291, 1737, 2236}},
  2860. {{203, 271, 2299, 3260}},
  2861. {{187, 369, 2263, 2903}},
  2862. {{182, 471, 2057, 2729}},
  2863. {{196, 593, 2122, 2779}},
  2864. /* Speaker 15 */
  2865. {{263, 448, 830, 2687}},
  2866. {{230, 570, 1010, 2614}},
  2867. {{244, 595, 1109, 2686}},
  2868. {{240, 806, 1386, 2591}},
  2869. {{239, 890, 1574, 2965}},
  2870. {{244, 482, 1900, 2710}},
  2871. {{251, 502, 1529, 2716}},
  2872. {{238, 436, 2134, 2626}},
  2873. {{254, 374, 2580, 3181}},
  2874. {{252, 494, 2323, 2989}},
  2875. {{242, 484, 2323, 3025}},
  2876. {{246, 595, 1897, 2865}},
  2877. /* Speaker 16 */
  2878. {{238, 325, 737, 2290}},
  2879. {{224, 462, 764, 2600}},
  2880. {{202, 577, 944, 2651}},
  2881. {{216, 674, 1084, 2851}},
  2882. {{210, 833, 1333, 2256}},
  2883. {{214, 427, 1708, 2346}},
  2884. {{202, 502, 1546, 2326}},
  2885. {{242, 289, 1669, 2169}},
  2886. {{232, 337, 2060, 2841}},
  2887. {{224, 416, 2217, 2769}},
  2888. {{214, 491, 1950, 2674}},
  2889. {{188, 548, 2071, 2727}},
  2890. /* Speaker 17 */
  2891. {{277, 313, 578, 2457}},
  2892. {{254, 549, 855, 2793}},
  2893. {{250, 608, 904, 2724}},
  2894. {{267, 890, 1294, 2732}},
  2895. {{263, 1047, 1578, 2848}},
  2896. {{289, 549, 1728, 2844}},
  2897. {{258, 508, 1747, 2799}},
  2898. {{284, 287, 1982, 2793}},
  2899. {{268, 268, 2873, 4075}},
  2900. {{258, 440, 2590, 3090}},
  2901. {{248, 489, 2529, 3111}},
  2902. {{261, 606, 2078, 2980}},
  2903. /* Speaker 18 */
  2904. {{330, 334, 729, 3332}},
  2905. {{247, 629, 864, 3024}},
  2906. {{234, 521, 935, 2760}},
  2907. {{264, 964, 1246, 3112}},
  2908. {{261, 1008, 1573, 2932}},
  2909. {{278, 509, 1887, 2596}},
  2910. {{243, 487, 1799, 2393}},
  2911. {{303, 306, 1781, 2415}},
  2912. {{282, 296, 2597, 3571}},
  2913. {{217, 425, 2636, 3314}},
  2914. {{250, 490, 2642, 3494}},
  2915. {{275, 787, 2326, 2992}},
  2916. /* Speaker 19 */
  2917. {{228, 322, 661, 2721}},
  2918. {{214, 589, 821, 2729}},
  2919. {{219, 457, 857, 2582}},
  2920. {{229, 801, 1260, 2911}},
  2921. {{220, 898, 1628, 2770}},
  2922. {{233, 463, 1630, 2306}},
  2923. {{225, 456, 1671, 2381}},
  2924. {{225, 283, 1779, 2211}},
  2925. {{224, 276, 2495, 3372}},
  2926. {{224, 440, 2385, 3007}},
  2927. {{216, 435, 2363, 2866}},
  2928. {{212, 637, 2130, 3029}},
  2929. /* Speaker 20 */
  2930. {{246, 324, 730, 2644}},
  2931. {{230, 636, 923, 2757}},
  2932. {{233, 534, 954, 2542}},
  2933. {{234, 820, 1256, 3064}},
  2934. {{248, 966, 1695, 2890}},
  2935. {{237, 484, 1753, 2718}},
  2936. {{240, 480, 1917, 2670}},
  2937. {{247, 291, 1981, 2701}},
  2938. {{243, 290, 2648, 3176}},
  2939. {{256, 501, 2358, 3058}},
  2940. {{238, 469, 2406, 3008}},
  2941. {{236, 693, 2128, 2991}},
  2942. /* Speaker 21 */
  2943. {{342, 353, 758, 3269}},
  2944. {{309, 627, 976, 3256}},
  2945. {{334, 663, 1017, 3075}},
  2946. {{321, 964, 1576, 3186}},
  2947. {{316, 1129, 2249, 3404}},
  2948. {{330, 650, 2336, 3284}},
  2949. {{311, 636, 2083, 3328}},
  2950. {{331, 357, 2389, 3185}},
  2951. {{332, 337, 2960, 3595}},
  2952. {{351, 586, 2833, 3595}},
  2953. {{312, 621, 2839, 3614}},
  2954. {{309, 765, 2755, 3636}},
  2955. /* Speaker 22 */
  2956. {{326, 359, 682, 2948}},
  2957. {{318, 631, 795, 3537}},
  2958. {{296, 688, 1135, 2930}},
  2959. {{285, 746, 1135, 1926}},
  2960. {{290, 1006, 2166, 3263}},
  2961. {{326, 632, 1990, 3042}},
  2962. {{285, 570, 2015, 3155}},
  2963. {{321, 324, 2025, 3104}},
  2964. {{338, 346, 3069, 3573}},
  2965. {{320, 636, 3025, 3709}},
  2966. {{306, 611, 2770, 3648}},
  2967. {{331, 893, 2639, 3566}},
  2968. /* Speaker 23 */
  2969. {{312, 414, 828, 2908}},
  2970. {{314, 609, 936, 3139}},
  2971. {{305, 659, 1201, 3015}},
  2972. {{298, 890, 1303, 3003}},
  2973. {{300, 1150, 2116, 3205}},
  2974. {{275, 537, 1968, 3032}},
  2975. {{277, 534, 1997, 3009}},
  2976. {{304, 398, 2298, 2940}},
  2977. {{302, 330, 3010, 3746}},
  2978. {{312, 547, 2965, 3673}},
  2979. {{275, 551, 2786, 3442}},
  2980. {{299, 641, 2662, 3410}},
  2981. /* Speaker 24 */
  2982. {{301, 315, 812, 3357}},
  2983. {{316, 621, 960, 3701}},
  2984. {{305, 604, 1179, 3659}},
  2985. {{331, 981, 1701, 3374}},
  2986. {{322, 954, 2010, 3291}},
  2987. {{297, 581, 2085, 3288}},
  2988. {{307, 613, 1991, 3392}},
  2989. {{322, 331, 2099, 3096}},
  2990. {{326, 326, 3235, 3935}},
  2991. {{307, 547, 2747, 3618}},
  2992. {{308, 613, 2763, 3710}},
  2993. {{315, 622, 2459, 3616}},
  2994. /* Speaker 25 */
  2995. {{360, 417, 981, 3610}},
  2996. {{354, 697, 1017, 3077}},
  2997. {{363, 741, 1302, 3381}},
  2998. {{340, 1028, 1611, 2973}},
  2999. {{337, 1122, 1930, 3068}},
  3000. {{310, 608, 2105, 3177}},
  3001. {{323, 628, 1929, 3197}},
  3002. {{378, 384, 2255, 2992}},
  3003. {{363, 363, 3235, 4069}},
  3004. {{338, 527, 2698, 3458}},
  3005. {{308, 643, 2603, 3382}},
  3006. {{326, 712, 2351, 3498}},
  3007. /* Speaker 26 */
  3008. {{375, 380, 798, 3316}},
  3009. {{371, 456, 759, 3321}},
  3010. {{324, 656, 1118, 3296}},
  3011. {{340, 1031, 1690, 3163}},
  3012. {{376, 1154, 1920, 3519}},
  3013. {{362, 604, 2162, 3603}},
  3014. {{342, 679, 2035, 3683}},
  3015. {{371, 374, 2042, 3206}},
  3016. {{349, 361, 3082, 3782}},
  3017. {{357, 499, 2899, 3934}},
  3018. {{324, 646, 2820, 3970}},
  3019. {{353, 706, 2785, 3942}},
  3020. /* Speaker 27 */
  3021. {{312, 339, 850, 4356}},
  3022. {{319, 619, 919, 3570}},
  3023. {{288, 576, 1156, 3681}},
  3024. {{301, 865, 1567, 3326}},
  3025. {{296, 914, 2090, 3113}},
  3026. {{297, 589, 2150, 3208}},
  3027. {{287, 580, 2146, 3340}},
  3028. {{303, 330, 2431, 3032}},
  3029. {{291, 313, 3090, 4039}},
  3030. {{305, 539, 3015, 3905}},
  3031. {{291, 577, 2589, 2778}},
  3032. {{307, 616, 2448, 3856}},
  3033. /* Speaker 28 */
  3034. {{353, 354, 1085, 3082}},
  3035. {{343, 617, 990, 3027}},
  3036. {{281, 822, 1180, 2931}},
  3037. {{324, 993, 1424, 2941}},
  3038. {{297, 1192, 1792, 2922}},
  3039. {{314, 444, 2170, 3044}},
  3040. {{275, 608, 1817, 2909}},
  3041. {{355, 358, 2138, 3160}},
  3042. {{321, 323, 3169, 3625}},
  3043. {{315, 499, 2831, 3465}},
  3044. {{303, 608, 2707, 3369}},
  3045. {{313, 718, 2479, 3627}},
  3046. /* Speaker 29 */
  3047. {{361, 363, 1050, 3239}},
  3048. {{365, 666, 1094, 3269}},
  3049. {{327, 830, 1289, 3145}},
  3050. {{325, 963, 1293, 3046}},
  3051. {{356, 1163, 1707, 3188}},
  3052. {{377, 580, 2191, 3234}},
  3053. {{336, 673, 2339, 3167}},
  3054. {{342, 345, 2344, 3103}},
  3055. {{341, 346, 2729, 3370}},
  3056. {{326, 541, 2568, 3297}},
  3057. {{331, 677, 2561, 3320}},
  3058. {{354, 897, 2463, 3338}},
  3059. /* Speaker 30 */
  3060. {{332, 352, 979, 2988}},
  3061. {{286, 596, 973, 2690}},
  3062. {{304, 753, 1174, 3005}},
  3063. {{290, 884, 1432, 2806}},
  3064. {{347, 1060, 2079, 2706}},
  3065. {{303, 592, 2069, 2889}},
  3066. {{299, 644, 1775, 3005}},
  3067. {{296, 329, 2082, 2791}},
  3068. {{315, 326, 2807, 3612}},
  3069. {{298, 561, 2612, 3330}},
  3070. {{281, 569, 2415, 3239}},
  3071. {{280, 709, 2460, 3314}}
  3072. };
  3073. try {
  3074. autoTable me = Table_create (nrows, ncols);
  3075. for (integer i = 1; i <= nrows; i ++) {
  3076. TableRow row = my rows.at [i];
  3077. int speaker_id = (i - 1) / 12 + 1; // 1 - 30
  3078. int vowel_id = (i - 1) % 12 + 1; // 1 - 12
  3079. int index_in_data = (speaker_id - 1) * 12 + order [vowel_id] - 1;
  3080. int speaker_type, speaker_sex;
  3081. if (speaker_id <= 10) { // 10 men
  3082. speaker_type = 0; speaker_sex = 0;
  3083. } else if (speaker_id <= 20) { // 10 women
  3084. speaker_type = 1; speaker_sex = 1;
  3085. } else { // 10 children
  3086. speaker_type = 2; speaker_sex = 0; // which children were m/f
  3087. }
  3088. row -> cells [1]. string = Melder_dup (type [speaker_type]);
  3089. row -> cells [2]. string = Melder_dup (sex [speaker_sex]);
  3090. row -> cells [3]. string = Melder_dup (Melder_integer (speaker_id));
  3091. row -> cells [4]. string = Melder_dup (vowel [vowel_id]);
  3092. row -> cells [5]. string = Melder_dup (ipa [vowel_id]);
  3093. for (integer j = 0; j <= 3; j ++) {
  3094. row -> cells [j + 6]. string = Melder_dup (Melder_integer (weeninkdata [index_in_data]. f [j]));
  3095. }
  3096. }
  3097. for (integer j = 1; j <= ncols; j ++) {
  3098. Table_setColumnLabel (me.get(), j, columnLabels [j - 1]);
  3099. my columnHeaders [j]. numericized = false;
  3100. }
  3101. return me;
  3102. } catch (MelderError) {
  3103. Melder_throw (U"Table not created from Weenink data.");
  3104. }
  3105. }
  3106. // Keating& Esposito (2006),
  3107. autoTable Table_create_esposito2006 () {
  3108. try {
  3109. autoTable me = Table_createWithColumnNames (10, U"Language Modal Breathy");
  3110. Table_setStringValue (me.get(), 1, 1, U"Chong");
  3111. Table_setNumericValue (me.get(), 1, 2, -1.5);
  3112. Table_setNumericValue (me.get(), 1, 3, 5);
  3113. Table_setStringValue (me.get(), 2, 1, U"Fuzhou");
  3114. Table_setNumericValue (me.get(), 2, 2, -1.5);
  3115. Table_setNumericValue (me.get(), 2, 3, 5);
  3116. Table_setStringValue (me.get(), 3, 1, U"Green Hmong");
  3117. Table_setNumericValue (me.get(), 3, 2, 3);
  3118. Table_setNumericValue (me.get(), 3, 3, 12);
  3119. Table_setStringValue (me.get(), 4, 1, U"White Hmong");
  3120. Table_setNumericValue (me.get(), 4, 2, 2);
  3121. Table_setNumericValue (me.get(), 4, 3, 11);
  3122. Table_setStringValue (me.get(), 5, 1, U"Mon");
  3123. Table_setNumericValue (me.get(), 5, 2, -1.5);
  3124. Table_setNumericValue (me.get(), 5, 3, 0);
  3125. Table_setStringValue (me.get(), 6, 1, U"SADV Zapotec");
  3126. Table_setNumericValue (me.get(), 6, 2, -6);
  3127. Table_setNumericValue (me.get(), 6, 3, -4);
  3128. Table_setStringValue (me.get(), 7, 1, U"SLQ Zapotec");
  3129. Table_setNumericValue (me.get(), 7, 2, 3.5);
  3130. Table_setNumericValue (me.get(), 7, 3, 14);
  3131. Table_setStringValue (me.get(), 8, 1, U"Tlacolula Zapotec");
  3132. Table_setNumericValue (me.get(), 8, 2, 3);
  3133. Table_setNumericValue (me.get(), 8, 3, 13);
  3134. Table_setStringValue (me.get(), 9, 1, U"Tamang");
  3135. Table_setNumericValue (me.get(), 9, 2, 1);
  3136. Table_setNumericValue (me.get(), 9, 3, 1);
  3137. Table_setStringValue (me.get(), 10, 1, U"!Xoo");
  3138. Table_setNumericValue (me.get(), 10, 2, 1);
  3139. Table_setNumericValue (me.get(), 10, 3, 14);
  3140. return me;
  3141. } catch (MelderError) {
  3142. Melder_throw (U"Keating-Esposito table not created.");
  3143. }
  3144. }
  3145. autoTable Table_create_ganong1980 () {
  3146. try {
  3147. autoTable me = Table_createWithColumnNames (6, U"VOT dash-tash dask-task");
  3148. Table_setNumericValue (me.get(), 1, 1, -17.5);
  3149. Table_setNumericValue (me.get(), 1, 2, 0.98);
  3150. Table_setNumericValue (me.get(), 1, 3, 0.92);
  3151. Table_setNumericValue (me.get(), 2, 1, -7.5);
  3152. Table_setNumericValue (me.get(), 2, 2, 0.95);
  3153. Table_setNumericValue (me.get(), 2, 3, 0.83);
  3154. Table_setNumericValue (me.get(), 3, 1, -2.5);
  3155. Table_setNumericValue (me.get(), 3, 2, 0.71);
  3156. Table_setNumericValue (me.get(), 3, 3, 0.33);
  3157. Table_setNumericValue (me.get(), 4, 1, 2.5);
  3158. Table_setNumericValue (me.get(), 4, 2, 0.29);
  3159. Table_setNumericValue (me.get(), 4, 3, 0.10);
  3160. Table_setNumericValue (me.get(), 5, 1, 7.5);
  3161. Table_setNumericValue (me.get(), 5, 2, 0.12);
  3162. Table_setNumericValue (me.get(), 5, 3, 0.02);
  3163. Table_setNumericValue (me.get(), 6, 1, 17.5);
  3164. Table_setNumericValue (me.get(), 6, 2, 0.10);
  3165. Table_setNumericValue (me.get(), 6, 3, 0.02);
  3166. return me;
  3167. } catch (MelderError) {
  3168. Melder_throw (U"Ganong table not created.");
  3169. }
  3170. }
  3171. static bool intervalsIntersect (double x1, double x2, double xmin, double xmax, double *xc1, double *xc2) {
  3172. if (x1 > x2) {
  3173. double tmp = x1;
  3174. x1 = x2;
  3175. x2 = tmp;
  3176. }
  3177. if (xmin > xmax) {
  3178. double tmp = xmin;
  3179. xmin = xmax;
  3180. xmin = tmp;
  3181. }
  3182. *xc1 = x1;
  3183. *xc2 = x2;
  3184. if (x2 <= xmin || x1 >= xmax) {
  3185. return false;
  3186. }
  3187. if (x1 < xmin) {
  3188. *xc1 = xmin;
  3189. }
  3190. if (x2 > xmax) {
  3191. *xc2 = xmax;
  3192. }
  3193. return true;
  3194. }
  3195. void Table_horizontalErrorBarsPlotWhere (Table me, Graphics g, integer xcolumn, integer ycolumn, double xmin, double xmax,
  3196. double ymin, double ymax, integer xci_min, integer xci_max, double bar_mm, bool garnish, conststring32 formula, Interpreter interpreter)
  3197. {
  3198. try {
  3199. integer nrows = my rows.size;
  3200. if (xcolumn < 1 || xcolumn > nrows || ycolumn < 1 || ycolumn > nrows ||
  3201. (xci_min != 0 && xci_min > nrows) || (xci_max != 0 && xci_max > nrows)) {
  3202. return;
  3203. }
  3204. integer numberOfSelectedRows = 0;
  3205. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  3206. if (ymin >= ymax) {
  3207. Table_columnExtremesFromSelectedRows (me, ycolumn, selectedRows.get(), & ymin, & ymax);
  3208. if (ymin >= ymax) {
  3209. ymin -= 1.0;
  3210. ymax += 1.0;
  3211. }
  3212. }
  3213. double x1min, x1max;
  3214. if (xmin >= xmax) {
  3215. Table_columnExtremesFromSelectedRows (me, xcolumn, selectedRows.get(), & xmin, & xmax);
  3216. if (xci_min > 0) {
  3217. Table_columnExtremesFromSelectedRows (me, xci_min, selectedRows.get(), & x1min, & x1max);
  3218. xmin -= x1max;
  3219. }
  3220. if (xci_max > 0) {
  3221. Table_columnExtremesFromSelectedRows (me, xci_max, selectedRows.get(), & x1min, & x1max);
  3222. xmax += x1max;
  3223. }
  3224. if (xmin >= xmax) {
  3225. xmin -= 1.0;
  3226. xmax += 1.0;
  3227. }
  3228. }
  3229. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  3230. Graphics_setInner (g);
  3231. double dy = Graphics_dyMMtoWC (g, bar_mm);
  3232. for (integer irow = 1; irow <= numberOfSelectedRows; irow ++) {
  3233. double x = Table_getNumericValue_Assert (me, selectedRows [irow], xcolumn);
  3234. double y = Table_getNumericValue_Assert (me, selectedRows [irow], ycolumn);
  3235. double dx1 =
  3236. xci_min > 0 ? Table_getNumericValue_Assert (me, selectedRows [irow], xci_min) : 0.0;
  3237. double dx2 =
  3238. xci_max > 0 ? Table_getNumericValue_Assert (me, selectedRows [irow], xci_max) : 0.0;
  3239. double x1 = x - dx1, x2 = x + dx2, xc1, yc1, xc2, yc2;
  3240. if (x <= xmax && x >= xmin && y <= ymax && y >= ymin) {
  3241. // horizontal confidence interval
  3242. if (intervalsIntersect (x1, x2, xmin, xmax, & xc1, & xc2)) {
  3243. Graphics_line (g, xc1, y, xc2, y);
  3244. if (dy > 0 && intervalsIntersect (y - dy / 2.0, y + dy / 2.0, ymin, ymax, & yc1, & yc2)) {
  3245. if (xc1 >= xmin && dx1 > 0.0) {
  3246. Graphics_line (g, xc1, yc1, xc1, yc2);
  3247. }
  3248. if (xc2 <= xmax && dx2 > 0.0) {
  3249. Graphics_line (g, xc2, yc1, xc2, yc2);
  3250. }
  3251. }
  3252. }
  3253. }
  3254. }
  3255. Graphics_unsetInner (g);
  3256. if (garnish) {
  3257. Graphics_drawInnerBox (g);
  3258. Graphics_marksLeft (g, 2, true, true, false);
  3259. Graphics_marksBottom (g, 2, true, true, false);
  3260. }
  3261. } catch (MelderError) {
  3262. Melder_clearError ();
  3263. }
  3264. }
  3265. void Table_verticalErrorBarsPlotWhere (Table me, Graphics g,
  3266. integer xcolumn, integer ycolumn, double xmin, double xmax,
  3267. double ymin, double ymax, integer yci_min, integer yci_max,
  3268. double bar_mm, bool garnish, conststring32 formula, Interpreter interpreter)
  3269. {
  3270. try {
  3271. integer nrows = my rows.size;
  3272. if (xcolumn < 1 || xcolumn > nrows || ycolumn < 1 || ycolumn > nrows ||
  3273. (yci_min != 0 && yci_min > nrows) || (yci_max != 0 && yci_max > nrows)) {
  3274. return;
  3275. }
  3276. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  3277. if (xmin >= xmax) {
  3278. Table_columnExtremesFromSelectedRows (me, ycolumn, selectedRows.get(), & ymin, & ymax);
  3279. if (xmin >= xmax) {
  3280. xmin -= 1.0;
  3281. xmax += 1.0;
  3282. }
  3283. }
  3284. double y1min, y1max;
  3285. if (ymin >= ymax) {
  3286. Table_columnExtremesFromSelectedRows (me, ycolumn, selectedRows.get(), & ymin, & ymax);
  3287. if (yci_min > 0) {
  3288. Table_columnExtremesFromSelectedRows (me, yci_min, selectedRows.get(), & y1min, & y1max);
  3289. ymin -= y1max;
  3290. }
  3291. if (yci_max > 0) {
  3292. Table_columnExtremesFromSelectedRows (me, yci_max, selectedRows.get(), & y1min, & y1max);
  3293. ymax += y1max;
  3294. }
  3295. if (ymin >= ymax) {
  3296. ymin -= 1.0;
  3297. ymax += 1.0;
  3298. }
  3299. }
  3300. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  3301. Graphics_setInner (g);
  3302. double dx = Graphics_dxMMtoWC (g, bar_mm);
  3303. for (integer irow = 1; irow <= selectedRows.size; irow ++) {
  3304. double x = Table_getNumericValue_Assert (me, selectedRows [irow], xcolumn);
  3305. double y = Table_getNumericValue_Assert (me, selectedRows [irow], ycolumn);
  3306. double dy1 =
  3307. yci_min > 0 ? Table_getNumericValue_Assert (me, selectedRows [irow], yci_min) : 0.0;
  3308. double dy2 =
  3309. yci_max > 0 ? Table_getNumericValue_Assert (me, selectedRows [irow], yci_max) : 0.0;
  3310. double y1 = y - dy1, y2 = y + dy2, xc1, yc1, xc2, yc2;
  3311. if (x <= xmax && x >= xmin && y <= ymax && y >= ymin) {
  3312. // vertical confidence interval
  3313. if (intervalsIntersect (y1, y2, ymin, ymax, & yc1, & yc2)) {
  3314. Graphics_line (g, x, yc1, x, yc2);
  3315. if (dx > 0 && intervalsIntersect (x - dx / 2.0, x + dx / 2.0, xmin, xmax, & xc1, & xc2)) {
  3316. if (yc1 >= ymin && dy1 > 0.0) {
  3317. Graphics_line (g, xc1, yc1, xc2, yc1);
  3318. }
  3319. if (yc2 <= ymax && dy2 > 0.0) {
  3320. Graphics_line (g, xc1, yc2, xc2, yc2);
  3321. }
  3322. }
  3323. }
  3324. }
  3325. }
  3326. Graphics_unsetInner (g);
  3327. if (garnish) {
  3328. Graphics_drawInnerBox (g);
  3329. Graphics_marksLeft (g, 2, true, true, false);
  3330. Graphics_marksBottom (g, 2, true, true, false);
  3331. }
  3332. } catch (MelderError) {
  3333. Melder_clearError ();
  3334. }
  3335. }
  3336. double Table_getMedianAbsoluteDeviation (Table me, integer columnNumber)
  3337. try {
  3338. Table_checkSpecifiedColumnNumberWithinRange (me, columnNumber);
  3339. Table_numericize_Assert (me, columnNumber);
  3340. if (my rows.size < 1) {
  3341. return undefined;
  3342. }
  3343. autoVEC data = VECraw (my rows.size);
  3344. for (integer irow = 1; irow <= my rows.size; irow ++) {
  3345. TableRow row = my rows.at [irow];
  3346. data [irow] = row -> cells [columnNumber].number;
  3347. Melder_require (isdefined (data [irow]),
  3348. U"The cell in row ", irow, U" of column ", Table_messageColumn (me, columnNumber), U" is undefined.");
  3349. }
  3350. double mad, location;
  3351. NUMmad (data.get(), & location, true, & mad, nullptr);
  3352. return mad;
  3353. } catch (MelderError) {
  3354. Melder_throw (me, U": cannot compute median absolute deviation of column ", columnNumber, U".");
  3355. }
  3356. autoTable Table_getOneWayKruskalWallis (Table me, integer column, integer factorColumn,
  3357. double *prob, double *p_kruskalWallis, double *p_df)
  3358. {
  3359. try {
  3360. Melder_require (column > 0 && column <= my numberOfColumns,
  3361. U"Invalid column number.");
  3362. Melder_require (factorColumn > 0 && factorColumn <= my numberOfColumns && factorColumn != column,
  3363. U"Invalid group column number.");
  3364. integer numberOfData = my rows.size;
  3365. Table_numericize_Assert (me, column);
  3366. autoNUMvector<double> data (1, numberOfData);
  3367. autoStringsIndex levels = Table_to_StringsIndex_column (me, factorColumn);
  3368. integer numberOfLevels = levels -> classes->size;
  3369. Melder_require (numberOfLevels > 1,
  3370. U"There should be at least two levels.");
  3371. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3372. data [irow] = my rows.at [irow] -> cells [column]. number;
  3373. }
  3374. NUMsort2 <double, integer> (numberOfData, data.peek(), levels -> classIndex.at);
  3375. NUMrank <double> (numberOfData, data.peek());
  3376. // Get correctionfactor for ties
  3377. // Hayes pg. 831
  3378. longdouble c = 0.0;
  3379. integer jt, j = 1;
  3380. while (j < numberOfData) {
  3381. for (jt = j + 1; jt <= numberOfData && data [jt] == data [j]; jt ++) { }
  3382. double multiplicity = jt - j;
  3383. if (multiplicity > 1) {
  3384. c += multiplicity * (multiplicity *multiplicity - 1.0);
  3385. }
  3386. j = jt;
  3387. }
  3388. double tiesCorrection = 1.0 - (double) c / (numberOfData * (numberOfData * numberOfData - 1.0));
  3389. autoNUMvector <integer> factorLevelSizes (1, numberOfLevels);
  3390. autoNUMvector <double> factorLevelSums (1, numberOfLevels);
  3391. autoNUMvector <integer> ties (1, numberOfLevels);
  3392. for (integer i = 1; i <= numberOfData; i ++) {
  3393. integer index = levels -> classIndex [i];
  3394. factorLevelSizes [index] ++;
  3395. factorLevelSums [index] += data [i];
  3396. }
  3397. longdouble kruskalWallis = 0.0;
  3398. for (j = 1; j <= numberOfLevels; j ++) {
  3399. if (factorLevelSizes [j] < 2) {
  3400. SimpleString ss = (SimpleString) levels -> classes->at [j]; // FIXME cast
  3401. Melder_throw (U"Group ", ss -> string.get(), U" has fewer than two cases.");
  3402. }
  3403. kruskalWallis += factorLevelSums [j] * factorLevelSums [j] / factorLevelSizes [j]; // = factorLevelMeans * groupMean * factorLevelSizes
  3404. }
  3405. kruskalWallis = (12.0 / (numberOfData * (numberOfData + 1.0))) * kruskalWallis - 3.0 * (numberOfData + 1);
  3406. kruskalWallis /= tiesCorrection;
  3407. double df = numberOfLevels - 1.0;
  3408. if (p_df) {
  3409. *p_df = df;
  3410. }
  3411. if (p_kruskalWallis) {
  3412. *p_kruskalWallis = (double) kruskalWallis;
  3413. }
  3414. if (prob) {
  3415. *prob = NUMchiSquareQ ((double) kruskalWallis, df);
  3416. }
  3417. autoTable him = Table_createWithColumnNames (numberOfLevels, U"Group(R) Sums(R) Cases");
  3418. for (integer irow = 1; irow <= numberOfLevels; irow ++) {
  3419. SimpleString ss = (SimpleString) levels -> classes->at [irow];
  3420. Table_setStringValue (him.get(), irow, 1, ss -> string.get());
  3421. Table_setNumericValue (him.get(), irow, 2, factorLevelSums [irow]);
  3422. Table_setNumericValue (him.get(), irow, 3, factorLevelSizes [irow]);
  3423. }
  3424. Table_numericize_Assert (him.get(), 2);
  3425. Table_numericize_Assert (him.get(), 3);
  3426. return him;
  3427. } catch (MelderError) {
  3428. Melder_throw (me, U": no one-way Kruskal-Wallis performed.");
  3429. }
  3430. }
  3431. // Table with Group Means Cases
  3432. static void _Table_postHocTukeyHSD (Table me, double sumOfSquaresWithin, double degreesOfFreedomWithin, autoTable *meansDiff, autoTable *meansDiffProbabilities) {
  3433. try {
  3434. Table_numericize_Assert (me, 2);
  3435. Table_numericize_Assert (me, 3);
  3436. integer numberOfMeans = my rows.size;
  3437. autoNUMvector<double> means (1, numberOfMeans);
  3438. autoNUMvector<double> cases (1, numberOfMeans);
  3439. autoTable meansD = Table_create (numberOfMeans - 1, numberOfMeans);
  3440. for (integer i = 1; i <= numberOfMeans; i ++) {
  3441. TableRow row = my rows.at [i];
  3442. means [i] = row -> cells [2]. number;
  3443. cases [i] = row -> cells [3]. number;
  3444. }
  3445. for (integer i = 1; i <= numberOfMeans - 1; i ++) {
  3446. Table_setStringValue (meansD.get(), i, 1, my rows.at [i] -> cells [1]. string.get());
  3447. Table_setColumnLabel (meansD.get(), i + 1, my rows.at [i + 1] -> cells [1]. string.get());
  3448. }
  3449. for (integer irow = 1; irow <= numberOfMeans - 1; irow ++) {
  3450. for (integer icol = irow + 1; icol <= numberOfMeans; icol ++) {
  3451. double dif = fabs (means [irow] - means [icol]);
  3452. Table_setNumericValue (meansD.get(), irow, icol, dif);
  3453. }
  3454. }
  3455. autoTable meansP = Data_copy (meansD.get());
  3456. for (integer irow = 1; irow <= numberOfMeans - 1; irow ++) {
  3457. for (integer icol = irow + 1; icol <= numberOfMeans; icol ++) {
  3458. // Tukey-Kramer correction for unequal sample sizes
  3459. double oneOverNstar = 0.5 * (1.0 / cases [icol] + 1.0 / cases [irow]);
  3460. double s = sqrt (sumOfSquaresWithin * oneOverNstar);
  3461. double q = fabs (means [irow] - means [icol]) / s;
  3462. double p = NUMtukeyQ (q, numberOfMeans, degreesOfFreedomWithin, 1);
  3463. Table_setNumericValue (meansP.get(), irow, icol, p);
  3464. }
  3465. }
  3466. if (meansDiff) {
  3467. *meansDiff = meansD.move();
  3468. }
  3469. if (meansDiffProbabilities) {
  3470. *meansDiffProbabilities = meansP.move();
  3471. }
  3472. } catch (MelderError) {
  3473. Melder_throw (me, U": no post-hoc performed.");
  3474. }
  3475. }
  3476. // expect 6 columns, first text others numeric
  3477. void Table_printAsAnovaTable (Table me) {
  3478. autoMelderString s;
  3479. int width [7] = { 0, 25, 15, 10, 15, 10, 10 };
  3480. if (my numberOfColumns < 6) return;
  3481. MelderInfo_writeLine (
  3482. Melder_pad (width [1], U"Source"), U"\t",
  3483. Melder_pad (width [2], U"SS"), U"\t",
  3484. Melder_pad (width [3], U"Df"), U"\t",
  3485. Melder_pad (width [4], U"MS"), U"\t",
  3486. Melder_pad (width [5], U"F"), U"\t",
  3487. Melder_pad (width [6], U"P")
  3488. );
  3489. for (integer icol = 2; icol <= 6; icol ++) {
  3490. Table_numericize_Assert (me, icol);
  3491. }
  3492. for (integer i = 1; i <= my rows.size; i ++) {
  3493. TableRow row = my rows.at [i];
  3494. MelderString_copy (& s, Melder_padOrTruncate (width [1], row -> cells [1]. string.get()), U"\t");
  3495. for (integer j = 2; j <= 6; j ++) {
  3496. double value = row -> cells [j]. number;
  3497. if (isdefined (value)) {
  3498. MelderString_append (& s, Melder_pad (width [j], Melder_single (value)), j == 6 ? U"" : U"\t");
  3499. } else {
  3500. MelderString_append (& s, Melder_pad (width [j], U""), j == 6 ? U"" : U"\t");
  3501. }
  3502. }
  3503. MelderInfo_writeLine (s.string);
  3504. }
  3505. }
  3506. void Table_printAsMeansTable (Table me) {
  3507. autoMelderString s;
  3508. for (integer icol = 2; icol <= my numberOfColumns; icol ++) {
  3509. Table_numericize_Assert (me, icol);
  3510. }
  3511. for (integer j = 1; j <= my numberOfColumns; j ++) {
  3512. MelderString_append (& s,
  3513. Melder_padOrTruncate (10, my columnHeaders [j]. label ? my columnHeaders [j]. label.get() : U""),
  3514. j == my numberOfColumns ? U"" : U"\t");
  3515. }
  3516. MelderInfo_writeLine (s.string);
  3517. for (integer i = 1; i <= my rows.size; i ++) {
  3518. TableRow row = my rows.at [i];
  3519. MelderString_copy (& s, Melder_padOrTruncate (10, row -> cells [1]. string.get()), U"\t");
  3520. for (integer j = 2; j <= my numberOfColumns; j ++) {
  3521. double value = row -> cells [j].number;
  3522. if (isdefined (value)) {
  3523. MelderString_append (& s,
  3524. Melder_pad (10, Melder_half (value)),
  3525. j == my numberOfColumns ? U"" : U"\t");
  3526. } else {
  3527. MelderString_append (& s,
  3528. Melder_pad (10, U""),
  3529. j == my numberOfColumns ? U"" : U"\t");
  3530. }
  3531. }
  3532. MelderInfo_writeLine (s.string);
  3533. }
  3534. }
  3535. autoTable Table_getOneWayAnalysisOfVarianceF (Table me, integer column, integer factorColumn, autoTable *means, autoTable *meansDiff, autoTable *meansDiffProbabilities) {
  3536. try {
  3537. Melder_require (column > 0 && column <= my numberOfColumns,
  3538. U"Invalid column number.");
  3539. Melder_require (factorColumn > 0 && factorColumn <= my numberOfColumns && factorColumn != column,
  3540. U"Invalid group column number.");
  3541. integer numberOfData = my rows.size;
  3542. Table_numericize_Assert (me, column);
  3543. autoNUMvector<double> data (1, numberOfData);
  3544. autoStringsIndex levels = Table_to_StringsIndex_column (me, factorColumn);
  3545. // copy data from Table
  3546. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3547. data [irow] = my rows.at [irow] -> cells [column]. number;
  3548. }
  3549. integer numberOfLevels = levels -> classes->size;
  3550. Melder_require (numberOfLevels > 1,
  3551. U"There should be at least two levels.");
  3552. autoNUMvector<integer> factorLevelSizes (1, numberOfLevels);
  3553. autoNUMvector<double> factorLevelMeans (1, numberOfLevels);
  3554. // a, ty, c according to scheme of Hayes, 10.14 pg 363
  3555. double a = 0.0, ty = 0.0;
  3556. for (integer i = 1; i <= numberOfData; i ++) {
  3557. integer index = levels -> classIndex [i];
  3558. factorLevelSizes [index] ++;
  3559. factorLevelMeans [index] += data [i];
  3560. a += data [i] * data [i];
  3561. ty += data [i];
  3562. }
  3563. double c = 0.0;
  3564. for (integer j = 1; j <= numberOfLevels; j ++) {
  3565. if (factorLevelSizes [j] < 2) {
  3566. SimpleString ss = (SimpleString) levels -> classes->at [j];
  3567. Melder_throw (U"Level \"", ss -> string.get(), U"\" has less then two members.");
  3568. }
  3569. c += factorLevelMeans [j] * factorLevelMeans [j] / factorLevelSizes [j]; // order of these two is important!
  3570. factorLevelMeans [j] /= factorLevelSizes [j];
  3571. }
  3572. double ss_t = a - ty * ty / numberOfData;
  3573. double ss_b = c - ty * ty / numberOfData;
  3574. double ss_w = a - c;
  3575. double dof_w = numberOfData - numberOfLevels;
  3576. double dof_b = numberOfLevels - 1;
  3577. autoTable anova = Table_createWithColumnNames (3, U"Source SS Df MS F P");
  3578. integer col_s = 1, col_ss = 2, col_df = 3, col_ms = 4, col_f = 5, col_p = 6;
  3579. integer row_b = 1, row_w = 2, row_t = 3;
  3580. Table_setStringValue (anova.get(), row_b, col_s, U"Between");
  3581. Table_setStringValue (anova.get(), row_w, col_s, U"Within");
  3582. Table_setStringValue (anova.get(), row_t, col_s, U"Total");
  3583. Table_setNumericValue (anova.get(), row_b, col_ss, ss_b);
  3584. Table_setNumericValue (anova.get(), row_b, col_df, dof_b);
  3585. double ms_b = ss_b / dof_b;
  3586. Table_setNumericValue (anova.get(), row_b, col_ms, ms_b);
  3587. Table_setNumericValue (anova.get(), row_w, col_ss, ss_w);
  3588. Table_setNumericValue (anova.get(), row_w, col_df, dof_w);
  3589. double ms_w = ss_w / dof_w;
  3590. Table_setNumericValue (anova.get(), row_w, col_ms, ms_w);
  3591. double fisherF = ms_b / ms_w;
  3592. double probability = NUMfisherQ (fisherF, dof_b, dof_w);
  3593. Table_setNumericValue (anova.get(), row_b, col_f, fisherF);
  3594. Table_setNumericValue (anova.get(), row_b, col_p, probability);
  3595. Table_setNumericValue (anova.get(), row_t, col_ss, ss_t);
  3596. Table_setNumericValue (anova.get(), row_t, col_df, dof_w + dof_b);
  3597. autoTable ameans = Table_createWithColumnNames (numberOfLevels, U"Group Mean Cases");
  3598. for (integer irow = 1; irow <= numberOfLevels; irow ++) {
  3599. SimpleString name = (SimpleString) levels -> classes->at [irow];
  3600. Table_setStringValue (ameans.get(), irow, 1, name -> string.get());
  3601. Table_setNumericValue (ameans.get(), irow, 2, factorLevelMeans [irow]);
  3602. Table_setNumericValue (ameans.get(), irow, 3, factorLevelSizes [irow]);
  3603. }
  3604. integer columns [1+1] { 0, 2 }; // sort by column 2
  3605. Table_sortRows_Assert (ameans.get(), constINTVEC (columns, 1));
  3606. _Table_postHocTukeyHSD (ameans.get(), ms_w, dof_w, meansDiff, meansDiffProbabilities);
  3607. if (means) {
  3608. *means = ameans.move();
  3609. }
  3610. return anova;
  3611. } catch (MelderError) {
  3612. Melder_throw (me, U": no one-way anova performed.");
  3613. }
  3614. }
  3615. autoTable Table_getTwoWayAnalysisOfVarianceF (Table me, integer column, integer factorColumnA, integer factorColumnB, autoTable *means, autoTable *levelSizes) {
  3616. try {
  3617. Melder_require (column > 0 && column <= my numberOfColumns,
  3618. U"Invalid column number.");
  3619. Melder_require (factorColumnA > 0 && factorColumnA <= my numberOfColumns && factorColumnA != column,
  3620. U"Invalid A group column number.");
  3621. Melder_require (factorColumnB > 0 && factorColumnB <= my numberOfColumns && factorColumnB != column && factorColumnA != factorColumnB,
  3622. U"Invalid B group column number.");
  3623. char32 *label_A = my columnHeaders [factorColumnA]. label.get();
  3624. char32 *label_B = my columnHeaders [factorColumnB]. label.get();
  3625. integer numberOfData = my rows.size;
  3626. Table_numericize_Assert (me, column);
  3627. autoNUMvector<double> data (1, numberOfData);
  3628. autoStringsIndex levelsA = Table_to_StringsIndex_column (me, factorColumnA);
  3629. autoStringsIndex levelsB = Table_to_StringsIndex_column (me, factorColumnB);
  3630. // copy data from Table
  3631. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3632. data [irow] = my rows.at [irow] -> cells [column]. number;
  3633. }
  3634. integer numberOfLevelsA = levelsA -> classes->size;
  3635. integer numberOfLevelsB = levelsB -> classes->size;
  3636. Melder_require (numberOfLevelsA > 1,
  3637. U"There should be at least two levels in \"", label_A, U"\".");
  3638. Melder_require (numberOfLevelsB > 1,
  3639. U"There should be at least two levels in \"", label_B, U"\".");
  3640. /* Formula's according to A. Khuri (1998), Unweighted sums of squares
  3641. * in unbalanced analysis of variance, Journal of Statistical Planning
  3642. * and Inference (74): 135--147.
  3643. *
  3644. * Model:
  3645. *
  3646. * y [i,j,k] = mu + alpha [i] + beta [j] + gamma [i,j] + eps [i,j,k]
  3647. * i=1..r, j = 1..s, k=1..n [i,j]
  3648. *
  3649. * ss(alpha) = nh * s * sum(i=1..r, (ystar [i.]-ystar [..])^2)
  3650. * ss(beta) = nh * r * sum(j=1..s, (ystar [.j]-ystar [..])^2)
  3651. * ss(alpha,beta) = nh * sum (i=1..r, sum (j=1..s, (ymean [ij.]-ystar [i.] - ystar [.j] + ystar [..])^2)),
  3652. *
  3653. * where
  3654. *
  3655. * nh = r * s / sum (i=1..r, sum (j=1..s, 1/n [ij])),
  3656. * ymean [ij.] = sum (k=1..n [ij], y [ijk]/n [ij])
  3657. * ystar [i.] = sum (j=1..s, ymean [ij.]) / s,
  3658. * ystar [.j] = sum (i=1..r, ymean [ij.]) / r,
  3659. * ystar [..] = sum (i=1..r, sum (j=1..s, ymean [ij.])) / (r * s)
  3660. *
  3661. */
  3662. autoNUMmatrix<integer> factorLevelSizes (1, numberOfLevelsA + 1, 1, numberOfLevelsB + 1); // sum + weighted sum
  3663. // extra column for ystar [i.], extra row for ystar [.j]
  3664. autoNUMmatrix<double> factorLevelMeans (1, numberOfLevelsA + 1, 1, numberOfLevelsB + 1); // weighted mean + mean
  3665. for (integer k = 1; k <= numberOfData; k ++) {
  3666. integer indexA = levelsA -> classIndex [k];
  3667. integer indexB = levelsB -> classIndex [k];
  3668. factorLevelSizes [indexA] [indexB] ++;
  3669. factorLevelMeans [indexA] [indexB] += data [k];
  3670. }
  3671. // check for unfilled cells and calculate cell means
  3672. double nh = 0;
  3673. for (integer i = 1; i <= numberOfLevelsA; i ++) {
  3674. for (integer j = 1; j <= numberOfLevelsB; j ++) {
  3675. if (factorLevelSizes [i] [j] < 1) {
  3676. SimpleString li = (SimpleString) levelsA -> classes->at [i];
  3677. SimpleString lj = (SimpleString) levelsA -> classes->at [j];
  3678. Melder_throw (U"Level ", li, U" of ", lj, U" has no data.");
  3679. }
  3680. factorLevelMeans [i] [j] /= factorLevelSizes [i] [j];
  3681. nh += 1.0 / factorLevelSizes [i] [j];
  3682. }
  3683. }
  3684. nh = numberOfLevelsA * numberOfLevelsB / nh;
  3685. // row marginals (ystar [i.])
  3686. double mean = 0; // ystar [..]
  3687. for (integer i = 1; i <= numberOfLevelsA; i ++) {
  3688. for (integer j = 1; j <= numberOfLevelsB; j ++) {
  3689. factorLevelMeans [i] [numberOfLevelsB + 1] += factorLevelMeans [i] [j];
  3690. mean += factorLevelMeans [i] [j];
  3691. factorLevelSizes [i] [numberOfLevelsB + 1] += factorLevelSizes [i] [j];
  3692. }
  3693. factorLevelMeans [i] [numberOfLevelsB + 1] /= numberOfLevelsB;
  3694. }
  3695. mean /= numberOfLevelsA * numberOfLevelsB;
  3696. factorLevelMeans [numberOfLevelsA + 1] [numberOfLevelsB + 1] = mean;
  3697. factorLevelSizes [numberOfLevelsA + 1] [numberOfLevelsB + 1] = numberOfData;
  3698. // column marginals (ystar [.j])
  3699. for (integer j = 1; j <= numberOfLevelsB; j ++) {
  3700. for (integer i = 1; i <= numberOfLevelsA; i ++) {
  3701. factorLevelMeans [numberOfLevelsA + 1] [j] += factorLevelMeans [i] [j];
  3702. factorLevelSizes [numberOfLevelsA + 1] [j] += factorLevelSizes [i] [j];
  3703. }
  3704. factorLevelMeans [numberOfLevelsA + 1] [j] /= numberOfLevelsA;
  3705. }
  3706. // the sums of squares
  3707. double ss_T = 0;
  3708. for (integer k = 1; k <= numberOfData; k ++) {
  3709. double dif = data [k] - mean;
  3710. ss_T += dif * dif;
  3711. }
  3712. double ss_A = 0;
  3713. for (integer i = 1; i <= numberOfLevelsA; i ++) {
  3714. double dif = factorLevelMeans [i] [numberOfLevelsB + 1] - mean;
  3715. ss_A += dif * dif;
  3716. }
  3717. ss_A *= nh * numberOfLevelsB;
  3718. double ss_B = 0;
  3719. for (integer j = 1; j <= numberOfLevelsB; j ++) {
  3720. double dif = factorLevelMeans [numberOfLevelsA + 1] [j] - mean;
  3721. ss_B += dif * dif;
  3722. }
  3723. ss_B *= nh * numberOfLevelsA;
  3724. double ss_AB = 0;
  3725. for (integer i = 1; i <= numberOfLevelsA; i ++) {
  3726. for (integer j = 1; j <= numberOfLevelsB; j ++) {
  3727. double dif = factorLevelMeans [i] [j] - factorLevelMeans [i] [numberOfLevelsB + 1] - factorLevelMeans [numberOfLevelsA + 1] [j] + mean;
  3728. ss_AB += dif * dif;
  3729. }
  3730. }
  3731. ss_AB *= nh;
  3732. double ss_E = ss_T - ss_A - ss_B - ss_AB;
  3733. // are there any replications? if not then the error term is the AB interaction.
  3734. bool replications = true;
  3735. if (factorLevelSizes [numberOfLevelsA + 1] [1] == numberOfLevelsA) {
  3736. replications = false;
  3737. }
  3738. // Construct the means Table (numberOfLevelsA+1)x(numberOfLevelsB + 1 + 1)
  3739. autoTable ameans = Table_createWithoutColumnNames (numberOfLevelsA + 1, numberOfLevelsB + 1 + 1);
  3740. for (integer k = 2; k <= numberOfLevelsB + 1; k ++) {
  3741. SimpleString name = (SimpleString) levelsB -> classes->at [k - 1];
  3742. Table_setColumnLabel (ameans.get(), k, name -> string.get());
  3743. }
  3744. Table_setColumnLabel (ameans.get(), numberOfLevelsB + 1 + 1, U"Mean");
  3745. for (integer j = 1; j <= numberOfLevelsA; j ++) {
  3746. SimpleString name = (SimpleString) levelsA -> classes->at [j];
  3747. Table_setStringValue (ameans.get(), j, 1, name -> string.get());
  3748. }
  3749. Table_setStringValue (ameans.get(), numberOfLevelsA + 1, 1, U"Mean");
  3750. for (integer i = 1; i <= numberOfLevelsA + 1; i ++) {
  3751. for (integer j = 1; j <= numberOfLevelsB + 1; j ++) {
  3752. Table_setNumericValue (ameans.get(), i, j + 1, factorLevelMeans [i] [j]);
  3753. }
  3754. }
  3755. if (levelSizes) {
  3756. autoTable asizes = Data_copy (ameans.get());
  3757. Table_setColumnLabel (asizes.get(), numberOfLevelsB + 1 + 1, U"Total");
  3758. Table_setStringValue (asizes.get(), numberOfLevelsA + 1, 1, U"Total");
  3759. for (integer i = 1; i <= numberOfLevelsA + 1; i ++) {
  3760. for (integer j = 1; j <= numberOfLevelsB + 1; j ++) {
  3761. Table_setNumericValue (asizes.get(), i, j + 1, factorLevelSizes [i] [j]);
  3762. }
  3763. }
  3764. *levelSizes = asizes.move();
  3765. }
  3766. autoTable anova = Table_createWithColumnNames (replications ? 5 : 4, U"Source SS Df MS F P");
  3767. integer col_s = 1, col_ss = 2, col_df = 3, col_ms = 4, col_f = 5, col_p = 6;
  3768. integer row_A = 1, row_B = 2, row_AB = 3, row_E = replications ? 4 : 3, row_t = replications ? 5 : 4;
  3769. Table_setStringValue (anova.get(), row_A, col_s, label_A);
  3770. Table_setStringValue (anova.get(), row_B, col_s, label_B);
  3771. Table_setStringValue (anova.get(), row_AB, col_s, Melder_cat (label_A, U" x ", label_B));
  3772. if (replications) {
  3773. Table_setStringValue (anova.get(), row_E, col_s, U"Error");
  3774. }
  3775. Table_setStringValue (anova.get(), row_t, col_s, U"Total");
  3776. double dof_A = numberOfLevelsA - 1, ms_A = ss_A / dof_A;
  3777. Table_setNumericValue (anova.get(), row_A, col_ss, ss_A);
  3778. Table_setNumericValue (anova.get(), row_A, col_df, dof_A);
  3779. Table_setNumericValue (anova.get(), row_A, col_ms, ms_A);
  3780. double dof_B = numberOfLevelsB - 1, ms_B = ss_B / dof_B;
  3781. Table_setNumericValue (anova.get(), row_B, col_ss, ss_B);
  3782. Table_setNumericValue (anova.get(), row_B, col_df, dof_B);
  3783. Table_setNumericValue (anova.get(), row_B, col_ms, ms_B);
  3784. double dof_AB = dof_A * dof_B , ms_AB, dof_E, ms_E;
  3785. if (replications) {
  3786. ms_AB = ss_AB / dof_AB;
  3787. dof_E = numberOfData - dof_A - dof_B - dof_AB - 1;
  3788. ms_E = ss_E / dof_E;
  3789. Table_setNumericValue (anova.get(), row_AB, col_ss, ss_AB);
  3790. Table_setNumericValue (anova.get(), row_AB, col_df, dof_AB);
  3791. Table_setNumericValue (anova.get(), row_AB, col_ms, ms_AB);
  3792. } else {
  3793. ss_E = ss_AB;
  3794. dof_E = numberOfData - dof_A - dof_B - 1;
  3795. ms_E = ss_AB / dof_E;
  3796. }
  3797. Table_setNumericValue (anova.get(), row_E, col_ss, ss_E);
  3798. Table_setNumericValue (anova.get(), row_E, col_df, dof_E);
  3799. Table_setNumericValue (anova.get(), row_E, col_ms, ms_E);
  3800. Table_setNumericValue (anova.get(), row_t, col_ss, ss_T);
  3801. Table_setNumericValue (anova.get(), row_t, col_df, numberOfData - 1);
  3802. // get f and p values wrt ms_E
  3803. double f_A = ms_A / ms_E;
  3804. double f_B = ms_B / ms_E;
  3805. double p_A = NUMfisherQ (f_A, dof_A, dof_E);
  3806. double p_B = NUMfisherQ (f_B, dof_B, dof_E);
  3807. Table_setNumericValue (anova.get(), row_A, col_f, f_A);
  3808. Table_setNumericValue (anova.get(), row_B, col_f, f_B);
  3809. Table_setNumericValue (anova.get(), row_A, col_p, p_A);
  3810. Table_setNumericValue (anova.get(), row_B, col_p, p_B);
  3811. if (replications) {
  3812. double f_AB = ms_AB / ms_E;
  3813. double p_AB = NUMfisherQ (f_AB, dof_AB, dof_E);
  3814. Table_setNumericValue (anova.get(), row_AB, col_f, f_AB);
  3815. Table_setNumericValue (anova.get(), row_AB, col_p, p_AB);
  3816. }
  3817. if (means) {
  3818. *means = ameans.move();
  3819. }
  3820. return anova;
  3821. } catch (MelderError) {
  3822. Melder_throw (me, U": two-way anova not created.");
  3823. }
  3824. }
  3825. void Table_normalProbabilityPlot (Table me, Graphics g,
  3826. integer column, integer numberOfQuantiles, double numberOfSigmas, int labelSize, conststring32 label, bool garnish)
  3827. {
  3828. try {
  3829. if (column < 1 || column > my numberOfColumns) return;
  3830. Table_numericize_Assert (me, column);
  3831. integer numberOfData = my rows.size;
  3832. autoVEC data (numberOfData, kTensorInitializationType::RAW);
  3833. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3834. data [irow] = my rows.at [irow] -> cells [column]. number;
  3835. }
  3836. double mean, stdev;
  3837. NUM_sum_mean_sumsq_variance_stdev (data.get(), nullptr, & mean, nullptr, nullptr, & stdev);
  3838. double xmin = 100, xmax = -xmin, ymin = 1e308, ymax = -ymin;
  3839. if (numberOfSigmas != 0) {
  3840. xmin = -numberOfSigmas;
  3841. xmax = numberOfSigmas;
  3842. ymin = mean - numberOfSigmas * stdev;
  3843. ymax = mean + numberOfSigmas * stdev;
  3844. }
  3845. VECsort_inplace (data.get());
  3846. numberOfQuantiles = numberOfData < numberOfQuantiles ? numberOfData : numberOfQuantiles;
  3847. autoTableOfReal thee = TableOfReal_create (numberOfQuantiles, 2);
  3848. TableOfReal_setColumnLabel (thee.get(), 1, U"Normal distribution quantiles");
  3849. TableOfReal_setColumnLabel (thee.get(), 2, my columnHeaders [column]. label.get());
  3850. double un = pow (0.5, 1.0 / numberOfQuantiles);
  3851. for (integer irow = 1; irow <= numberOfQuantiles; irow ++) {
  3852. double ui = irow == 1 ? 1.0 - un : (irow == numberOfQuantiles ? un : (irow - 0.3175) / (numberOfQuantiles + 0.365));
  3853. double q = NUMquantile (numberOfData, data.at, ui);
  3854. double zq = - NUMinvGaussQ (ui);
  3855. thy data [irow] [1] = zq; // along x
  3856. thy data [irow] [2] = q; // along y
  3857. if (numberOfSigmas == 0) {
  3858. xmin = zq < xmin ? zq : xmin;
  3859. xmax = zq > xmax ? zq : xmax;
  3860. ymin = q < ymin ? q : ymin;
  3861. ymax = q > ymax ? q : ymax;
  3862. }
  3863. }
  3864. TableOfReal_drawScatterPlot (thee.get(), g, 1, 2, 1, numberOfQuantiles, xmin, xmax, ymin, ymax, labelSize, 0, label, garnish);
  3865. Graphics_setInner (g);
  3866. Graphics_setLineType (g, Graphics_DOTTED);
  3867. Graphics_line (g, xmin, ymin, xmax, ymax);
  3868. Graphics_setLineType (g, Graphics_DRAWN);
  3869. Graphics_unsetInner (g);
  3870. } catch (MelderError) {
  3871. Melder_clearError (); // drawing errors shall be ignored
  3872. }
  3873. }
  3874. void Table_quantileQuantilePlot_betweenLevels (Table me, Graphics g,
  3875. integer dataColumn, integer factorColumn, conststring32 xlevel, conststring32 ylevel, integer numberOfQuantiles,
  3876. double xmin, double xmax, double ymin, double ymax, int labelSize, conststring32 plotLabel, bool garnish)
  3877. {
  3878. try {
  3879. if (dataColumn < 1 || dataColumn > my numberOfColumns || factorColumn < 1 || factorColumn > my numberOfColumns) return;
  3880. Table_numericize_Assert (me, dataColumn);
  3881. integer numberOfData = my rows.size;
  3882. autoVEC xdata = VECraw (numberOfData);
  3883. autoVEC ydata = VECraw (numberOfData);
  3884. integer xnumberOfData = 0, ynumberOfData = 0;
  3885. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3886. char32 *label = my rows.at [irow] -> cells [factorColumn]. string.get();
  3887. double val = my rows.at [irow] -> cells [dataColumn]. number;
  3888. if (Melder_equ (label, xlevel)) {
  3889. xdata [ ++ xnumberOfData] = val;
  3890. } else if (Melder_equ (label, ylevel)) {
  3891. ydata [ ++ ynumberOfData] = val;
  3892. }
  3893. }
  3894. xdata.resize (xnumberOfData);
  3895. ydata.resize (ynumberOfData);
  3896. if (xmin == xmax) {
  3897. NUMvector_extrema<double> (xdata.at, 1, xnumberOfData, & xmin, & xmax);
  3898. if (xmin == xmax) {
  3899. xmin -= 1.0;
  3900. xmax += 1.0;
  3901. }
  3902. }
  3903. if (ymin == ymax) {
  3904. NUMvector_extrema<double> (ydata.at, 1, ynumberOfData, & ymin, & ymax);
  3905. if (ymin == ymax) {
  3906. ymin -= 1.0;
  3907. ymax += 1.0;
  3908. }
  3909. }
  3910. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  3911. Graphics_setInner (g);
  3912. Graphics_quantileQuantilePlot (g, numberOfQuantiles, xdata.get(), ydata.get(),
  3913. xmin, xmax, ymin, ymax, labelSize, plotLabel);
  3914. Graphics_unsetInner (g);
  3915. if (garnish) {
  3916. Graphics_drawInnerBox (g);
  3917. Graphics_textBottom (g, true, Melder_cat (my columnHeaders [dataColumn]. label.get(), U" (", xlevel, U")"));
  3918. Graphics_marksBottom (g, 2, true, true, false);
  3919. Graphics_textLeft (g, true, Melder_cat (my columnHeaders [dataColumn]. label.get(), U" (", ylevel, U")"));
  3920. Graphics_marksLeft (g, 2, true, true, false);
  3921. }
  3922. } catch (MelderError) {
  3923. Melder_clearError (); // drawing errors shall be ignored
  3924. }
  3925. }
  3926. void Table_quantileQuantilePlot (Table me, Graphics g, integer xcolumn, integer ycolumn, integer numberOfQuantiles,
  3927. double xmin, double xmax, double ymin, double ymax, int labelSize, conststring32 plotLabel, bool garnish)
  3928. {
  3929. try {
  3930. if (xcolumn < 1 || xcolumn > my numberOfColumns || ycolumn < 1 || ycolumn > my numberOfColumns) return;
  3931. Table_numericize_Assert (me, xcolumn);
  3932. Table_numericize_Assert (me, ycolumn);
  3933. integer numberOfData = my rows.size;
  3934. autoVEC xdata = VECraw (numberOfData);
  3935. autoVEC ydata = VECraw (numberOfData);
  3936. for (integer irow = 1; irow <= numberOfData; irow ++) {
  3937. xdata [irow] = my rows.at [irow] -> cells [xcolumn]. number;
  3938. ydata [irow] = my rows.at [irow] -> cells [ycolumn]. number;
  3939. }
  3940. if (xmin == xmax) {
  3941. NUMvector_extrema<double> (xdata.at, 1, numberOfData, & xmin, & xmax);
  3942. if (xmin == xmax) {
  3943. xmin -= 1.0;
  3944. xmax += 1.0;
  3945. }
  3946. }
  3947. if (ymin == ymax) {
  3948. NUMvector_extrema<double> (ydata.at, 1, numberOfData, & ymin, & ymax);
  3949. if (ymin == ymax) {
  3950. ymin -= 1.0;
  3951. ymax += 1.0;
  3952. }
  3953. }
  3954. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  3955. Graphics_setInner (g);
  3956. Graphics_quantileQuantilePlot (g, numberOfQuantiles, xdata.get(), ydata.get(),
  3957. xmin, xmax, ymin, ymax, labelSize, plotLabel);
  3958. Graphics_unsetInner (g);
  3959. if (garnish) {
  3960. Graphics_drawInnerBox (g);
  3961. if (my columnHeaders [xcolumn].label) {
  3962. Graphics_textBottom (g, true, my columnHeaders [xcolumn]. label.get());
  3963. }
  3964. Graphics_marksBottom (g, 2, true, true, false);
  3965. if (my columnHeaders [ycolumn].label) {
  3966. Graphics_textLeft (g, true, my columnHeaders [ycolumn]. label.get());
  3967. }
  3968. Graphics_marksLeft (g, 2, true, true, false);
  3969. }
  3970. } catch (MelderError) {
  3971. Melder_clearError (); // drawing errors shall be ignored
  3972. }
  3973. }
  3974. void Table_boxPlots (Table me, Graphics g, integer dataColumn, integer factorColumn, double ymin, double ymax, bool garnish) {
  3975. try {
  3976. if (dataColumn < 1 || dataColumn > my numberOfColumns || factorColumn < 1 || factorColumn > my numberOfColumns) return;
  3977. Table_numericize_Assert (me, dataColumn);
  3978. integer numberOfData = my rows.size;
  3979. autoStringsIndex si = Table_to_StringsIndex_column (me, factorColumn);
  3980. integer numberOfLevels = si -> classes->size;
  3981. if (ymin == ymax) {
  3982. ymax = Table_getMaximum (me, dataColumn);
  3983. ymin = Table_getMinimum (me, dataColumn);
  3984. if (ymax == ymin) {
  3985. ymax += 1.0;
  3986. ymin -= 1.0;
  3987. }
  3988. }
  3989. Graphics_setWindow (g, 1.0 - 0.5, numberOfLevels + 0.5, ymin, ymax);
  3990. Graphics_setInner (g);
  3991. autoVEC data = VECraw (numberOfData);
  3992. for (integer ilevel = 1; ilevel <= numberOfLevels; ilevel ++) {
  3993. integer numberOfDataInLevel = 0;
  3994. for (integer k = 1; k <= numberOfData; k ++) {
  3995. if (si -> classIndex [k] == ilevel) {
  3996. data [ ++ numberOfDataInLevel] = Table_getNumericValue_Assert (me, k, dataColumn);
  3997. }
  3998. }
  3999. Graphics_boxAndWhiskerPlot (g, data.get(), ilevel, 0.2, 0.35, ymin, ymax);
  4000. }
  4001. Graphics_unsetInner (g);
  4002. if (garnish) {
  4003. Graphics_drawInnerBox (g);
  4004. for (integer ilevel = 1; ilevel <= numberOfLevels; ilevel ++) {
  4005. SimpleString ss = (SimpleString) si -> classes->at [ilevel];
  4006. Graphics_markBottom (g, ilevel, false, true, false, ss -> string.get());
  4007. }
  4008. Graphics_marksLeft (g, 2, true, true, false);
  4009. }
  4010. } catch (MelderError) {
  4011. Melder_clearError (); // drawing errors shall be ignored
  4012. }
  4013. }
  4014. void Table_boxPlotsWhere (Table me, Graphics g,
  4015. conststring32 dataColumns_string, integer factorColumn, double ymin, double ymax,
  4016. bool garnish, conststring32 formula, Interpreter interpreter)
  4017. {
  4018. try {
  4019. auto dataColumns = Table_getColumnIndicesFromColumnLabelString (me, dataColumns_string);
  4020. if (factorColumn < 1 || factorColumn > my numberOfColumns)
  4021. return;
  4022. const integer numberOfSelectedColumns = dataColumns.size;
  4023. Formula_compile (interpreter, me, formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
  4024. Formula_Result result;
  4025. integer numberOfData = my rows.size;
  4026. autoStringsIndex si = Table_to_StringsIndex_column (me, factorColumn);
  4027. integer numberOfLevels = si -> classes->size;
  4028. if (ymin == ymax) {
  4029. ymin = 1e308, ymax = - ymin;
  4030. for (integer icol = 1; icol <= numberOfSelectedColumns; icol ++) {
  4031. double ymaxi = Table_getMaximum (me, dataColumns [icol]);
  4032. double ymini = Table_getMinimum (me, dataColumns [icol]);
  4033. ymax = ymaxi > ymax ? ymaxi : ymax;
  4034. ymin = ymini < ymin ? ymini : ymin;
  4035. }
  4036. if (ymax == ymin) {
  4037. ymax += 1.0;
  4038. ymin -= 1.0;
  4039. }
  4040. }
  4041. Graphics_setWindow (g, 1.0 - 0.5, numberOfLevels + 0.5, ymin, ymax);
  4042. Graphics_setInner (g);
  4043. double boxWidth = 4.0, spaceBetweenBoxesInGroup = 1.0, barWidth = boxWidth / 3.0;
  4044. double spaceBetweenGroupsdiv2 = 3.0 / 2.0;
  4045. double widthUnit = 1.0 / (numberOfSelectedColumns * boxWidth + (numberOfSelectedColumns - 1) * spaceBetweenBoxesInGroup + spaceBetweenGroupsdiv2 + spaceBetweenGroupsdiv2);
  4046. autoVEC data = VECraw (numberOfData);
  4047. for (integer ilevel = 1; ilevel <= numberOfLevels; ilevel ++) {
  4048. double xlevel = ilevel;
  4049. for (integer icol = 1; icol <= numberOfSelectedColumns; icol ++) {
  4050. integer numberOfDataInLevelColumn = 0;
  4051. for (integer irow = 1; irow <= numberOfData; irow ++) {
  4052. if (si -> classIndex [irow] == ilevel) {
  4053. Formula_run (irow, dataColumns [icol], & result);
  4054. if (result. numericResult != 0.0) {
  4055. data [++ numberOfDataInLevelColumn] = Table_getNumericValue_Assert (me, irow, dataColumns [icol]);
  4056. }
  4057. }
  4058. }
  4059. if (numberOfDataInLevelColumn > 0) {
  4060. // determine position
  4061. double xc = xlevel - 0.5 + (spaceBetweenGroupsdiv2 + (icol - 1) * (boxWidth + spaceBetweenBoxesInGroup) + boxWidth / 2) * widthUnit;
  4062. Graphics_boxAndWhiskerPlot (g, data.get(), xc, 0.5 * barWidth * widthUnit , 0.5 * boxWidth * widthUnit, ymin, ymax);
  4063. }
  4064. }
  4065. }
  4066. Graphics_unsetInner (g);
  4067. if (garnish) {
  4068. Graphics_drawInnerBox (g);
  4069. for (integer ilevel = 1; ilevel <= numberOfLevels; ilevel ++) {
  4070. SimpleString ss = (SimpleString) si -> classes->at [ilevel];
  4071. Graphics_markBottom (g, ilevel, false, true, false, ss -> string.get());
  4072. }
  4073. Graphics_marksLeft (g, 2, true, true, false);
  4074. }
  4075. } catch (MelderError) {
  4076. Melder_clearError (); // drawing errors shall be ignored
  4077. }
  4078. }
  4079. void Table_distributionPlotWhere (Table me, Graphics g,
  4080. integer dataColumn, double minimum, double maximum, integer nBins, double freqMin, double freqMax,
  4081. bool garnish, conststring32 formula, Interpreter interpreter)
  4082. {
  4083. try {
  4084. if (dataColumn < 1 || dataColumn > my numberOfColumns)
  4085. return;
  4086. Formula_compile (interpreter, me, formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
  4087. Formula_Result result;
  4088. Table_numericize_Assert (me, dataColumn);
  4089. integer n = my rows.size, mrow = 0;
  4090. autoMatrix thee = Matrix_create (1.0, 1.0, 1, 1.0, 1.0, 0.0, n + 1.0, n, 1.0, 1.0);
  4091. for (integer irow = 1; irow <= n; irow ++) {
  4092. Formula_run (irow, dataColumn, & result);
  4093. if (result. numericResult != 0.0) {
  4094. thy z [1] [++ mrow] = Table_getNumericValue_Assert (me, irow, dataColumn);
  4095. }
  4096. }
  4097. Matrix_drawDistribution (thee.get(), g, 0, 1, 0.5, mrow + 0.5, minimum, maximum, nBins, freqMin, freqMax, false, garnish);
  4098. } catch (MelderError) {
  4099. Melder_clearError (); // drawing errors shall be ignored
  4100. }
  4101. }
  4102. static autoStrings itemizeColourString (conststring32 colourString) {
  4103. // remove all spaces within { } so each {1,2,3} can be itemized
  4104. static const conststring32 searchRE = U"\\{\\s*( [0-9.]+)\\s*,\\s*( [0-9.]+)\\s*,\\s*( [0-9.]+)\\s*\\}";
  4105. regexp *compiledRE = CompileRE_throwable (searchRE, 0);
  4106. autostring32 colourStringWithoutSpaces = STRreplace_regex (colourString, compiledRE, U"{\\1,\\2,\\3}", 0);
  4107. autoStrings thee = Strings_createAsTokens (colourStringWithoutSpaces.get(), U" ");
  4108. return thee;
  4109. }
  4110. static Graphics_Colour Strings_colourToValue (Strings me, integer index) {
  4111. if (index < 0 || index > my numberOfStrings) {
  4112. return Graphics_GREY;
  4113. }
  4114. Graphics_Colour colourValue;
  4115. char32 *p = my strings [index].get();
  4116. while (*p == U' ' || *p == U'\t') p ++;
  4117. *p = Melder_toLowerCase (*p);
  4118. char32 first = *p;
  4119. if (first == U'{') {
  4120. colourValue.red = Melder_atof ( ++ p);
  4121. p = (char32 *) str32chr (p, U',');
  4122. if (! p) return Graphics_GREY;
  4123. colourValue.green = Melder_atof ( ++ p);
  4124. p = (char32 *) str32chr (p, U',');
  4125. if (! p) return Graphics_GREY;
  4126. colourValue.blue = Melder_atof ( ++ p);
  4127. } else {
  4128. *p = Melder_toLowerCase (*p);
  4129. if (str32equ (p, U"black")) colourValue = Graphics_BLACK;
  4130. else if (str32equ (p, U"white")) colourValue = Graphics_WHITE;
  4131. else if (str32equ (p, U"red")) colourValue = Graphics_RED;
  4132. else if (str32equ (p, U"green")) colourValue = Graphics_GREEN;
  4133. else if (str32equ (p, U"blue")) colourValue = Graphics_BLUE;
  4134. else if (str32equ (p, U"yellow")) colourValue = Graphics_YELLOW;
  4135. else if (str32equ (p, U"cyan")) colourValue = Graphics_CYAN;
  4136. else if (str32equ (p, U"magenta")) colourValue = Graphics_MAGENTA;
  4137. else if (str32equ (p, U"maroon")) colourValue = Graphics_MAROON;
  4138. else if (str32equ (p, U"lime")) colourValue = Graphics_LIME;
  4139. else if (str32equ (p, U"navy")) colourValue = Graphics_NAVY;
  4140. else if (str32equ (p, U"teal")) colourValue = Graphics_TEAL;
  4141. else if (str32equ (p, U"purple")) colourValue = Graphics_PURPLE;
  4142. else if (str32equ (p, U"olive")) colourValue = Graphics_OLIVE;
  4143. else if (str32equ (p, U"pink")) colourValue = Graphics_PINK;
  4144. else if (str32equ (p, U"silver")) colourValue = Graphics_SILVER;
  4145. else if (str32equ (p, U"grey")) colourValue = Graphics_GREY;
  4146. else {
  4147. double grey = Melder_atof (p);
  4148. grey = grey < 0 ? 0 : (grey > 1 ? 1 : grey);
  4149. colourValue.red = colourValue.green = colourValue.blue = grey;
  4150. }
  4151. }
  4152. return colourValue;
  4153. }
  4154. integer Table_getNumberOfRowsWhere (Table me, conststring32 formula, Interpreter interpreter) {
  4155. integer numberOfRows = 0;
  4156. Formula_compile (interpreter, me, formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
  4157. Formula_Result result;
  4158. for (integer irow = 1; irow <= my rows.size; irow ++) {
  4159. Formula_run (irow, 1, & result);
  4160. if (result. numericResult != 0.0) {
  4161. numberOfRows ++;
  4162. }
  4163. }
  4164. return numberOfRows;
  4165. }
  4166. autoINTVEC Table_findRowsMatchingCriterion (Table me, conststring32 formula, Interpreter interpreter) {
  4167. try {
  4168. integer numberOfMatches = Table_getNumberOfRowsWhere (me, formula, interpreter);
  4169. if (numberOfMatches < 1)
  4170. Melder_throw (U"No rows selected.");
  4171. Formula_compile (interpreter, me, formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
  4172. Formula_Result result;
  4173. autoINTVEC selectedRows = INTVECraw (numberOfMatches);
  4174. integer n = 0;
  4175. for (integer irow = 1; irow <= my rows.size; irow ++) {
  4176. Formula_run (irow, 1, & result);
  4177. if (result. numericResult != 0.0)
  4178. selectedRows [ ++ n] = irow;
  4179. }
  4180. Melder_assert (n == numberOfMatches);
  4181. return selectedRows;
  4182. } catch (MelderError) {
  4183. Melder_throw (me, U": cannot find matches.");
  4184. }
  4185. }
  4186. void Table_barPlotWhere (Table me, Graphics g,
  4187. conststring32 columnLabels, double ymin, double ymax, conststring32 factorColumn,
  4188. double xoffsetFraction, double interbarFraction, double interbarsFraction, conststring32 colours,
  4189. double angle, bool garnish, conststring32 formula, Interpreter interpreter)
  4190. {
  4191. try {
  4192. autoINTVEC columnIndexes = Table_getColumnIndicesFromColumnLabelString (me, columnLabels);
  4193. integer labelIndex = Table_findColumnIndexFromColumnLabel (me, factorColumn);
  4194. autoStrings colourText = itemizeColourString (colours); // removes all spaces within { } so each {} can be parsed as 1 item
  4195. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4196. if (ymax <= ymin) { // autoscaling
  4197. ymin = 1e308;
  4198. ymax = - ymin;
  4199. for (integer icol = 1; icol <= columnIndexes.size; icol ++) {
  4200. double cmin, cmax;
  4201. Table_columnExtremesFromSelectedRows (me, columnIndexes [icol], selectedRows.get(), & cmin, & cmax);
  4202. if (cmin < ymin) { ymin = cmin; }
  4203. if (cmax > ymax) { ymax = cmax; }
  4204. }
  4205. ymin = ymin > 0 ? 0 : ymin;
  4206. ymax = ymax < 0 ? 0 : ymax;
  4207. }
  4208. Graphics_setInner (g);
  4209. Graphics_setWindow (g, 0, 1, ymin, ymax);
  4210. integer numberOfGroups = selectedRows.size;
  4211. integer groupSize = columnIndexes.size;
  4212. double bar_width = 1 / (numberOfGroups * groupSize + 2 * xoffsetFraction + (numberOfGroups - 1) * interbarsFraction + numberOfGroups * (groupSize - 1) * interbarFraction);
  4213. double dx = (interbarsFraction + groupSize + (groupSize - 1) * interbarFraction) * bar_width;
  4214. for (integer icol = 1; icol <= groupSize; icol ++) {
  4215. double xb = xoffsetFraction * bar_width + (icol - 1) * (1 + interbarFraction) * bar_width;
  4216. double x1 = xb;
  4217. Graphics_Colour colour = Strings_colourToValue (colourText.get(), icol);
  4218. for (integer irow = 1; irow <= selectedRows.size; irow ++) {
  4219. double x2 = x1 + bar_width;
  4220. double y2 = Table_getNumericValue_Assert (me, selectedRows [irow], columnIndexes [icol]);
  4221. y2 = y2 > ymax ? ymax : (y2 < ymin ? ymin : y2);
  4222. double y1 = ymin < 0 ? 0 : ymin;
  4223. Graphics_setColour (g, colour);
  4224. Graphics_fillRectangle (g, x1, x2, y1, y2);
  4225. Graphics_setGrey (g, 0.0); // black
  4226. Graphics_rectangle (g, x1, x2, y1, y2);
  4227. x1 += dx;
  4228. }
  4229. }
  4230. //Graphics_unsetInner (g);
  4231. if (garnish) {
  4232. if (labelIndex > 0) {
  4233. double y = ymin, xb = (xoffsetFraction + 0.5 * (groupSize + (groupSize - 1) * interbarFraction)) * bar_width;
  4234. double lineSpacing = Graphics_dyMMtoWC (g, 1.5 * Graphics_inqFontSize (g) * 25.4 / 72);
  4235. int currentFontSize = Graphics_inqFontSize (g);
  4236. Graphics_setTextRotation (g, angle);
  4237. if (angle < 0) {
  4238. y -= 0.3 * lineSpacing;
  4239. xb -= 0.5 * bar_width;
  4240. Graphics_setFontSize (g, currentFontSize - (currentFontSize > 12 ? 2 : 1));
  4241. Graphics_setTextAlignment (g, Graphics_LEFT, Graphics_TOP);
  4242. } else if (angle > 0) {
  4243. y -= 0.3*lineSpacing;
  4244. xb += 0.5 * bar_width;
  4245. Graphics_setFontSize (g, currentFontSize - (currentFontSize > 12 ? 2 : 1));
  4246. Graphics_setTextAlignment (g, Graphics_RIGHT, Graphics_TOP);
  4247. } else {
  4248. Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_TOP);
  4249. }
  4250. for (integer irow = 1; irow <= numberOfGroups; irow ++) {
  4251. conststring32 label = Table_getStringValue_Assert (me, selectedRows [irow], labelIndex);
  4252. if (label) {
  4253. //Graphics_markBottom (g, xb, false, false, false, label);
  4254. Graphics_text (g, xb, ymin - g -> vertTick, label); // was y
  4255. }
  4256. xb += dx;
  4257. }
  4258. Graphics_setFontSize (g, currentFontSize);
  4259. Graphics_setTextRotation (g, 0);
  4260. }
  4261. }
  4262. Graphics_unsetInner (g);
  4263. if (garnish) {
  4264. if (ymin * ymax < 0.0) {
  4265. Graphics_markLeft (g, 0.0, true, true, true, nullptr);
  4266. }
  4267. Graphics_drawInnerBox (g);
  4268. Graphics_marksLeft (g, 2, true, true, false);
  4269. }
  4270. } catch (MelderError) {
  4271. Melder_clearError (); // drawing errors shall be ignored
  4272. }
  4273. }
  4274. static int Graphics_getConnectingLine (Graphics g,
  4275. conststring32 text1, double x1, double y1,
  4276. conststring32 text2, double x2, double y2,
  4277. double *x3, double *y3, double *x4, double *y4)
  4278. {
  4279. int drawLine = 0;
  4280. double width1 = Graphics_textWidth (g, text1), width2 = Graphics_textWidth (g, text2);
  4281. double h = Graphics_dyMMtoWC (g, 1.5 * Graphics_inqFontSize (g) * 25.4 / 72) / 1.5;
  4282. double xi [3], yi [3], xleft = x1 < x2 ? x1 : x2, xright = x2 > x1 ? x2 : x1;
  4283. int numberOfIntersections = NUMgetIntersectionsWithRectangle (x1, y1, x2, y2, xleft - width1 / 2.0, y1 - h/2, xleft + width1 / 2.0, y1 + h/2, xi, yi);
  4284. if (numberOfIntersections == 1) {
  4285. *x3 = xi [1];
  4286. *y3 = yi [1];
  4287. numberOfIntersections = NUMgetIntersectionsWithRectangle (x1, y1, x2, y2, xright - width2 / 2.0, y2 - h/2, xright + width2 / 2.0, y2 + h/2, xi, yi);
  4288. if (numberOfIntersections == 1) {
  4289. *x4 = xi [1];
  4290. *y4 = yi [1];
  4291. drawLine = 1;
  4292. }
  4293. }
  4294. return drawLine;
  4295. }
  4296. // take the xcolumn as labels if non-numeric column else as numbers and arrange distances accordingly.
  4297. void Table_lineGraphWhere (Table me, Graphics g,
  4298. integer xcolumn, double xmin, double xmax, integer ycolumn, double ymin, double ymax,
  4299. conststring32 symbol, double angle, bool garnish, conststring32 formula, Interpreter interpreter)
  4300. {
  4301. try {
  4302. if (ycolumn < 1 || ycolumn > my numberOfColumns) return;
  4303. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4304. if (ymax <= ymin)
  4305. Table_columnExtremesFromSelectedRows (me, ycolumn, selectedRows.get(), & ymin, & ymax);
  4306. // the following also catches xcolumn = 0 !
  4307. bool xIsNumeric = Table_selectedColumnPartIsNumeric (me, xcolumn, selectedRows.get());
  4308. if (xmin >= xmax) {
  4309. if (xIsNumeric)
  4310. Table_columnExtremesFromSelectedRows (me, xcolumn, selectedRows.get(), & xmin, & xmax);
  4311. else {
  4312. xmin = 0; xmax = selectedRows.size + 1;
  4313. }
  4314. }
  4315. Graphics_setInner (g);
  4316. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  4317. Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
  4318. double x1, y1;
  4319. double lineSpacing = Graphics_dyMMtoWC (g, 1.5 * Graphics_inqFontSize (g) * 25.4 / 72.0);
  4320. //double symbolHeight = lineSpacing / 1.5;
  4321. for (integer i = 1; i <= selectedRows.size; i ++) {
  4322. double y2 = Table_getNumericValue_Assert (me, selectedRows [i], ycolumn);
  4323. double x2 = xIsNumeric ? Table_getNumericValue_Assert (me, selectedRows [i], xcolumn) : i;
  4324. //double symbolWidth = 0;
  4325. if (x2 >= xmin && (x2 <= xmax || x1 < xmax)) {
  4326. if (symbol && y2 >= ymin && y2 <= ymax && x2 <= xmax) {
  4327. Graphics_text (g, x2, y2, symbol);
  4328. //symbolWidth = Graphics_textWidth (g, symbol);
  4329. }
  4330. if (i > 1) {
  4331. double x3, y3, x4, y4, xo1, yo1, xo2, yo2;
  4332. if (Graphics_getConnectingLine (g, symbol, x1, y1, symbol, x2, y2, & x3, & y3, & x4, & y4) &&
  4333. NUMclipLineWithinRectangle (x3, y3, x4, y4, xmin, ymin, xmax, ymax, & xo1, & yo1, & xo2, & yo2)) {
  4334. Graphics_line (g, xo1, yo1, xo2, yo2);
  4335. }
  4336. }
  4337. } else {
  4338. x2 = x2 < xmin ? xmin : xmax;
  4339. }
  4340. x1 = x2; y1 = y2;
  4341. }
  4342. if (garnish && ! xIsNumeric && xcolumn > 0) {
  4343. double y = ymin, dx = 0;
  4344. int currentFontSize = Graphics_inqFontSize (g);
  4345. Graphics_setTextRotation (g, angle);
  4346. if (angle < 0) {
  4347. y -= 0.3*lineSpacing;
  4348. dx = -0.5;
  4349. Graphics_setFontSize (g, currentFontSize - (currentFontSize > 12 ? 2 : 1));
  4350. Graphics_setTextAlignment (g, Graphics_LEFT, Graphics_TOP);
  4351. } else if (angle > 0) {
  4352. y -= 0.3*lineSpacing;
  4353. dx = 0.5;
  4354. Graphics_setFontSize (g, currentFontSize - (currentFontSize > 12 ? 2 : 1));
  4355. Graphics_setTextAlignment (g, Graphics_RIGHT, Graphics_TOP);
  4356. } else {
  4357. Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_TOP);
  4358. }
  4359. for (integer i = 1; i <= selectedRows.size; i ++) {
  4360. double x2 = i;
  4361. if (x2 >= xmin && x2 <= xmax) {
  4362. conststring32 label = Table_getStringValue_Assert (me, selectedRows [i], xcolumn);
  4363. if (label) {
  4364. //Graphics_markBottom (g, xb, false, false, false, label);
  4365. Graphics_text (g, x2 + dx, ymin - g -> vertTick, label); // was y
  4366. }
  4367. }
  4368. }
  4369. Graphics_setFontSize (g, currentFontSize);
  4370. Graphics_setTextRotation (g, 0);
  4371. }
  4372. Graphics_unsetInner (g);
  4373. if (garnish) {
  4374. Graphics_drawInnerBox (g);
  4375. Graphics_marksLeft (g, 2, true, true, false);
  4376. if (xIsNumeric) {
  4377. Graphics_marksBottom (g, 2, true, true, false);
  4378. }
  4379. }
  4380. } catch (MelderError) {
  4381. Melder_clearError (); // drawing errors shall be ignored
  4382. }
  4383. }
  4384. void Table_lagPlotWhere (Table me, Graphics g,
  4385. integer column, integer lag, double xmin, double xmax, conststring32 symbol, int labelSize,
  4386. bool garnish, conststring32 formula, Interpreter interpreter)
  4387. {
  4388. try {
  4389. if (column < 1 || column > my rows.size) {
  4390. return;
  4391. }
  4392. integer numberOfSelectedRows = 0;
  4393. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4394. if (xmax <= xmin) { // autoscaling
  4395. Table_columnExtremesFromSelectedRows (me, column, selectedRows.get(), & xmin, & xmax);
  4396. }
  4397. autoVEC x = VECraw (numberOfSelectedRows);
  4398. for (integer i = 1; i <= numberOfSelectedRows; i ++) {
  4399. x [i] = Table_getNumericValue_Assert (me, selectedRows [i], column);
  4400. }
  4401. Graphics_setInner (g);
  4402. Graphics_setWindow (g, xmin, xmax, xmin, xmax);
  4403. Graphics_lagPlot (g, x.get(), xmin, xmax, lag, labelSize, symbol);
  4404. Graphics_unsetInner (g);
  4405. if (garnish) {
  4406. Graphics_drawInnerBox (g);
  4407. Graphics_marksBottom (g, 2, true, true, false);
  4408. Graphics_marksLeft (g, 2, true, true, false);
  4409. if (my columnHeaders [column]. label) {
  4410. Graphics_textLeft (g, true, my columnHeaders [column]. label.get());
  4411. Graphics_textBottom (g, true, Melder_cat (my columnHeaders [column]. label.get(), U" (lag = ", lag, U")"));
  4412. }
  4413. }
  4414. } catch (MelderError) {
  4415. Melder_clearError (); // drawing errors shall be ignored
  4416. }
  4417. }
  4418. autoTable Table_extractRowsWhere (Table me, conststring32 formula, Interpreter interpreter) {
  4419. try {
  4420. Formula_compile (interpreter, me, formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
  4421. Formula_Result result;
  4422. autoTable thee = Table_create (0, my numberOfColumns);
  4423. for (integer icol = 1; icol <= my numberOfColumns; icol ++)
  4424. thy columnHeaders [icol]. label = Melder_dup (my columnHeaders [icol]. label.get());
  4425. for (integer irow = 1; irow <= my rows.size; irow ++) {
  4426. Formula_run (irow, 1, & result);
  4427. if (result. numericResult != 0.0) {
  4428. TableRow row = my rows.at [irow];
  4429. autoTableRow newRow = Data_copy (row);
  4430. thy rows. addItem_move (newRow.move());
  4431. }
  4432. }
  4433. if (thy rows.size == 0)
  4434. Melder_warning (U"No row matches criterion.");
  4435. return thee;
  4436. } catch (MelderError) {
  4437. Melder_throw (me, U": no Table could be extracted.");
  4438. }
  4439. }
  4440. static autoTableOfReal Table_to_TableOfReal_where (Table me,
  4441. conststring32 columnLabels, conststring32 factorColumn, conststring32 formula, Interpreter interpreter)
  4442. {
  4443. try {
  4444. integer factorColIndex = Table_findColumnIndexFromColumnLabel (me, factorColumn);
  4445. autoINTVEC columnIndexes = Table_getColumnIndicesFromColumnLabelString (me, columnLabels);
  4446. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4447. autoTableOfReal thee = TableOfReal_create (selectedRows.size, columnIndexes.size);
  4448. for (integer i = 1; i <= selectedRows.size; i ++) {
  4449. for (integer icol = 1; icol <= columnIndexes.size; icol ++) {
  4450. double value = Table_getNumericValue_Assert (me, selectedRows [i], columnIndexes [icol]);
  4451. thy data [i] [icol] = value;
  4452. }
  4453. if (factorColIndex > 0) { // if no factorColumn given labels may be empty
  4454. conststring32 label = Table_getStringValue_Assert (me, selectedRows [i], factorColIndex);
  4455. TableOfReal_setRowLabel (thee.get(), i, label);
  4456. }
  4457. }
  4458. for (integer icol = 1; icol <= columnIndexes.size; icol ++)
  4459. TableOfReal_setColumnLabel (thee.get(), icol, my columnHeaders [columnIndexes [icol]]. label.get());
  4460. return thee;
  4461. } catch (MelderError) {
  4462. Melder_throw (me, U"No TableOfReal created from Table.");
  4463. }
  4464. }
  4465. static autoSSCPList Table_to_SSCPList_where (Table me,
  4466. conststring32 columnLabels, conststring32 factorColumn, conststring32 formula, Interpreter interpreter)
  4467. {
  4468. try {
  4469. autoTableOfReal thee = Table_to_TableOfReal_where (me, columnLabels, factorColumn, formula, interpreter);
  4470. autoSSCPList him = TableOfReal_to_SSCPList_byLabel (thee.get());
  4471. return him;
  4472. } catch (MelderError) {
  4473. Melder_throw (me, U"No Discriminant created from Table.");
  4474. }
  4475. }
  4476. static integer SSCPList_findIndexOfGroupLabel (SSCPList me, conststring32 label) {
  4477. for (integer i = 1; i <= my size; i ++) {
  4478. if (Melder_equ (Thing_getName (my at [i]), label))
  4479. return i;
  4480. }
  4481. return 0;
  4482. }
  4483. static autoTable Table_SSCPList_extractMahalanobisWhere (Table me, SSCPList thee,
  4484. double numberOfSigmas, kMelder_number which, conststring32 factorColumn, conststring32 formula, Interpreter interpreter)
  4485. {
  4486. try {
  4487. integer numberOfGroups = thy size;
  4488. Melder_assert (numberOfGroups > 0);
  4489. SSCP sscp = thy at [1];
  4490. integer numberOfColumns = sscp -> numberOfColumns;
  4491. integer factorColIndex = Table_findColumnIndexFromColumnLabel (me, factorColumn); // can be absent
  4492. autoINTVEC columnIndex = INTVECraw (numberOfColumns);
  4493. autoVEC vector = VECraw (numberOfColumns);
  4494. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4495. for (integer icol = 1; icol <= numberOfColumns; icol ++)
  4496. columnIndex [icol] = Table_getColumnIndexFromColumnLabel (me, sscp -> columnLabels [icol].get()); // throw if not present
  4497. autoTable him = Table_create (0, my numberOfColumns);
  4498. for (integer icol = 1; icol <= my numberOfColumns; icol ++)
  4499. his columnHeaders [icol].label = Melder_dup (my columnHeaders [icol]. label.get());
  4500. OrderedOf<structCovariance> covs;
  4501. for (integer igroup = 1; igroup <= numberOfGroups; igroup ++) {
  4502. autoCovariance cov = SSCP_to_Covariance (thy at [igroup], 1);
  4503. SSCP_expandLowerCholesky (cov.get());
  4504. covs. addItem_move (cov.move());
  4505. }
  4506. for (integer i = 1; i <= selectedRows.size; i ++) {
  4507. integer irow = selectedRows [i];
  4508. integer igroup = 1; // if factorColIndex == 0 we don't need labels
  4509. if (factorColIndex > 0) {
  4510. conststring32 label = Table_getStringValue_Assert (me, irow, factorColIndex);
  4511. igroup = SSCPList_findIndexOfGroupLabel (thee, label);
  4512. if (igroup == 0)
  4513. Melder_throw (U"The label \"", label, U"\" in row ", irow, U" is not valid in this context.");
  4514. }
  4515. Covariance covi = covs.at [igroup];
  4516. for (integer icol = 1; icol <= numberOfColumns; icol ++)
  4517. vector [icol] = Table_getNumericValue_Assert (me, irow, columnIndex [icol]);
  4518. double dm2 = NUMmahalanobisDistance (covi -> lowerCholesky.get(), vector.get(), covi -> centroid.get());
  4519. if (Melder_numberMatchesCriterion (sqrt (dm2), which, numberOfSigmas)) {
  4520. TableRow row = my rows.at [irow];
  4521. autoTableRow newRow = Data_copy (row);
  4522. his rows. addItem_move (newRow.move());
  4523. }
  4524. }
  4525. return him;
  4526. } catch (MelderError) {
  4527. Melder_throw (me, U"Table (mahalanobis) not extracted.");
  4528. }
  4529. }
  4530. autoTable Table_extractMahalanobisWhere (Table me,
  4531. conststring32 columnLabels, conststring32 factorColumn, double numberOfSigmas,
  4532. kMelder_number which, conststring32 formula, Interpreter interpreter)
  4533. {
  4534. try {
  4535. autoSSCPList thee = Table_to_SSCPList_where (me, columnLabels, factorColumn, formula, interpreter);
  4536. autoTable him = Table_SSCPList_extractMahalanobisWhere (me, thee.get(), numberOfSigmas, which, factorColumn, formula, interpreter);
  4537. return him;
  4538. } catch (MelderError) {
  4539. Melder_throw (me, U"Table not extracted.");
  4540. }
  4541. }
  4542. void Table_drawEllipsesWhere (Table me, Graphics g,
  4543. integer xcolumn, integer ycolumn, integer factorColumn,
  4544. double xmin, double xmax, double ymin, double ymax,
  4545. double numberOfSigmas, integer labelSize, bool garnish, conststring32 formula, Interpreter interpreter)
  4546. {
  4547. try {
  4548. autoINTVEC selectedRows = Table_findRowsMatchingCriterion (me, formula, interpreter);
  4549. autoTableOfReal thee = TableOfReal_create (selectedRows.size, 2);
  4550. for (integer i = 1; i <= selectedRows.size; i ++) {
  4551. double x = Table_getNumericValue_Assert (me, selectedRows [i], xcolumn);
  4552. double y = Table_getNumericValue_Assert (me, selectedRows [i], ycolumn);
  4553. conststring32 label = Table_getStringValue_Assert (me, selectedRows [i], factorColumn);
  4554. thy data [i] [1] = x;
  4555. thy data [i] [2] = y;
  4556. TableOfReal_setRowLabel (thee.get(), i, label);
  4557. }
  4558. autoSSCPList him = TableOfReal_to_SSCPList_byLabel (thee.get());
  4559. bool confidence = false;
  4560. if (ymax == ymin) // autoscaling
  4561. SSCPList_getEllipsesBoundingBoxCoordinates (him.get(), numberOfSigmas, confidence, & xmin, & xmax, & ymin, & ymax);
  4562. Graphics_setWindow (g, xmin, xmax, ymin, ymax);
  4563. Graphics_setInner (g);
  4564. for (integer i = 1; i <= his size; i ++) {
  4565. SSCP sscpi = his at [i];
  4566. double scalei = SSCP_getEllipseScalefactor (sscpi, numberOfSigmas, confidence);
  4567. if (scalei > 0)
  4568. SSCP_drawTwoDimensionalEllipse_inside (sscpi, g, scalei, Thing_getName (sscpi), labelSize);
  4569. }
  4570. Graphics_unsetInner (g);
  4571. if (garnish) {
  4572. Graphics_drawInnerBox (g);
  4573. Graphics_marksBottom (g, 2, true, true, false);
  4574. Graphics_marksLeft (g, 2, true, true, false);
  4575. if (my columnHeaders [xcolumn]. label)
  4576. Graphics_textBottom (g, true, my columnHeaders [xcolumn]. label.get());
  4577. if (my columnHeaders [ycolumn]. label)
  4578. Graphics_textLeft (g, true, my columnHeaders [ycolumn]. label.get());
  4579. }
  4580. } catch (MelderError) {
  4581. Melder_clearError (); // drawing errors shall be ignored
  4582. }
  4583. }
  4584. autoTable Table_extractColumnRanges (Table me, conststring32 ranges) {
  4585. try {
  4586. integer numberOfRows = my rows.size;
  4587. autoINTVEC columnRanges = NUMstring_getElementsOfRanges (ranges, my numberOfColumns, U"columnn number", true);
  4588. autoTable thee = Table_createWithoutColumnNames (numberOfRows, columnRanges.size);
  4589. for (integer icol = 1; icol <= columnRanges.size; icol ++)
  4590. Table_setColumnLabel (thee.get(), icol, my v_getColStr (columnRanges [icol]));
  4591. for (integer irow = 1; irow <= numberOfRows; irow ++) {
  4592. //TableRow row = thy rows -> items [irow];
  4593. for (integer icol = 1; icol <= columnRanges.size; icol ++) {
  4594. conststring32 value = Table_getStringValue_Assert (me, irow, columnRanges [icol]);
  4595. Table_setStringValue (thee.get(), irow, icol, value);
  4596. }
  4597. }
  4598. return thee;
  4599. } catch (MelderError) {
  4600. Melder_throw (me, U": no column range extracted.");
  4601. }
  4602. }
  4603. /* End of file Table_extensions.cpp */