From 79b4cf1158f229788cfdc546b36692dacde7ecf8 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 27 Feb 2019 13:38:24 -0600 Subject: [PATCH] superscript.py - v 1.0.5.000 changelog: - service now iterates forever - ready for production other than pulling json data --- data analysis/data/bdata.csv | 10 +++--- data analysis/superscript.py | 68 +++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/data analysis/data/bdata.csv b/data analysis/data/bdata.csv index 6f961f2a..efcf8294 100644 --- a/data analysis/data/bdata.csv +++ b/data analysis/data/bdata.csv @@ -1,5 +1,5 @@ --4.9249668189769995,-2.352811503488086,6.112647665258532,0.33496472578524106,0.20521681743994868,8.992532238575293,7.458273188238607,-8.432626054850502,5.372451223330504,8.133479642509677,9.613643551236748,-6.28607348259123,5.1229960559135925,1.1490144224910637,5.725583739510011,4.251502494617657,8.8991784475948,-8.004384747173637,-5.392871068769239,9.719275562391342,9.068094344693883,-8.05257009558867,1.6106217487913295,-0.22721855930308266,4.4689234841090375,4.296787587754832,4.4833305993165435,6.832477770446523,-0.9317753609118302,6.854927783035741,9.239698695908071,-6.766629254056086,-0.8247611745479411,0.8546100433211521,-9.790723876655765,-1.7654513276654988,-0.3087277207234891,-8.015731224952209,-5.448218287856572,1.7895130906871088,-3.0986113942066495,7.628320682084684,9.824039172670325,3.458089474036468,8.060706493837387,0.44841594941993534,3.6499557554286284,-5.891357611691451,-1.3154398694118274,3.5743814680902872,-7.789706444400268,4.172473876055996,4.416283696293899,9.425554825035913,0.28143212907267845,7.062946911216393,2.8479505888635437,-3.528077533110949,4.83454622455686,-7.954611726147571,-9.887540739045274,-6.649397799285721,-4.247426629845441,4.26297716163614,-0.5089932876430243,-0.9384679664276714,-9.563759542999533,3.4234643950176533,-8.139424123415166,-6.844676934909173,-7.7239579990567115,8.423359498722803,4.652863140015189,-7.6030386045826575,-8.092808468928318,-6.8664615781376925,-7.111505064629298,-1.8143906468595699,-9.31721764956907,5.4159592399097,-0.2195843514933582,-2.4965009818539112,4.128600146559155,-2.4875600640665745,-7.2949908650381,4.887589625425823,-4.9190075902245205,1.8538248779542243,-6.540399933776451,-5.849697307943355,0.3270664867084463,-3.359049176069142,-2.7654379163281657,3.5925915728273345,3.9343684739511637,-1.4765454329985257,1.0389309062618057,0.47916876898467464,2.919986033639086,-6.349049514611398 --4.6870954909314655,9.960065962499975,5.9122684944905295,-5.695304051638073,5.254325301049336,-5.215259389015749,-2.6345521758058315,-5.737224569312072,-5.484379065547829,-9.249272820655925,2.484677017734329,9.048350151248233,5.55996569219978,2.345383840602956,-0.6534625208059257,-7.383126548052175,-5.329066286794819,0.1336957159106582,-4.229190593046683,-0.15974415114943596,6.267182352092313,-9.76724396491003,9.18025061352418,-2.482394457695209,-0.7094974045311311,4.705125896491527,2.8092569404536576,0.23952538156108716,6.371599100835752,7.787627752074613,-3.038965249468262,-5.230464044169234,-1.8997558790444717,4.034201333716521,-2.518487462352514,-6.927042405566299,2.6785180421485535,-2.587260072160749,-9.110059130651852,-4.322922893339108,8.432897494236933,-3.8901391233076925,-2.8298183844550966,1.928754661321399,2.719590844679276,-8.812658863823499,0.6961088399814148,1.8852161061105033,6.769102966018572,5.682844121009527,8.013036547650895,-8.1135250005979,5.085250356025684,-0.19412648951139033,-8.630954397339924,3.8316624378717616,-2.528086625415149,-0.7228162892177714,1.5622753075799896,9.148665961640347,1.1547059931096335,-8.296411734117646,-5.528108037246133,6.009716998966542,-5.690951033397087,-4.995711592904599,-7.7762826214190905,0.6487782103399802,8.828020157138276,0.5225986323162619,8.431282678429735,-6.12645474844564,-0.0004429193427419875,0.04978332821876563,-7.774275287365593,-6.947979741065855,-4.999655534007161,7.2497666307213,-2.9512970192716903,2.116442096867214,7.7713419667619235,1.9843088598705538,8.684486102016603,-4.0808439513713495,6.695265743136922,3.528034413199496,-3.4124279487970233,6.999254305283561,-7.57187421030145,-0.7947709521685464,-1.1446191881730279,0.0630751411099606,9.04634619345487,5.764435722869997,1.4804502683091378,-8.08249927190686,-6.461724684750294,9.346772458205816,-9.529057647708076,2.597496433905979 --4.336504323000437,-7.226300533844892,-5.625521574444312,0.2790215191896088,-1.771248961896383,-4.239354085883162,8.722603223586681,7.034983578139265,-4.738770982739724,2.3474987256030015,-1.5286821232759387,3.716685978626167,-0.366576408089772,-7.204942051035516,0.7779810341596178,-7.296800342206451,-8.259193020253342,4.004171277527242,8.329575326270081,-0.12014119508343057,0.8767497676752267,-4.000714006092128,-4.656478530729656,-4.780792880533484,6.514182928800871,1.214362229146687,-0.3574767161695718,-0.41430786032810474,-1.6321267662541228,-6.058370187548407,-3.156742295480073,-4.526667876599659,-1.689370135894885,9.888798822370909,1.272213309843922,1.7155441263680515,-3.6203193271260226,1.835414980608638,2.5830050930342523,3.6596828313189427,-1.1984322170490085,5.746243472688693,6.758981735554169,6.160225034078945,5.517355177127239,1.9191217510570588,2.914224151202598,6.722180528019162,-3.9303525557162278,-4.661626483104142,-8.236189838216594,7.954602564106711,5.176856194678114,-0.5577079765543917,4.175342314110257,5.552840618695241,8.479835408304492,9.889293524424026,0.8460714340278326,-7.724731044256654,1.5176133286002589,-9.578070074866087,-7.489270624790758,5.298227147069497,-4.912415431395585,-4.404576024703967,-7.453894300315671,1.09968710966481,3.3202555176826127,8.276613940359052,7.637833151966355,-3.775669242713448,1.6881619795662992,-2.516843043135859,3.871453813836471,2.747326766037446,7.806801599503405,9.643281722897786,-4.995039858315707,-4.960373805784355,6.18077162398837,4.8126183903840705,-3.6349266166615006,5.8827893971273415,-6.486789262181977,1.8854552229681403,1.4242142253385577,-0.5255468109010426,-9.836167348627857,3.7903872112523267,5.422147123983411,-5.329336523071322,8.762052150643914,-1.4096868384938315,5.8174674898759235,0.5457732038131198,5.445721719225578,-7.962055846100555,-1.8212402304687725,-9.865194544046108 --5.8468894367452044,-5.817889646416845,-6.5836201578218905,-1.201555263846899,-1.4828382517480048,-3.8152101509635123,7.798303680696538,-8.59750280351106,-7.680882862961386,-4.229133747560803,8.172982800508343,-8.710877844668003,-7.1018871388343685,-8.421030176694487,-9.811116430398549,2.4751608142389436,-7.227581210521428,7.422328389364363,-2.092130083518149,5.468062844011492,5.977057523328426,-7.95462343085978,4.425878508487951,5.970563419997589,-1.776809786297715,-2.2684698408750297,-4.6515394258825316,-5.154275163093278,8.302699219039049,-7.2250504824047095,-1.5643265473399062,-5.298020253647044,-0.5233369255301401,1.5914732069917008,7.126325211127014,6.255638441435742,-1.369262588265217,-1.5783873223121532,-2.208247104259595,-0.708625300773086,-9.542956037155887,1.2562919631909182,2.300978853236975,-4.086041001500023,3.0740223286478745,8.43645637170496,-1.0398560771043215,-7.627547458901489,0.9005628469605078,7.6279207742622575,-2.0110241530446142,6.053193899922686,2.3966301298102817,5.892633072467737,2.8410633890462496,1.0446659127515439,-2.7519344202486913,-6.692856743506368,0.9162099695605086,-8.903228534166896,7.578275188107192,-1.8452727861094935,-1.6742046795863512,3.262387343013664,6.459238060181416,-9.828162003460054,-6.450839077750878,-8.188575885096764,9.413344833613657,1.00580923980662,6.6647023306010595,-5.921508869926364,-6.003021011814069,6.699763876229486,1.3690635575652372,1.5530021338939175,3.0866187195665766,-6.508397475019958,-3.77826019671261,6.8601472289073655,-7.164024151588664,-5.864210561367697,-8.68258806786833,1.8471145702530656,-9.28317658061636,-0.9236958209628163,3.7313259642596677,2.161049222685259,-6.94180906999132,-2.055818032325048,-9.09186520524633,-0.33512011823171584,-6.562075987660753,3.3795624694671904,-8.405533823742726,0.7992557981457509,-4.835215668553639,-1.6867898121384641,-9.775858804374087,5.554035396617223 --4.346852472333611,-3.9560144955419947,-3.030402464115669,-0.5032176406215516,9.3373737307796,6.969395227535625,-0.5424450748445047,-9.157635472529783,-2.7137698573612434,-2.0081018638346233,0.32030824274506386,-7.18058640634127,-9.788390108006906,-4.056489069935385,7.618165586960519,-8.98307474621895,9.207650887454712,2.628063999154346,9.275646577100524,-0.8504547720541122,-8.853175396307202,-8.1311129600357,-4.726905726461757,1.738610002652063,8.300191833548837,-7.582309228086748,7.160197251658854,2.406442451718778,5.458316493976502,-1.3817748542074622,-4.47693659542929,8.323778383677684,9.723408438034532,6.515180529273557,-2.9867331565936706,-6.239117591234531,9.808777792684783,8.902483128378709,9.438913687973798,-4.5919139189649005,9.63184762855828,-8.1580660405605,4.011363326764458,-8.882509651063387,6.6886978082143465,-4.543498843579787,-7.755986275261952,-5.940376513473136,6.966348435788802,-4.61842429119965,7.543098644343679,-9.191371612539962,-4.235693500676914,8.350607732539416,-3.958098160098709,-1.31744088712572,8.094528487665531,1.7617368349055305,9.264995848780888,7.110159455297605,-7.401189653523826,-3.1378930893336543,4.97445922067576,-6.707385880148444,0.8929538592354742,-8.232404736770551,1.344709826904161,0.21275781231756952,-7.713995436484544,-7.321017025352782,1.4558613873382402,-7.880394944684436,-5.569506140069469,-1.7178927144080873,3.1409190803215132,0.9256659024388103,7.732010484903217,2.963471997973139,6.467778914718583,-0.7164335795083616,0.6112569816580304,-1.560721218328343,4.812468622398626,-7.257513326792793,3.839589028056656,-1.3264077043781448,9.59739157433554,-1.2887459003528452,-3.9184028261487818,1.3862924079569723,9.27395199603004,-4.07325763346702,-8.715285499717842,-1.406528786151819,-7.015398051647459,-9.620626606471689,-2.7352559170456754,-9.314768274820342,3.152920662194754,-5.040738566385377 +-3.041143993810733,4.458803576117765,-4.799373313707069,-8.633771715297998,7.212179696894012,6.539848924327266,3.8400487344740135,-9.606585928192272,-5.094656897417369,-5.4380033597200805,-1.8467549774297574,8.049066289742939,-8.485113271715445,0.040798471791159585,1.809990880309055,6.61154984791364,-1.2826264508449903,9.244389989516012,-1.5951085772960525,7.543409243891336,-0.0717932967194308,8.630053774665633,8.40910623224228,-8.221589569056285,7.89191945983217,8.56770602268557,2.6130491064232615,8.29254061876507,0.40427777236061857,-4.893021426203125,-9.781978181454923,-6.107273134285975,0.17101984579774232,-2.1109539448499675,-6.637646745379337,6.014032997039969,-8.245801591112922,-0.267481481421898,-9.15654955330736,-5.063994809210206,5.868412274326859,-8.85257058873804,-5.387667966909664,-2.1254919980782283,-2.432454367622765,3.086590094368571,-4.768181996998127,-3.6698164109515075,2.005579368831377,8.51806066481059,-0.3109146113047565,-6.700565840900435,-4.7509871161943495,-9.517330502944517,8.61588959316283,-3.8620224756382076,2.2182297791022094,2.3157641917316045,-3.4187975092101963,-6.5258094101269215,-5.241507364212454,8.46318989406089,-5.628159875998668,-9.426679091170167,-4.917400203482726,-5.332312811079129,-7.708659547531942,-7.779474453459372,7.482969656884805,-6.8946280607644495,6.127015128653678,-1.686036088752445,-6.61268229246176,2.9423196642802836,0.8095858039532224,7.274503555775681,-8.267014192521865,-4.49112646042646,-1.6557696753134206,-7.486828494594089,-2.5198546758995244,5.957874614248059,-8.511243318898355,9.831369901702956,1.6617089659738724,-3.311233001756044,-6.6351413184099854,-8.874124492112596,-5.199533152907032,-9.340365341815286,4.744078915907037,-7.08349312527705,0.8571624643874376,2.7830212639337084,6.051181281634154,-0.8550698564655299,-8.07225687208941,-0.24146238915803409,9.640645393482906,0.07295116820486491 +9.975378277264298,-9.734872066113587,-2.4562705366272564,3.066515570618339,-1.7515374510996917,1.3539424199852697,-8.768215419973895,7.777380555887966,8.63188992788842,-4.4080248095516446,-1.1883780805838189,-6.5354205737076505,-4.92574107469067,1.5043390880144294,3.4778202442772823,-5.597322289421125,7.375622967389674,-5.129802463260347,5.804620669332381,-5.568234174355373,8.51108563340318,9.889203574417675,-0.5109740416809565,4.989932387981257,-7.866072046269201,-0.2944697282895721,-9.027211462676377,9.289926229290998,-4.3425564774912795,3.0783638960248325,1.1120435262339257,4.217164951792817,6.1037929833794955,-4.0407673927748515,5.5141530339749885,8.960050103832838,8.542557634329746,6.582409249548224,7.882342087598747,3.41926555910754,3.1495001903655115,-6.720693237315998,-1.9096404662601518,-6.708558172314783,-3.0237312979956465,-7.402930905714767,-3.7058627231493997,6.434277632642903,4.150822444965641,-5.702135264551891,1.9001014597173977,-7.951486289856398,-5.543528700182716,-6.621164907808992,-6.781123247477079,-9.21779925079532,5.604401313456895,-1.6538178031588107,7.724929840469144,3.700912150294851,5.331257284669615,-3.091082917200181,3.8713477284970317,1.5935462166903172,6.256223686213438,-2.0972524726568498,0.4879655272259047,-8.498871911802887,2.6683647896910774,5.417922038244747,0.891107385054255,1.993540969012475,-1.051385906588166,-1.7763947402750304,6.6770494626953045,-1.0316652033122846,-8.106045981178944,-3.6252661904342443,-5.7146418196067845,-0.5292355806580709,-3.5921676929841873,-6.299046852082945,-3.257061927963889,0.3611029901734337,-0.67270244356326,-3.4442199967811042,7.699776343469168,7.286159473990658,-8.72711773454216,0.205740759161138,-2.671218697155691,-2.5876063639379776,-1.7967642453330068,-0.9963354841105811,0.5587421162582107,4.5334068666738325,-6.296100843578067,-9.169366728674511,-1.6505620642587555,-0.6151996060981695 +-2.987632243990408,8.375434145449038,8.846738194906788,-0.03022467717566002,3.6427523397208006,-6.629925002098536,8.136500880003368,-8.227027971952989,-2.6303889983748334,-1.844234631066195,-5.173088436453643,-5.022168588372251,9.47035469242364,-2.924456719863107,4.9382386327091154,-3.9698535034007376,0.24075608923384273,7.788999117515051,8.223220594137224,-2.610614182221271,-2.5553244519696383,-2.4815973116740757,-6.895713381889599,-8.023347315277817,-0.9681710849357383,-4.637445515924091,7.447713819873368,2.8647913541929135,-0.7070803808867243,-6.39652709408844,6.9142070914260145,-3.7935359355183333,-6.712916341171018,4.7860288695895985,2.237701234686604,-6.555904758713842,6.924648773465133,-2.7392236007251514,-3.83972855133983,5.571785193095899,-6.592912758717631,6.8553340814912005,-2.643125488547911,-9.148984973458276,-7.52304442863487,1.5832368097482856,1.7178080664164206,-3.3302569300490976,0.32397014969575366,-4.799047948458524,-2.1775515936865304,-6.186907061899598,-1.3571390640119478,-7.457347432997857,-3.0230466787839987,-8.102824230277491,6.516172108576296,-5.00573808339404,3.0790600897350817,1.3921970929942251,4.850228376721573,-4.330113522103545,-3.0002464425860325,-2.2830542587276925,2.875869045010102,7.448145910357145,5.305267189547436,7.028559449776871,-1.0522066663252776,5.320727710655227,-0.007355581988306881,0.5448350979343495,4.860255833464649,0.6597401471305488,8.39022147939135,6.278089550459448,3.7385648620071095,-5.915955069969567,-7.759797651726488,4.652113419175183,-5.500769166323012,-4.901694961880921,-7.808328466864576,-2.933461032577327,-1.419206277024852,7.010524786139754,3.482955392896759,2.553665584870915,-5.794102743258747,8.689392117319649,-7.640419412757726,-2.4580935040864604,-6.0259316067976325,-6.822682737638561,4.764783861055564,0.6681591855856066,-5.72077940271372,5.556012049152329,-2.8148875385750616,1.0185076104051944 +-2.3201275878819434,1.0376938811332064,3.781374850253318,9.70532747874078,-2.5457280267565885,-6.612253819276361,-0.34328337710398316,6.752915194432489,5.728729277292706,-9.581193175846556,0.47892237288636963,-2.099659886781529,-8.02875916015845,-0.5735747858185114,-9.031468158949782,-0.7461222084500481,-9.780146971250401,-8.733456493628847,7.204315843082682,-9.529894372438772,0.010302915435708826,8.612079863460185,4.759088148321505,6.587472477646475,8.98110217928847,-4.007680654882025,1.9531149549198226,8.56666489844898,0.7847944324693117,-4.654952071465801,7.515115523881999,6.424497814174586,-3.1376603841427775,8.552302300819921,5.383284290529204,5.0135871778735375,-7.373209252234596,-7.911611953216113,-7.492574507369712,-0.6806409720856532,-5.89877550961627,4.2672871614974,-9.972512347213012,4.935855637222261,1.8738715117817293,1.7109338747883704,-6.104654869045422,6.34620376318281,7.282262766374018,8.23139874304363,-3.1170249912304326,-1.7184589870375415,8.498090735369999,6.948669579141182,6.190028353858111,5.111953673775229,0.7227588528549198,-7.648537903387787,-4.283835852095543,-1.0106343283517187,9.158532138773666,6.563328533675239,-9.372509917785099,-3.2040584906544023,7.8007007357858384,-5.977656217371448,-8.659554244852776,9.263537763023468,-7.9250124873237855,-7.6769398550724555,5.761192623604035,7.824544106447529,-4.748292962331235,-9.991614558673698,4.720961747435421,-4.160493924834448,-2.811684314648872,-0.6319323701035788,-5.331816017832529,-4.542078206494226,4.321146493557935,-2.4717619663694173,4.779812654555002,-0.825513633954353,-7.659746854585068,-2.8746454451956787,2.7311908763727626,1.813331719902365,-4.375987480548302,-8.699164699601209,5.084656546332461,5.792958996187673,-2.914372532945859,4.428737093344363,7.822434181033053,3.565214095267507,-1.5713026695423675,-3.6249453784351786,-8.431114584196813,5.9261783097701155 +-6.074815851412021,8.295253933438218,-9.457677676153189,-0.040774552284407406,3.1062700441480793,-0.3016210922067941,-3.1531338691294746,-1.7010871348736423,-6.649582740451776,-1.9144051113954745,2.7318501941551343,8.292291366121937,-4.278385249161481,5.035979313615522,1.1752782119200624,6.316954277603639,4.004861599971139,-8.209125765461005,0.7242325774036722,-2.397859547789409,-1.1137796350979556,1.1360645792270585,-8.538201793440816,-4.019243598926046,7.832714833755322,-4.971060657673934,-2.6091943969776965,8.772277076221634,1.9381585824254532,4.481351838462732,0.4922648169267081,-6.243256690194006,-0.8408030524296866,6.011921819064394,4.480941757030035,-9.989260750241051,5.45518825993258,-5.232569877073399,-5.216013536758213,7.169644644026228,8.046581223788067,8.55868046918346,-7.388784152024311,3.862428458285729,-1.1981117310340643,0.8248569873570446,-8.700615026661218,-1.3943163933545044,5.254754065255229,2.093991265944604,-6.2592278296072585,2.2641376700224,6.572645177015417,-8.471024287972567,-1.4994022656562898,-5.532820655341282,-5.618086101269322,-7.432232737272799,-6.0124110229396965,-4.35499589551108,-1.4944094449446403,-2.5179813743933472,2.958799174837809,-4.182093969777676,-5.3249025725649375,3.7319132638504744,8.387325353921323,-2.229364070110213,4.566249420595716,8.121141135091932,-5.144371571804996,-1.5438469434059936,0.49495532783387297,1.7533082065577883,0.10060769052401852,4.0862565928692725,-7.758072491717545,-2.928456866206364,7.676378094117691,-9.528609287520563,-5.4242212515488175,-8.576714720780581,2.0349814217813478,7.133503278634812,-7.281006314224041,3.5893938029874697,-5.637445938671533,5.562086211918283,-9.181747430899609,-2.839953520655931,-9.802041473824092,-1.4009593807456326,-4.337905386105508,4.559612343634118,7.607352045811929,-3.4498987774260925,6.924706103760993,-7.880741332497728,-1.0698205670130552,2.220240916922931 diff --git a/data analysis/superscript.py b/data analysis/superscript.py index f2c45db3..9a89f425 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -3,9 +3,12 @@ #Notes: #setup: -__version__ = "1.0.4.001" +__version__ = "1.0.5.000" __changelog__ = """changelog: +1.0.5.000: + - service now iterates forever + - ready for production other than pulling json data 1.0.4.001: - grammar fixes 1.0.4.000: @@ -36,20 +39,13 @@ import analysis import titanlearn import visualization import os +import sys +import warnings import glob import numpy as np +import time def titanservice(): - - # Use a service account - cred = credentials.Certificate('keys/firebasekey.json') - firebase_admin.initialize_app(cred) - - db = firestore.client() - - #get all the data - - analysis.generate_data("data/bdata.csv", 100, 5, -10, 10) source_dir = 'data' file_list = glob.glob(source_dir + '/*.csv') #supposedly sorts by alphabetical order, skips reading teams.csv because of redundancy @@ -117,6 +113,54 @@ def titanservice(): for i in range(len(stats)): json_out[files[i]]=str(stats[i]) - print(json_out) + #print(json_out) db.collection(u'stats').document(u'stats-noNN').set(json_out) + +def service(): + + while True: + + print("\n") + + start = time.time() + + print("[OK] starting calculations") + + fucked = False + + for i in range(0, 5): + try: + titanservice() + break + except: + if (i != 4): + print("[WARN] failed, trying " + str(5 - i - 1) + " more times") + else: + print("[ERR] failed to compute data, skipping") + fucked = True + + end = time.time() + if (fucked == True): + + break + + else: + + print("[OK] finished calculations") + + print("[OK] waiting: " + str(300 - (end - start)) + " seconds") + + time.sleep(300 - (end - start)) #executes once every 5 minutes + +warnings.simplefilter("ignore") +# Use a service account +cred = credentials.Certificate('keys/firebasekey.json') +firebase_admin.initialize_app(cred) + +db = firestore.client() + +#get all the data + +analysis.generate_data("data/bdata.csv", 100, 5, -10, 10) +service() #finally we write something that isn't a function definition