2
\$\begingroup\$

I have a csv with data. There are a total number of 9 samples, each sample has multiple fits. Each fit has an associated name, chi2, degrees of freedom, variable name that was fit, and the actual values.

Out of this huge table, I'd like to only extract a handful of fits. I'd then like to get the values of the fits, and plug them into another function to get some values that I can then plot.

I have effectively resorted to creating a multi-nested list. The top most layer is the sample, followed by all the fits of said sample, followed by lists of the various parameters (fit name, fit values, etc.).

[[sample_1[fit_1[[fit_name_1][fit_value_1]][fit_2[fit_name2][fit_value_2]]]....][sample_2[...

I don't think this is the worst thing in the world, but the only way I could get this to work is....bad. I had a couple issues I couldn't really work out resulting in this mess

  1. There are multiple fits per sample that need to be added to the list. Once you are done with one sample, this list of lists needs to then be added to the (lack of a better word) "mega_list". Except there is nothing in the csv for a clean end of one list, and a clean start to another. As such I've resorted to literally have a list for every condition. The same is true of the concentrations. Each sample has a set of concentrations. Some fits are global and use all the concentrations, some are not. So I also need a list of concentrations, with no duplicates, but the order is important. But again, I don't know how to indicate the end of one list and the start of another, so I cannot add these to the same list. As such I have separate lists for each concentration and each fit per sample.

  2. The above also has resulted in a lot of duplication. e.g. the regex filter can be combined since you are looking for the same thing for multiple samples (e.g. 'Monomer-Closed' for samples in {'L273A_2019','L273A_2020'...}. However because I couldn't cleanly indicate the start of one sample and the end of the other, I had to separate each of these into their own conditionals.

  3. The plotting is a bit ugly. Each sample has 3 different techniques for fitting. Individual and Single Scales, these are global fits (hence looping through concentrations). And local fits (only done at a single concentration). There is a lot of reptition here as well (I'm plotting the same 3 things over and over again per sample), but again, I'm unable to get the code any cleaner than it currently is.

  4. Finally, and this is a small thing made difficult due to how ugly and poorly I've set everything. I'd like to connect the dots of my scatter plots, but because the concentrations are not sorted, the connection looks terrible.

It should be noted while I could just say based on this csv it indicates these samples all have ~6 or 9 fits, I do not want any assumptions to be made. I'd like this to be flexible if the number of fits or parameters change.

At the end the of the day, I am trying to show via these plots the results for these 3 different methods of fitting. The code does work, and the output is the desired output (short of somehow connecting the pints with lines). Any assisstance in simplifying the code/cleaning it up would greatly be appreciated!

Here is the csv, it should be noted I'm not posting the whole thing cause it's quite big, but the code works just fine if you have the whole thing or only portions:

Sample,RedChi2,DoF,Variables,Solutions±Uncertanties
WT_2017
Closed_Single_Scale,11.651219458497874,1361,scaling_factor,5.289818805209734e-09±2.5333027184960425e-12
Open_Single_Scale,129.7644067034128,1361,scaling_factor,5.78352277180727e-09±9.267293505002799e-12
Monomer_Single_Scale,2800.8454801421376,1361,scaling_factor,1.237352353911092e-08±9.567271509437632e-11
Closed_Individual_Scales,3.141241032954263,1359,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,5.278888659532299e-09±2.0916648214625956e-12,2.6134330255445093e-09±1.0297600525607774e-12,1.361607049332747e-09±7.479465652276344e-13
Open_Individual_Scales,121.77990881704223,1359,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,5.768979516318495e-09±1.4261604970796457e-11,2.859028569446309e-09±6.999458673819623e-12,1.4881584853299046e-09±5.113383427746122e-12
Monomer_Individual_Scales,2753.526962174867,1359,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,1.1981053926746199e-08±1.466593144330762e-10,6.178167533121837e-09±7.458798290561859e-11,3.332717657400508e-09±5.611785789102205e-11
Closed,5.145880930141789,453,scaling_factor10_0,5.278888659532299e-09±2.6715171812012825e-12
Closed,2.608291185540206,453,scaling_factor5_0,2.6134330255445093e-09±9.343709358604779e-13
Closed,1.6695509831807942,453,scaling_factor2_5,1.361607049332747e-09±5.497499488566032e-13
Open,167.8652258687902,453,scaling_factor10_0,5.768979516318495e-09±1.6744066557640155e-11
Open,132.19332948498598,453,scaling_factor5_0,2.859028569446309e-09±7.320959381300875e-12
Open,65.28117109719815,453,scaling_factor2_5,1.4881587073745095e-09±3.743815411988221e-12
Monomer,3684.2717626106696,453,scaling_factor10_0,1.1981053926746199e-08±1.6964724789096872e-10
Monomer,3191.617700825002,453,scaling_factor5_0,6.178167311077232e-09±8.044704750400721e-11
Monomer,1384.6914230889292,453,scaling_factor2_5,3.332717657400508e-09±3.979540271093099e-11
Open-Closed_Single_Scales,11.595816796203142,1360,k,scaling_factor,0.025468443075522762±0.00951400354085251,5.301449279571102e-09±4.9480963745005665e-12
Monomer-Open_Single_Scales,116.95904024312684,1360,k,scaling_factor,1353.0694130583356±227.22472864506145,1.1682963707571048e-08±1.9956768284411006e-11
Monomer-Closed_Single_Scales,11.701008294872302,1360,k,scaling_factor,4.967966038549321e-10±4.665887838579333e-05,1.0590763377393841e-08±6.879643312260799e-12
Open-Closed_Individual_Scales,3.0917879513608395,1358,k,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,0.02286091209854013±0.004894202420378687,5.289336746372442e-09±3.0206403372055097e-12,2.6186248724968664e-09±1.4977587234825428e-12,1.3642733609486868e-09±9.3129932098768e-13
Monomer-Open_Individual_Scales,104.99157760961575,1358,k,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,1824.593441807333±255.97176256453696,1.1619162743059519e-08±2.7164270673968367e-11,5.7877602710476594e-09±1.3947691690638419e-11,3.0351223756497347e-09±1.0399618523725143e-11
Monomer-Closed_Individual_Scales,3.149270506823421,1358,k,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,3.4835001549993194e-10±2.1481406531228426e-05,1.0560253560498722e-08±4.4991774377778e-12,5.228859123462826e-09±2.4358803824976767e-12,2.724843684021039e-09±1.8261869098218406e-12
Open-Closed,5.093758714709088,452,k,scaling_factor10_0,0.021601450949922274±0.009278757362582764,5.288772753075932e-09±4.945104972194297e-12
Monomer-Open,160.6094864099725,452,k,scaling_factor10_0,4379.220983433397±1884.292849140677,6.079450942664266e-09±6.905468982650861e-11
Monomer-Closed,5.167930502573018,452,k,scaling_factor10_0,1.987332520769769e-10±8.290787869327447e-05,5.28147703349191e-09±1.3759909246526632e-11
Open-Closed,2.3982970023387313,452,k,scaling_factor5_0,0.04461782513617307±0.0072813114201538,2.6233668570796453e-09±1.7928637305077058e-12
Monomer-Open,110.09824101051218,452,k,scaling_factor5_0,14532.470313102183±3017.2862128834013,3.1471107941882792e-09±3.083091173419714e-11
Monomer-Closed,2.614448761890241,452,k,scaling_factor5_0,6.949574249404122e-11±3.992641374800452e-05,2.6136754982530874e-09±5.368761290755311e-12
Open-Closed,1.6732446800491425,452,k,scaling_factor2_5,1.3371526108585385e-12±0,1.361607049332747e-09±0
Monomer-Open,44.048643057572214,452,k,scaling_factor2_5,31238.857552466867±4199.205126447735,1.7132935070662825e-09±1.5540806078947448e-11
Monomer-Closed,1.3539506956359522,452,k,scaling_factor2_5,673.5376422118167±129.95085585888123,1.3933125764253873e-09±3.0978097357861177e-12
3-state_Single_Scale,11.63431283275547,1359,k,k1,scaling_factor,9.754255181348981e-09±0.0010506793496375386,0.042094986833364656±0.010101060278893851,1.0621255874809776e-08±1.2008013701909137e-11
3-state_Individual_Scale,3.1458718903777783,1357,k,k1,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,266.6998426893263±0,8.482103908136196e-13±0,1.0557777319064598e-08±0,5.226865829044414e-09±0,2.723214098665494e-09±0
3-state,5.168700807063889,451,k,k1,scaling_factor10_0,0.004422182275551023±0,1.2589929099249275e-13±0,1.0557777319064598e-08±0
3-state,2.462562343123655,451,k,k1,scaling_factor5_0,1.409901331239638e-07±0.006012009829771037,0.021228946386903313±0.007359439924888416,5.237557720860764e-09±4.569643902687795e-12
3-state,1.3533760673426907,451,k,k1,scaling_factor2_5,20431.001449073894±17640.64419462182,0.009184004111323363±0.00848783561315988,2.7378384004350664e-09±2.85108716910804e-12
5-state_Single_Scale,11.676958529840041,1358,k,k1,k2,scaling_factor,4955.72717993047±0,4.099387496125928e-12±0,2.0909629583343303e-10±0,1.0579637610419468e-08±0
5-state_Individual_Scale,3.067767015491633,1356,k,k1,k2,scaling_factor10_0,scaling_factor5_0,scaling_factor2_5,170856.67831215993±0,0.0429057854001933±0,1.4699352846037073e-13±0,1.0582846599049844e-08±0,5.239242595322935e-09±0,2.72953482038929e-09±0
5-state,5.024034823707327,450,k,k1,k2,scaling_factor10_0,2084.0699773666047±0,0.05172348677301808±0,1.4654943925052066e-14±0,1.0587753118684873e-08±0
5-state,2.3813253147933615,450,k,k1,k2,scaling_factor5_0,32030.340564547354±0,0.07161846247884407±0,2.8845814625810817e-12±0,5.246990619767189e-09±0
5-state,1.3546985000448537,450,k,k1,k2,scaling_factor2_5,14102821.146870395±395677234022.2835,0.01820376302731841±0.6571544682360568,0.0007367715684281073±20.96431638894048,2.738050230988165e-09±3.5871709217682943e-12
L273A_2019
Closed_Single_Scale,9.174003184243801,2681,scaling_factor,4.324745228601046e-09±2.765306029560602e-12
Open_Single_Scale,39.8123724158422,2681,scaling_factor,4.721149471365038e-09±6.2965175662180825e-12
Monomer_Single_Scale,525.5605765481052,2681,scaling_factor,1.0463764743562365e-08±5.231733588745123e-11
Closed_Individual_Scales,2.2483901834385485,2676,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,4.952529497614933e-10±8.895519981225783e-13,1.0049072685092142e-10±7.024029589104452e-13,1.0189906696211892e-09±1.0785836859346905e-12,2.315752034576235e-10±8.66827219417161e-13,4.372231909854918e-09±1.8846203879984473e-12,2.1901891411602037e-09±1.2157238197957538e-12
Open_Individual_Scales,32.90813128302828,2676,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,5.387128521050499e-10±3.6215503085391533e-12,1.090205703491165e-10±2.85113842925099e-12,1.1106386921255762e-09±4.517671601553341e-12,2.5151081217700266e-10±3.5624930347816784e-12,4.7765111865771814e-09±7.861370196284916e-12,2.3903390378166023e-09±5.061596091690976e-12
Monomer_Individual_Scales,517.0751249647922,2676,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,1.2877119370813261e-09±3.528322691293619e-11,2.6786373119591644e-10±2.884185447299622e-11,2.5816544457768487e-09±4.2460341760827645e-11,6.113911599214816e-10±3.386652413815416e-11,1.0323902621678371e-08±6.979956274089994e-11,5.402667868636968e-09±4.679439198788712e-11
Closed,2.245122866419131,446,scaling_factor0_9,4.952531718060982e-10±8.691523910302594e-13
Closed,1.2220826927570207,446,scaling_factor0_225,1.0049072685092142e-10±5.178461943489442e-13
Closed,2.6172756333626133,446,scaling_factor2_2,1.0189906696211892e-09±1.1637046322059817e-12
Closed,1.6273562331130582,446,scaling_factor0_45,2.3157542550222843e-10±7.023434751397684e-13
Closed,2.042783765679194,446,scaling_factor8_8,4.372232131899523e-09±1.7918247479175208e-12
Closed,3.735719909464074,446,scaling_factor4_499999999999999,2.1901891411602037e-09±1.5670621772968183e-12
Open,7.343419330292259,446,scaling_factor0_9,5.387128521050499e-10±1.7107718584314595e-12
Open,1.5610346525856384,446,scaling_factor0_225,1.090205703491165e-10±6.209733542130735e-13
Open,18.101771751866902,446,scaling_factor2_2,1.1106386921255762e-09±3.3506079933593513e-12
Open,3.016757393900973,446,scaling_factor0_45,2.5151081217700266e-10±1.031740474882739e-12
Open,105.72059055509118,446,scaling_factor8_8,4.7765111865771814e-09±1.4123261647899516e-11
Open,61.70521401443275,446,scaling_factor4_499999999999999,2.3903390378166023e-09±6.931014610108402e-12
Monomer,64.45557658838904,446,scaling_factor0_9,1.2877119370813261e-09±1.2457236239895235e-11
Monomer,4.50544005790289,446,scaling_factor0_225,2.678641752851263e-10±2.6919738301248977e-12
Monomer,212.06496531273785,446,scaling_factor2_2,2.5816544457768487e-09±2.7309207785959558e-11
Monomer,14.17401674731078,446,scaling_factor0_45,6.113913819660866e-10±5.607117255876318e-12
Monomer,1890.3602574492807,446,scaling_factor8_8,1.0323902621678371e-08±1.3345907532822308e-10
Monomer,916.8904936328964,446,scaling_factor4_499999999999999,5.402668090681573e-09±6.218462909338317e-11
Open-Closed_Single_Scales,9.177426321803827,2680,k,scaling_factor,4.425571020760799e-11±0.005748260336874386,4.3247430081549965e-09±4.09022039840387e-12
Monomer-Open_Single_Scales,29.519618174489032,2680,k,scaling_factor,5200.38344226182±362.75141183609253,9.658067900986111e-09±1.2927555490155494e-11
Monomer-Closed_Single_Scales,8.417352983890101,2680,k,scaling_factor,404.642546715369±52.72808373756473,8.730888900743139e-09±7.435971608197247e-12
Open-Closed_Individual_Scales,2.249230703133292,2675,k,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,0.0±0,4.952529497614933e-10±0,1.0049072685092142e-10±0,1.0189906696211892e-09±0,2.315752034576235e-10±0,4.372231909854918e-09±0,2.1901891411602037e-09±0
Monomer-Open_Individual_Scales,22.02833912577891,2675,k,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,5839.181064464672±344.7897446709904,1.1485725703863636e-09±6.565575676164824e-12,2.4459523295661256e-10±5.361461811272807e-12,2.3123121195567364e-09±8.038381645968701e-12,5.492586385713594e-10±6.318351225421843e-12,9.707401771308355e-09±1.3731321867458155e-11,4.908826012339773e-09±9.16822947360435e-12
Monomer-Closed_Individual_Scales,1.3795895692374776,2675,k,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,585.9927902689327±29.125761246573827,1.0204164180294129e-09±1.581945857464346e-12,2.1329960020466388e-10±1.2077975435046012e-12,2.075653871003169e-09±1.9474686953061366e-12,4.832798605747257e-10±1.4213422350028869e-12,8.812909735311791e-09±3.4086897229438337e-12,4.433950762106065e-09±2.3245146604652868e-12
Open-Closed,2.2501680989281625,445,k,scaling_factor0_9,3.601563491884008e-13±0.00039339323169999173,4.952516174938637e-10±1.0907828247456708e-12
Monomer-Open,2.643498406838119,445,k,scaling_factor0_9,11564.106709199183±832.4210026743647,7.106226718178732e-10±6.189163102578837e-12
Monomer-Closed,1.2506878262845327,445,k,scaling_factor0_9,3567.1952189406447±371.7132629283984,5.881983788924572e-10±4.970131183993243e-12
Open-Closed,1.2248289459993624,445,k,scaling_factor0_225,1.5363266214762916e-12±0,1.0049072685092142e-10±0
Monomer-Open,1.1850961371308917,445,k,scaling_factor0_225,16474.79589624025±2833.255958239668,1.5117329610347952e-10±3.4762309140180773e-12
Monomer-Closed,1.1263909988040377,445,k,scaling_factor0_225,6247.748874292872±1969.2997559906846,1.2589906894788783e-10±4.231083127457938e-12
Open-Closed,2.623157151647579,445,k,scaling_factor2_2,1.8405277302235845e-12±0,1.0189906696211892e-09±0
Monomer-Open,7.770735947033868,445,k,scaling_factor2_2,7988.70846864133±659.7494719524013,1.4004151172031243e-09±1.2104270169780753e-11
Monomer-Closed,1.0355285991781933,445,k,scaling_factor2_2,1768.6165511868628±133.37423027538938,1.151150952338753e-09±5.097243955583818e-12
Open-Closed,1.6310132144695257,445,k,scaling_factor0_45,6.110232320111209e-10±0.0405197656696667,2.3157564754683335e-10±1.5422258273095806e-12
Monomer-Open,1.4451484300339723,445,k,scaling_factor0_45,17268.28261839559±1616.3344267222324,3.5018987709634075e-10±4.613703295574204e-12
Monomer-Closed,1.1788814567239638,445,k,scaling_factor0_45,7141.302548479925±1077.4530781042545,2.938829180010316e-10±4.8942396558448616e-12
Open-Closed,2.0473742914774045,445,k,scaling_factor8_8,8.531841899639403e-12±0.0006707084729411748,4.372231465765708e-09±2.3522225211330147e-12
Monomer-Open,83.20355792437526,445,k,scaling_factor8_8,2152.549420623712±389.0190619421427,5.394261037849901e-09±5.7365519987939135e-11
Monomer-Closed,1.6443282853402037,445,k,scaling_factor8_8,52.78014094104868±10.072797205777396,4.465588565594203e-09±9.087472033649693e-12
Open-Closed,3.7441148123805843,445,k,scaling_factor4_499999999999999,2.2196633420179523e-09±0.04112432744661495,2.1901891411602037e-09±2.3820062056514955e-12
Monomer-Open,35.19038659312791,445,k,scaling_factor4_499999999999999,4965.370825746898±541.0809480169584,2.873749238574419e-09±2.6937582360362584e-11
Monomer-Closed,1.2707751195070658,445,k,scaling_factor4_499999999999999,657.6201874635033±44.20909138976637,2.3601220977553794e-09±5.834364711089205e-12
3-state_Single_Scale,8.420501324075516,2679,k,k1,scaling_factor,173323692.0148578±961191964643.7219,2.334323252695114e-06±0.013176934295718477,8.730889788921559e-09±1.357784081349648e-11
3-state_Individual_Scale,1.3801074164211111,2674,k,k1,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,720058911.4182954±4712417688820.822,8.137853728662492e-07±0.0053788564602851065,1.0204164180294129e-09±1.7394690811836413e-12,2.1329960020466388e-10±1.1661035918187955e-12,2.075654093047774e-09±2.2827810147278105e-12,4.832798605747257e-10±1.5053607166426584e-12,8.812910401445606e-09±5.6680774433197645e-12,4.433951206195275e-09±3.3250908468501782e-12
3-state,1.244004320287907,444,k,k1,scaling_factor0_9,15288.660354275029±7600.133501130614,0.08010109109537744±0.04703313260315362,1.0371219438809476e-09±4.809874174179948e-12
3-state,1.1275742507853492,444,k,k1,scaling_factor0_225,17070.73901207036±20729.292444531613,0.14418973696021986±0.2268113945120016,2.14685380584001e-10±4.231090299795642e-12
3-state,1.0378627351976344,444,k,k1,scaling_factor2_2,185305492.37827435±1353034804097.2397,2.6271656914378383e-06±0.019327436405283997,2.091002038184797e-09±4.815904227794891e-12
3-state,1.179350664883329,444,k,k1,scaling_factor0_45,29028.655566232967±29749.387769850753,0.08716474531020513±0.10464625355338188,4.935911679382343e-10±4.841338936627694e-12
3-state,1.6480334379433648,444,k,k1,scaling_factor8_8,74927496.51422621±3011333184521.274,1.7918114592063716e-07±0.00730035019924905,8.777190974029736e-09±7.790465219769675e-12
3-state,1.2736395883507758,444,k,k1,scaling_factor4_499999999999999,341002705.1497503±6514805360824.465,5.119172821199669e-07±0.00985172798822378,4.445436907474232e-09±5.293286935875841e-12
5-state_Single_Scale,8.40955598492184,2678,k,k1,k2,scaling_factor,894183.820234663±0,0.0019627685263932104±0,0.22895838959938652±0,8.729908573812395e-09±0
5-state_Individual_Scale,1.3750978968802392,2673,k,k1,k2,scaling_factor0_9,scaling_factor0_225,scaling_factor2_2,scaling_factor0_45,scaling_factor8_8,scaling_factor4_499999999999999,649498.1408342685±0,0.0020835053600749553±0,0.42176400635655975±0,1.0197191979699483e-09±0,2.1299517705131166e-10±0,2.074852067934785e-09±0,4.827949151575694e-10±0,8.81201112079566e-09±0,4.432983313762406e-09±0
5-state,1.2452518892390327,443,k,k1,k2,scaling_factor0_9,3649982.504501755±22306878898.512386,0.15932930054151084±4.054209756390413,0.002229116300540568±13.79015616166845,1.037005148418757e-09±6.034920916159181e-12
5-state,1.130119108040711,443,k,k1,k2,scaling_factor0_225,17092.829716577817±265466.3034728167,0.0004203233055524169±5.287435769419636,342.6489022771118±4348532.821278521,2.14685380584001e-10±4.0344409763510615e-12
5-state,1.0351970023783603,443,k,k1,k2,scaling_factor2_2,362436.84824600193±0,0.004181198773479666±0,0.3123394966250155±0,2.0898163199944975e-09±0
5-state,1.1811357756947156,443,k,k1,k2,scaling_factor0_45,6116591.489852166±55598825090.851326,0.19189087642436364±7.956031680077219,0.0023220990971331013±21.420629267453638,4.935591935151251e-10±5.475331873083644e-12
5-state,1.6382482016899793,443,k,k1,k2,scaling_factor8_8,117713.53150950116±0,0.0005066456475271153±0,0.22276226802308963±0,8.776464222037816e-09±0
5-state,1.2791134807665492,443,k,k1,k2,scaling_factor4_499999999999999,59978.21805902952±0,0.0032382304805331774±0,0.8826073812364774±0,4.4455352732342135e-09±0
I272A_2017
Closed_Single_Scale,10.077660131820537,1361,scaling_factor,1.5195864566663886e-09±1.4041288083816979e-12
Open_Single_Scale,40.00873007882292,1361,scaling_factor,1.6588812545847986e-09±3.05046659535348e-12
Monomer_Single_Scale,434.75589360377063,1361,scaling_factor,3.774386136967678e-09±2.3510228611977692e-11
Closed_Individual_Scales,6.205076198847537,1359,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,1.5415724252676455e-09±1.354111582753058e-12,7.439477922588367e-10±1.1569210511406288e-12,3.633233713884465e-10±8.210477930916591e-13
Open_Individual_Scales,35.75040735204575,1359,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,1.6841836814052158e-09±3.5536331430248995e-12,8.115614846815333e-10±3.038296413289823e-12,3.9547121133409746e-10±2.144362879347458e-12
Monomer_Individual_Scales,435.34291271350827,1359,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,3.78058584438179e-09±2.8580304706464382e-11,1.8787320588131706e-09±2.505168813012816e-11,9.425089597669967e-10±1.829913208901307e-11
Closed,8.698090383957643,453,scaling_factor3_7,1.5415726473122504e-09±1.603219285316849e-12
Closed,5.790954207560294,453,scaling_factor1_85,7.439477922588367e-10±1.1176484297450035e-12
Closed,4.126184005193661,453,scaling_factor0_925,3.633233713884465e-10±6.695286629579998e-13
Open,68.0526173088621,453,scaling_factor3_7,1.6841836814052158e-09±4.902916655781307e-12
Open,25.312650389033205,453,scaling_factor1_85,8.115614846815333e-10±2.5565744449155122e-12
Open,13.88595435739187,453,scaling_factor0_925,3.954707672448876e-10±1.374596439573057e-12
Monomer,954.9159242043648,453,scaling_factor3_7,3.78058584438179e-09±4.232857842107978e-11
Monomer,252.25939340758032,453,scaling_factor1_85,1.8787318367685657e-09±1.9069806541342135e-11
Monomer,98.85342052853116,453,scaling_factor0_925,9.425087377223917e-10±8.71988387545325e-12
Open-Closed_Single_Scales,10.085070177091046,1360,k,scaling_factor,5.278888437487694e-12±0.0015018338723078069,1.5195857905325738e-09±2.609848716517211e-12
Monomer-Open_Single_Scales,15.332529600935272,1360,k,scaling_factor,7364.423376672264±353.32129467610883,3.4487934730265124e-09±4.7249311070061075e-12
Monomer-Closed_Single_Scales,2.770769832627186,1360,k,scaling_factor,2582.089226893949±92.63133954810608,3.1415443579874136e-09±2.2855346095340507e-12
Open-Closed_Individual_Scales,6.2096454744267175,1358,k,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,4.240607864858248e-12±0,1.5415724252676455e-09±0,7.439477922588367e-10±0,3.633233713884465e-10±0
Monomer-Open_Individual_Scales,14.362605937067253,1358,k,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,6807.878908487171±332.747203564248,3.470593368248842e-09±5.118919382786397e-12,1.6983012773863493e-09±4.3030861189176095e-12,8.451896960082195e-10±3.123558106773469e-12
Monomer-Closed_Individual_Scales,1.5253344981989596,1358,k,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,1918.0085797475097±61.805241613490395,3.155615102556908e-09±1.7709394003006822e-12,1.5402359387906017e-09±1.4238886832700564e-12,7.642986243894256e-10±1.026105554503271e-12
Open-Closed,8.717333946755954,452,k,scaling_factor3_7,1.8962609260597674e-13±0,1.5415726473122504e-09±0
Monomer-Open,30.712544397434982,452,k,scaling_factor3_7,25852.85284743095±2213.615347882836,2.0649715271048308e-09±1.6543211734490386e-11
Monomer-Closed,1.7779614830960988,452,k,scaling_factor3_7,6694.153917938665±314.60472574338945,1.7300347820992101e-09±4.569567752495378e-12
Open-Closed,5.803766068026525,452,k,scaling_factor1_85,2.6402073860509745e-09±0.054158630946557436,7.439475702142317e-10±1.4420899335441793e-12
Monomer-Open,7.9971058805539155,452,k,scaling_factor1_85,42839.238183414935±2777.701984562573,1.0519243254236699e-09±7.783331649041986e-12
Monomer-Closed,1.4076677871757326,452,k,scaling_factor1_85,15312.824926173398±803.0930128497289,8.843676901904018e-10±3.761639122250833e-12
Open-Closed,4.135312735579967,452,k,scaling_factor0_925,8.866558598441543e-10±0.0437872089309321,3.633231493438416e-10±1.4794490013075043e-12
Monomer-Open,4.068441749943383,452,k,scaling_factor0_925,60226.243340074994±3737.2749036249234,5.366267430417793e-10±4.3598019365402184e-12
Monomer-Closed,1.3732911641653351,452,k,scaling_factor0_925,24074.245724112978±1573.5943835975943,4.508386997059688e-10±2.9730957346274003e-12
3-state_Single_Scale,2.758204825138075,1359,k,k1,scaling_factor,80003.409589152±29195.773371130672,0.03443900107000086±0.013420560720835539,3.151198635364949e-09±4.347378021831141e-12
3-state_Individual_Scale,1.5195031977347064,1357,k,k1,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,86375.563168806±33735.533865868194,0.023397337180762534±0.009601255285663668,3.162473838358437e-09±3.2682727363070853e-12,1.5436776301669397e-09±1.9839850031906996e-12,7.660685419352831e-10±1.248294970220343e-12
3-state,1.7627737844684976,451,k,k1,scaling_factor3_7,75605.01393759178±33103.9550997459,0.025835872812350225±0.011973317581912096,3.161811035212736e-09±4.121165814211037e-12
3-state,1.4011515554201008,451,k,k1,scaling_factor1_85,125199.05670955798±68493.83066998914,0.037880514495948425±0.022317161492702298,1.5490277949226083e-09±3.5892195783564337e-12
3-state,1.376339049569443,451,k,k1,scaling_factor0_925,556467334.9386779±1479253248310.896,1.2781384682636343e-05±0.034247612465275995,7.63006324788762e-10±2.8730481053742913e-12
5-state_Single_Scale,2.760241519396153,1358,k,k1,k2,scaling_factor,79997.27739009078±30667.728587657944,3.2574836339449575e-06±0.0395382186497476,10572.995395572681±127357363.72607899,3.1511997455879737e-09±4.349646905192765e-12
5-state_Individual_Scale,1.512548169906363,1356,k,k1,k2,scaling_factor3_7,scaling_factor1_85,scaling_factor0_925,75504542.48167497±258872581610.6548,0.05845505625540781±0.18256000008961404,0.00046220158460696936±1.5963529789341953,3.1627418461965817e-09±3.364949727235645e-12,1.543197125641882e-09±2.066022335804619e-12,7.654430422832093e-10±1.4782639706737382e-12
5-state,1.7545524207000542,450,k,k1,k2,scaling_factor3_7,95675598.67151138±1435236884415.1064,0.05950243138544531±0.5931092155711732,0.0003479573904734412±5.258418128428876,3.161890971270509e-09±4.484085953236711e-12
5-state,1.3960133942921886,450,k,k1,k2,scaling_factor1_85,121696584.23342068±1738261883597.6584,0.08961514107127±1.1243637715005599,0.00044708519759395493±6.434842939634424,1.548922323735269e-09±3.8384952228258175e-12
5-state,1.3759560580385806,450,k,k1,k2,scaling_factor0_925,4757907.59863114±0,0.006559536761526097±0,0.22021109409960915±0,7.619289643656657e-10±0
ILAA_2017
Closed_Single_Scale,413.365367159509,1361,scaling_factor,2.511102659141784e-09±9.37501136995027e-12
Open_Single_Scale,546.2316866117975,1361,scaling_factor,2.7363595833662657e-09±1.1744865931293373e-11
Monomer_Single_Scale,379.73312828053326,1361,scaling_factor,6.3686522722150585e-09±2.2739050262010336e-11
Closed_Individual_Scales,372.73701811124585,1359,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,5.696492166862299e-10±6.359442243684636e-12,2.5942019643565573e-09±1.1929184724334598e-11,1.2293064344248705e-09±7.961492987260457e-12
Open_Individual_Scales,502.8028440696418,1359,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,6.185645329281897e-10±7.966659600677477e-12,2.830861989266964e-09±1.5112255716946714e-11,1.338208432954957e-09±1.0079494040075451e-11
Monomer_Individual_Scales,371.80164764919107,1359,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,1.5150871668367927e-09±1.6642211349913526e-11,6.443148681256616e-09±2.966552533010347e-11,3.1762390495515547e-09±2.0310652540672856e-11
Closed,195.30007265331076,453,scaling_factor1_56,5.696492166862299e-10±4.603296687782962e-12
Closed,504.09711035058274,453,scaling_factor6_219999999999999,2.5942019643565573e-09±1.3872879193529421e-11
Closed,418.81387132984395,453,scaling_factor3_1099999999999994,1.2293064344248705e-09±8.439248637556243e-12
Open,254.15758815120364,453,scaling_factor1_56,6.185645329281897e-10±5.7670685400903835e-12
Open,697.8819957681799,453,scaling_factor6_219999999999999,2.830861989266964e-09±1.7804157526099528e-11
Open,556.3689482895419,453,scaling_factor3_1099999999999994,1.338208432954957e-09±1.060282054886333e-11
Monomer,28.453888620248343,453,scaling_factor1_56,1.5150871668367927e-09±4.570303595300972e-12
Monomer,875.875790594124,453,scaling_factor6_219999999999999,6.443148681256616e-09±4.5453730360383616e-11
Monomer,211.0752637332007,453,scaling_factor3_1099999999999994,3.1762390495515547e-09±1.5303365184983175e-11
Open-Closed_Single_Scales,413.66931388082867,1360,k,scaling_factor,8.64026694635811e-09±0.07828023650710832,2.5110855617072048e-09±1.9301886793018273e-11
Monomer-Open_Single_Scales,14.063722494940981,1360,k,scaling_factor,169147.65732895603±2453.981487095853,6.08982109184808e-09±4.668396736199165e-12
Monomer-Closed_Single_Scales,11.531513242724202,1360,k,scaling_factor,153935.156179966±2203.6231577906715,5.814759340694309e-09±4.884042811366343e-12
Open-Closed_Individual_Scales,373.01149514010433,1358,k,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,5.314304551973237e-11±0.014900127755724666,5.696332294746753e-10±7.386874720610564e-12,2.5941915282601258e-09±2.0488947117371618e-11,1.229301993532772e-09±1.1090279922207277e-11
Monomer-Open_Individual_Scales,6.127469962898049,1358,k,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,166485.66145432417±1594.998294598453,1.4537127057678845e-09±2.0721858182615297e-12,6.162623078509455e-09±3.836027730640679e-12,3.0267588435606285e-09±2.587510313657167e-12
Monomer-Closed_Individual_Scales,8.329272597386584,1358,k,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,152057.3234292164±1854.9553655374427,1.409792949047528e-09±2.4204325368093667e-12,5.8505806865838395e-09±4.798741546675545e-12,2.903264295639474e-09±3.1661692285616107e-12
Open-Closed,195.73215296067542,452,k,scaling_factor1_56,7.860379014346108e-14±0,5.696541016675383e-10±0
Monomer-Open,1.5996812858413396,452,k,scaling_factor1_56,483266.54738067655±8175.153007388655,1.3076231208941635e-09±2.6109739796514486e-12
Monomer-Closed,2.316630375782253,452,k,scaling_factor1_56,465084.0006738645±9940.481688109401,1.2716467878703952e-09±3.665146133119412e-12
Open-Closed,505.2123700263776,452,k,scaling_factor6_219999999999999,7.807005486526464e-09±0.10755018754227313,2.594200187999718e-09±2.8278773814319254e-11
Monomer-Open,11.63197880962284,452,k,scaling_factor6_219999999999999,101217.73241293729±1541.6842786665886,4.6249510887719225e-09±1.120102669973198e-11
Monomer-Closed,13.53739470616842,452,k,scaling_factor6_219999999999999,91312.8025123724±1670.066607874417,4.324610669570461e-09±1.3677713812852235e-11
Open-Closed,419.74045075410146,452,k,scaling_factor3_1099999999999994,1.4811663007208153e-10±0.030424702786803738,1.2293044360234262e-09±8.632390532884259e-12
Monomer-Open,3.0474036374530957,452,k,scaling_factor3_1099999999999994,226141.33638437855±2482.2439192918796,2.5159978545019612e-09±4.173356668488878e-12
Monomer-Closed,6.446779802883306,452,k,scaling_factor3_1099999999999994,212745.55776148697±3647.9022482045993,2.4035622381290978e-09±6.992122999158364e-12
3-state_Single_Scale,9.31976905963604,1359,k,k1,scaling_factor,382280.7857882451±20826.590483826338,0.6947547331108437±0.0651931914380085,5.923480372871381e-09±7.541928570611091e-12
3-state_Individual_Scale,4.029526074139432,1357,k,k1,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,265341.0516791888±6790.140323333308,1.4494795264142066±0.09229114545437311,1.4349781363165448e-09±1.8199334403187507e-12,6.0308937843700505e-09±5.841357911570501e-12,2.9743281171334957e-09±2.8823733944536695e-12
3-state,1.6032176083254301,451,k,k1,scaling_factor1_56,216663.6195481865±14741.768512738101,255.79928681145378±4692.002975932847,1.4634033984606276e-09±2.9023055514915244e-12
3-state,4.792954847138981,451,k,k1,scaling_factor6_219999999999999,65616.10477056878±2238.349103525658,1.1477947111748206±0.08472543152083521,5.993351370747746e-09±7.1055041015972715e-12
3-state,2.7143525019701307,451,k,k1,scaling_factor3_1099999999999994,118709.43158145348±4592.339504932961,3.31292890960723±0.5721337307671849,3.0082885071891496e-09±4.155940751271917e-12
5-state_Single_Scale,9.326660398134534,1358,k,k1,k2,scaling_factor,382279.7061700346±40655.779095538426,2.9277100265456824e-05±0.19255413488624357,23730.53652295257±154869048.72051847,5.923481483094406e-09±7.837664166022527e-12
5-state_Individual_Scale,3.7683250912164477,1356,k,k1,k2,scaling_factor1_56,scaling_factor6_219999999999999,scaling_factor3_1099999999999994,1789230.2623942145±4704611.148633674,3879165.520397084±1547231215139.085,0.09382057913730613±0.28673729902064765,1.4294463390740475e-09±2.0434269627004335e-12,6.030169030779575e-09±6.11555951502442e-12,2.9680886637351023e-09±2.8829369173710696e-12
5-state,1.6018106095574396,450,k,k1,k2,scaling_factor1_56,240871.32039217575±66175.94072505912,454906.4948943052±592470352670.5321,7.549634419397906±58.79168729820819,1.460481957593629e-09±2.9006428631213654e-12
5-state,4.51620246523451,450,k,k1,k2,scaling_factor6_219999999999999,361968243.0682681±2870456459218.411,28.000500171865923±464.58678678608857,9.938924323216192e-05±0.7911016902862975,5.9959679443721825e-09±8.617050573587395e-12
5-state,2.6067750542073242,450,k,k1,k2,scaling_factor3_1099999999999994,177364.82195604665±176543.5432466682,1992294.828737867±2200052820063.3037,1.0141765288124804±3.0702401400102404,3.0046363175273427e-09±4.179695783971539e-12
ILAA_2019
Closed_Single_Scale,171.43524221632472,2681,scaling_factor,7.944489732736315e-09±2.6206795205317744e-11
Open_Single_Scale,201.9073787542138,2681,scaling_factor,8.657383032684152e-09±3.112347523587737e-11
Monomer_Single_Scale,239.07260260069563,2681,scaling_factor,1.974756047573578e-08±7.740666473000952e-11
Closed_Individual_Scales,58.1109460769522,2676,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,9.333905870434478e-09±3.3186705429320795e-11,3.962532524326434e-10±4.7769598956620215e-12,1.8520518452191936e-10±4.170721941300807e-12,4.055243252309992e-09±1.1694938293073873e-11,2.013820221691276e-09±9.02650749518981e-12,9.785530163952672e-10±7.214180457945083e-12
Open_Individual_Scales,86.56553097240106,2676,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,1.0183576870659294e-08±4.429294484946535e-11,4.2974934721939917e-10±6.357311416453784e-12,2.0062396188791354e-10±5.666162093875748e-12,4.424262511903976e-09±1.5577148267036463e-11,2.193627501867468e-09±1.2113148330846049e-11,1.0637992708950605e-09±9.573796025295761e-12
Monomer_Individual_Scales,179.39626109848993,2676,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,2.1928057813980217e-08±1.396780950841162e-10,1.061926102607913e-09±2.2699098742550426e-11,5.010289960694081e-10±2.0141621536074742e-11,9.965094083241866e-09±5.104395140132695e-11,5.1143493884353575e-09±4.049276599050625e-11,2.5601689657150928e-09±3.308061148413248e-11
Closed,60.1429298822872,446,scaling_factor19_5,9.333905870434478e-09±3.3761945786265526e-11
Closed,18.41761436878413,446,scaling_factor1_3999999999999997,3.962532524326434e-10±2.6893025316053548e-12
Closed,5.94808950985908,446,scaling_factor0_8000000000000002,1.8520518452191936e-10±1.3343799832104065e-12
Closed,133.55082588278216,446,scaling_factor9_6,4.055243474354597e-09±1.7729321215576863e-11
Closed,86.67418372091689,446,scaling_factor5_2,2.013820221691276e-09±1.1084825077664906e-11
Closed,43.93203309704972,446,scaling_factor2_9,9.785530163952672e-10±6.272614577496507e-12
Open,94.5391123082182,446,scaling_factor19_5,1.018357664861469e-08±4.628794098837795e-11
Open,25.917739041851487,446,scaling_factor1_3999999999999997,4.2974912517479424e-10±3.4785850723493417e-12
Open,8.096454881018708,446,scaling_factor0_8000000000000002,2.0062396188791354e-10±1.732865038973967e-12
Open,204.09570057914647,446,scaling_factor9_6,4.424262289859371e-09±2.3978516066230623e-11
Open,125.24836772290216,446,scaling_factor5_2,2.193627501867468e-09±1.4570486645009186e-11
Open,61.49581130118388,446,scaling_factor2_9,1.0637992708950605e-09±8.069278531635456e-12
Monomer,445.6395397970904,446,scaling_factor19_5,2.1928057813980217e-08±2.2003574912692326e-10
Monomer,7.217665542792391,446,scaling_factor1_3999999999999997,1.061926102607913e-09±4.553033631823255e-12
Monomer,2.9932690562728137,446,scaling_factor0_8000000000000002,5.01029218114013e-10±2.601586067856279e-12
Monomer,472.16323396132486,446,scaling_factor9_6,9.965094083241866e-09±8.271772235066225e-11
Monomer,121.25241283944143,446,scaling_factor5_2,5.1143493884353575e-09±3.329005338063746e-11
Monomer,27.111445393948337,446,scaling_factor2_9,2.5601689657150928e-09±1.2804421761187277e-11
Open-Closed_Single_Scales,171.49921059029452,2680,k,scaling_factor,7.37410132956029e-13±0,7.944489732736315e-09±0
Monomer-Open_Single_Scales,70.92874282760769,2680,k,scaling_factor,180648.1939556157±8552.05898826828,1.893234857774928e-08±4.4342746185323245e-11
Monomer-Closed_Single_Scales,57.59427551278405,2680,k,scaling_factor,167130.13294088282±7820.728695601132,1.7981047983894882e-08±4.530127802576589e-11
Open-Closed_Individual_Scales,58.13266996561691,2675,k,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,2.6910673689428677e-09±0.02332746430449143,9.333905426345268e-09±4.4661001877582285e-11,3.962523642542237e-10±4.926248022381221e-12,1.851940822916731e-10±4.469963204655869e-12,4.055243252309992e-09±1.7566384614757113e-11,2.013820221691276e-09±1.1043074059509836e-11,9.78553238439872e-10±7.835411575322136e-12
Monomer-Open_Individual_Scales,5.167241294432489,2675,k,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,146210.65237071717±1946.0275675661787,2.1239876302203697e-08±2.2819854866668346e-11,1.014942352384196e-09±3.643718777089361e-12,4.846407719583112e-10±3.342145780165835e-12,9.474433904088642e-09±8.531817863049148e-12,4.832410915867058e-09±6.658299570270067e-12,2.4196100678608445e-09±5.350196177235857e-12
Monomer-Closed_Individual_Scales,3.1423074487631166,2675,k,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,122244.89573115774±1451.7721707666667,1.98512566385034e-08±1.7303007601502963e-11,9.79918812760161e-10±2.7738389074204745e-12,4.721552038233767e-10±2.5398353207456974e-12,8.902542703026484e-09±6.909924100905726e-12,4.573802669938232e-09±5.2394138895682335e-12,2.309037849812512e-09±4.116042771786476e-12
Open-Closed,60.05710215140675,445,k,scaling_factor19_5,0.08721880132047422±0.07358376564438329,9.39932642829433e-09±6.13051018950538e-11
Monomer-Open,13.769194097772626,445,k,scaling_factor19_5,428190.48892485764±17980.380809116265,1.4027888850520753e-08±7.716258433442939e-11
Monomer-Closed,6.1888233714582395,445,k,scaling_factor19_5,355513.7962068967±11794.93934147716,1.2841181007416935e-08±5.725482418642659e-11
Open-Closed,18.459002307672613,445,k,scaling_factor1_3999999999999997,2.650051511565721e-09±0.45584953550550084,3.9625103198659417e-10±6.101900286943461e-12
Monomer-Open,1.2434227274312937,445,k,scaling_factor1_3999999999999997,3840199.1671306365±143510.88801832078,8.636531489969457e-10±4.723471762436793e-12
Monomer-Closed,1.1859659611833797,445,k,scaling_factor1_3999999999999997,3419276.3905385095±134252.33704667923,8.228342451843673e-10±5.3515259835569775e-12
Open-Closed,5.961456005204406,445,k,scaling_factor0_8000000000000002,6.189433410241918e-10±0.14092657038058723,1.8520474043270951e-10±1.3642378736003652e-12
Monomer-Open,1.4357390814721263,445,k,scaling_factor0_8000000000000002,3966128.6611269894±309060.6666414353,4.076163850896819e-10±4.571641988095767e-12
Monomer-Closed,1.397496562992147,445,k,scaling_factor0_8000000000000002,3453327.9421765576±285873.2390727862,3.872333564913788e-10±5.321869386367792e-12
Open-Closed,133.8509401994476,445,k,scaling_factor9_6,1.0473488742945847e-10±0.021133059163298155,4.055233260302771e-09±2.5478936378387824e-11
Monomer-Open,9.960864885018117,445,k,scaling_factor9_6,814295.985616204±20022.290805750647,6.742600699993773e-09±2.5434593949459923e-11
Monomer-Closed,5.85016471662435,445,k,scaling_factor9_6,682372.8097007186±14997.115739373243,6.196022805937673e-09±2.2013561903380327e-11
Open-Closed,86.8689571695128,445,k,scaling_factor5_2,1.199040866595169e-14±9.4537826418271e-05,2.0138191114682513e-09±2.281652089653423e-11
Monomer-Open,2.8257121211113994,445,k,scaling_factor5_2,1547449.3836884098±28842.397965696815,3.734792253240471e-09±1.1312876122021888e-11
Monomer-Closed,2.288890413176619,445,k,scaling_factor5_2,1358226.1301473703±25519.081777683383,3.4869380716173737e-09±1.1630345511165903e-11
Open-Closed,44.03075685651836,445,k,scaling_factor2_9,7.596616669047762e-10±0.03825540478147579,9.78547465280144e-10±1.3430616960734352e-11
Monomer-Open,1.3557306369249709,445,k,scaling_factor2_9,2661460.3138776086±57647.801391141016,1.99787386634398e-09±6.74644817037137e-12
Monomer-Closed,1.409921506178703,445,k,scaling_factor2_9,2398616.885835869±57746.99771010116,1.8925880862497024e-09±7.982211380282759e-12
3-state_Single_Scale,57.615885203971736,2679,k,k1,scaling_factor,9762897846.641188±35156079427086.336,1.7118456236309143e-05±0.0620830798976208,1.7981046207538043e-08±7.510816000548932e-11
3-state_Individual_Scale,2.230352652064203,2674,k,k1,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,346237.17724154366±10347.067877637079,0.5720329855421686±0.026830421803599746,2.033917101407212e-08±2.096493945233133e-11,9.917222598687658e-10±2.4103724827806476e-12,4.763518468564598e-10±2.1289611304197432e-12,9.100978415332861e-09±8.38803486597971e-12,4.662680463951574e-09±5.184293805864168e-12,2.346650207485368e-09±3.678959942031746e-12
3-state,4.168103487588879,444,k,k1,scaling_factor19_5,358814.34555294213±25330.86544610544,0.4782231359207625±0.04717568612503962,2.0252227672656886e-08±3.736455119218115e-11
3-state,1.1730500108145645,444,k,k1,scaling_factor1_3999999999999997,4813858.963224251±1935269.1802777958,0.4486170154080191±0.26919147372912244,9.833762693034487e-10±5.18418396203546e-12
3-state,1.4006404975119717,444,k,k1,scaling_factor0_8000000000000002,150933513.07607412±4268884459.5485096,0.00979541902064529±0.2800592393117337,4.573150746978172e-10±5.363590069092257e-12
3-state,3.2446868688627593,444,k,k1,scaling_factor9_6,638859.9303166413±33139.795151712024,0.6338696336960787±0.05411692582116822,9.105416420851498e-09±1.395974355015715e-11
3-state,1.5540000939874206,444,k,k1,scaling_factor5_2,1240799.333784847±82530.5587183448,0.7623234795289164±0.09194469661262392,4.699436617627839e-09±8.525691898493668e-12
3-state,1.194839975889669,444,k,k1,scaling_factor2_9,1918615.601806648±204979.40206127142,1.138829139404936±0.2713733742617552,2.3796051795699213e-09±6.837340721692228e-12
5-state_Single_Scale,57.63744302687018,2678,k,k1,k2,scaling_factor,13787856758.88831±77502393605450.58,5.633631339208023e-10±9.788156122114106e-06,21513.043860651043±288762324.10162944,1.7980996247501935e-08±7.876578950256246e-11
5-state_Individual_Scale,2.190443644137053,2673,k,k1,k2,scaling_factor19_5,scaling_factor1_3999999999999997,scaling_factor0_8000000000000002,scaling_factor9_6,scaling_factor5_2,scaling_factor2_9,520975155.21864897±338181983842.1005,1.872718763098626±1.3231414390362621,0.00036525469284254264±0.2384295617958695,2.0364478325873847e-08±2.2374940408026503e-11,9.871938821959247e-10±2.522415157507014e-12,4.73653116728201e-10±2.152602970247701e-12,9.099120346078848e-09±8.40461223140245e-12,4.655219765226093e-09±5.2883376739543374e-12,2.3397150883397444e-09±3.841126634107586e-12
5-state,4.041057734442511,443,k,k1,k2,scaling_factor19_5,2104011636.0595942±30717415296586.047,1.2619040946318276±4.550279721760602,9.93189372962e-05±1.4585880130631816,2.0259553590307178e-08±4.527290095991366e-11
5-state,1.175700390612788,443,k,k1,k2,scaling_factor1_3999999999999997,4813650.560787797±2858297.857550905,0.00010115948534594743±1.024280572653037,4435.322546847208±44606762.47283073,9.833760472588438e-10±5.226659109648795e-12
5-state,1.4038034641727541,443,k,k1,k2,scaling_factor0_8000000000000002,126233386.6313605±13096872320.36746,1.3359064470197524e-06±0.056717076796734496,8785.79540954556±368623673.1599917,4.5734660503171654e-10±5.4598593707430525e-12
5-state,3.138042382334295,443,k,k1,k2,scaling_factor9_6,2386448359.562344±19494372901467.324,2.2797663839686257±8.99213073838378,0.00014840645650715523±1.2177908738987473,9.108420018222319e-09±1.720118310283389e-11
5-state,1.5030255742867429,443,k,k1,k2,scaling_factor5_2,4120363589.170806±35342036476688.13,4.820419295200315±33.97683403933,0.00015426414264951838±1.3288314349534769,4.700186018169461e-09±9.988778188425362e-12
5-state,1.1791747642993826,443,k,k1,k2,scaling_factor2_9,16015799.719901312±459587190.82078475,407223.47455762303±142981362319.22458,0.0658662751744219±2.1169942760134686,2.378018226778522e-09±7.525996407008208e-12

And here is my code to extract data from the above csv

import re
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import approx_fprime
sample_list2=['WT_2017','L273A_2019','L273A_2020','I272A_2017','I272A_2019','I272A_2020','ILAA_2017','ILAA_2019','ILAA_2020']
mw=42000
def convert_concentration(conc):
    return float(((conc/mw)*1000000000))

def filter_data(input_line):
        temp_solutions=[]
        temp_uncertanties=[]
        temp_variable_names=[]
        temp_concentrations=[]
        temp_fit_names=[input_line[0]]
        for items in input_line:
            variable_names=re.search('k\d*|scaling_factor(\d+_\d+)*',items)
            if re.search('\u00B1',items) is not None:
                temp_solutions.append(items.split('\u00B1')[0])
                temp_uncertanties.append(items.split('\u00B1')[1])
            if variable_names is not None:
                temp_variable_names.append(variable_names.group(0))
                if variable_names.group(1) is not None:
                    temp_concentrations.append(convert_concentration(float(variable_names.group(1).replace('_','.'))))
        return [temp_fit_names,temp_variable_names,temp_solutions,temp_uncertanties],temp_concentrations                

def import_data():
    count=-1
    samples=[]
    mega_list=[]
    total_concentrations=[]
                            
    per_line_1=[]
    per_line_2=[]
    per_line_3=[]
    per_line_4=[]
    per_line_5=[]
    per_line_6=[]
    per_line_7=[]
    per_line_8=[]
    per_line_9=[]
    temp_concentrations_1=[]
    temp_concentrations_2=[]
    temp_concentrations_3=[]
    temp_concentrations_4=[]
    temp_concentrations_5=[]
    temp_concentrations_6=[]
    temp_concentrations_7=[]
    temp_concentrations_8=[]
    temp_concentrations_9=[]
    with open('scaled_uncertanty_fits.txt') as data_file:
        for lines in data_file:
            line=lines.split(',')
            sample_names=(line[0]).strip()
            if sample_names in sample_list2:
                samples.append(sample_names)    
                count+=1
            if re.search('Open-Closed',sample_names) is not None and samples[count] == 'WT_2017':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_1.append(concentration)
                per_line_1.append(per_line_temp)
            if re.search('Monomer-Closed',sample_names) is not None and samples[count] == 'L273A_2019':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_2.append(concentration)
                per_line_2.append(per_line_temp)
            if re.search('Monomer-Closed',sample_names) is not None and samples[count] == 'L273A_2020':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_3.append(concentration)
                per_line_3.append(per_line_temp)
            if re.search('Monomer-Closed',sample_names) is not None and samples[count] == 'I272A_2017':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_4.append(concentration)
                per_line_4.append(per_line_temp)
            if re.search('Monomer-Closed',sample_names) is not None and samples[count] == 'I272A_2019':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_5.append(concentration)
                per_line_5.append(per_line_temp)
            if re.search('Monomer-Closed',sample_names) is not None and samples[count] == 'I272A_2020':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_6.append(concentration)
                per_line_6.append(per_line_temp)
            if re.search('3-state',sample_names) is not None and samples[count] == 'ILAA_2017':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_7.append(concentration)
                per_line_7.append(per_line_temp)
            if re.search('3-state',sample_names) is not None and samples[count] == 'ILAA_2019':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_8.append(concentration)
                per_line_8.append(per_line_temp)
            if re.search('3-state',sample_names) is not None and samples[count] == 'ILAA_2020':
                per_line_temp,concentration=filter_data(line)
                temp_concentrations_9.append(concentration)
                per_line_9.append(per_line_temp)    
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_1 for item in sublist])))
    mega_list.append(per_line_1)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_2 for item in sublist])))
    mega_list.append(per_line_2)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_3 for item in sublist])))
    mega_list.append(per_line_3)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_4 for item in sublist])))
    mega_list.append(per_line_4)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_5 for item in sublist])))
    mega_list.append(per_line_5)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_6 for item in sublist])))
    mega_list.append(per_line_6)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_7 for item in sublist])))
    mega_list.append(per_line_7)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_8 for item in sublist])))
    mega_list.append(per_line_8)
    total_concentrations.append(list(dict.fromkeys([item for sublist in temp_concentrations_9 for item in sublist])))
    mega_list.append(per_line_9)        
    return mega_list,total_concentrations

def open_closed(k,conc):
    open_concentration=(k*conc)/(k+1)
    closed_concentration=conc/(k+1)
    monomer_concentration=0
    return np.array([open_concentration/conc,closed_concentration/conc,monomer_concentration/conc])
def monomer_closed(k,conc):
    open_concentration=0
    monomer_concentration=(np.sqrt((8*k*conc)+k**2)-k)/4
    closed_concentration=(-np.sqrt(k)*np.sqrt((8*conc)+k)+k+(4*conc))/4
    return np.array([open_concentration/conc,closed_concentration/conc,monomer_concentration/conc])
def three_state(k0,k1,conc):
    monomer_concentration=((np.sqrt(k0)*np.sqrt(k1))*(np.sqrt((8*conc*(k1+1))+(k0*k1)))-(k0*k1))/(4*(k1+1))
    open_concentration=(k1*((-np.sqrt(k0)*np.sqrt(k1))*(np.sqrt((8*conc*(k1+1))+(k0*k1)))+(k0*k1)+(4*conc*(k1+1))))/(4*((k1+1)**2))
    closed_concentration=((-np.sqrt(k0)*np.sqrt(k1))*(np.sqrt((8*conc*(k1+1))+(k0*k1)))+(k0*k1)+(4*conc*(k1+1)))/(4*((k1+1)**2))
    return np.array([open_concentration/conc,closed_concentration/conc,monomer_concentration/conc])

mega_list,total_concentrations=import_data()
for items,concentrations,name in zip(mega_list,total_concentrations,sample_list2):
    concen_individuals=[]
    populations_monomer_individuals=[]
    populations_closed_individuals=[]
    populations_open_individuals=[]
    populations_monomer_errors=[]
    populations_closed_errors=[]
    populations_open_errors=[]
    h=1e-8
    for i in items:
        concen=[]
        populations_monomer=[]
        populations_closed=[]
        populations_open=[]
        monomer_errors=[]
        closed_errors=[]
        open_errors=[]
        sample_name,variable_names,solutions,uncertanties=i
        if re.search('Scale(s)*',sample_name[0]) is not None:
            k_value=float(solutions[variable_names.index('k')])
            k_error=float(uncertanties[variable_names.index('k')])
            if re.search('Open-Closed',sample_name[0]) is not None:
                for io in concentrations:
                    fo,fc,fm=open_closed(k_value,io)
                    populations_open.append(fo)
                    populations_closed.append(fc)
                    populations_monomer.append(fm)
                    concen.append(io)           
                    dk_fo,dk_fc,dk_fm=((open_closed(k_value+h,io)-open_closed(k_value,io))/h)
                    open_errors.append((k_error**2*dk_fo**2))
                    closed_errors.append((k_error**2*dk_fc**2))
                    monomer_errors.append((k_error**2*dk_fm**2))    
            if re.search('Monomer-Closed',sample_name[0]) is not None:
                for io in concentrations:
                    fo,fc,fm=monomer_closed(k_value,io)
                    populations_open.append(fo)
                    populations_closed.append(fc)
                    populations_monomer.append(fm)
                    concen.append(io)
                    dk_fo,dk_fc,dk_fm=((monomer_closed(k_value+h,io)-monomer_closed(k_value,io))/h)
                    open_errors.append((k_error**2*dk_fo**2))
                    closed_errors.append((k_error**2*dk_fc**2))
                    monomer_errors.append((k_error**2*dk_fm**2))                
            if re.search('3-state',sample_name[0]) is not None:
                k1_value=float(solutions[variable_names.index('k1')])
                k1_error=float(uncertanties[variable_names.index('k1')])
                for io in concentrations:
                    fo,fc,fm=three_state(k_value,k1_value,io)
                    populations_open.append(fo)
                    populations_closed.append(fc)
                    populations_monomer.append(fm)
                    concen.append(io)
                    dk_fo,dk_fc,dk_fm=((three_state(k_value+h,k1_value,io)-three_state(k_value,k1_value,io))/h)
                    dk1_fo,dk1_fc,dk1_fm=((three_state(k_value,k1_value+h,io)-three_state(k_value,k1_value,io))/h)
                    open_errors.append((k_error**2*dk_fo**2)+(k1_error**2+dk_fo**2))
                    closed_errors.append((k_error**2*dk_fc**2)+(k1_error**2+dk_fc**2))
                    monomer_errors.append((k_error**2*dk_fm**2)+(k1_error**2+dk_fm**2))                                     
            if re.search('Individual',sample_name[0]) is not None:  
                plt.scatter(concen,populations_monomer,c='b',label='Monomer Individual Scale')  
                plt.scatter(concen,populations_open,c='g',label='Open Individual Scale')
                plt.scatter(concen,populations_closed,c='r',label='Closed Individual Scale')
                plt.errorbar(concen,populations_monomer,yerr=monomer_errors,linestyle='None',ecolor='b')    
                plt.errorbar(concen,populations_open,yerr=open_errors,linestyle='None',ecolor='g')
                plt.errorbar(concen,populations_closed,yerr=closed_errors,linestyle='None',ecolor='r')          
            else:   
                plt.scatter(concen,populations_monomer,c='b',label='Monomer Single Scale',marker='^')   
                plt.scatter(concen,populations_open,c='g',label='Open Single Scale',marker='^')
                plt.scatter(concen,populations_closed,c='r',label='Closed Single Scale',marker='^')
                plt.errorbar(concen,populations_monomer,yerr=monomer_errors,linestyle='None',ecolor='b')    
                plt.errorbar(concen,populations_open,yerr=open_errors,linestyle='None',ecolor='g')
                plt.errorbar(concen,populations_closed,yerr=closed_errors,linestyle='None',ecolor='r')  
        else:
            k_value=float(solutions[variable_names.index('k')])
            k_error=float(uncertanties[variable_names.index('k')])
            for entries in variable_names:
                if re.search('scaling_factor(\d+_\d+)',entries) is not None:
                    io=convert_concentration(float(((re.search('scaling_factor(\d+_\d+)',entries)).group(1)).replace('_','.')))     
            if re.search('Open-Closed',sample_name[0]) is not None:
                fo,fc,fm=open_closed(k_value,io)
                dk_fo,dk_fc,dk_fm=((open_closed(k_value+h,io)-open_closed(k_value,io))/h)
                populations_open_errors.append((k_error**2*dk_fo**2))
                populations_closed_errors.append((k_error**2*dk_fc**2))
                populations_monomer_errors.append((k_error**2*dk_fm**2))
            if re.search('Monomer-Closed',sample_name[0]) is not None:
                fo,fc,fm=monomer_closed(k_value,io)
                dk_fo,dk_fc,dk_fm=((monomer_closed(k_value+h,io)-monomer_closed(k_value,io))/h)
                populations_open_errors.append((k_error**2*dk_fo**2))
                populations_closed_errors.append((k_error**2*dk_fc**2))
                populations_monomer_errors.append((k_error**2*dk_fm**2))
            if re.search('3-state',sample_name[0]) is not None:
                k1_value=float(solutions[variable_names.index('k1')])
                k1_error=float(uncertanties[variable_names.index('k1')])
                fo,fc,fm=three_state(k_value,k1_value,io)   
                dk_fo,dk_fc,dk_fm=((three_state(k_value+h,k1_value,io)-three_state(k_value,k1_value,io))/h)
                dk1_fo,dk1_fc,dk1_fm=((three_state(k_value,k1_value+h,io)-three_state(k_value,k1_value,io))/h)
                populations_open_errors.append((k_error**2*dk_fo**2)+(k1_error**2+dk_fo**2))
                populations_closed_errors.append((k_error**2*dk_fc**2)+(k1_error**2+dk_fc**2))
                populations_monomer_errors.append((k_error**2*dk_fm**2)+(k1_error**2+dk_fm**2))

            populations_open_individuals.append(fo)
            populations_closed_individuals.append(fc)
            populations_monomer_individuals.append(fm)
            concen_individuals.append(io)
    print(populations_closed_errors)                    
    plt.scatter(concen_individuals,populations_monomer_individuals,c='b',label='Monomer Individual Fit',marker='X') 
    plt.scatter(concen_individuals,populations_open_individuals,c='g',label='Open Individual Fit',marker='X')
    plt.scatter(concen_individuals,populations_closed_individuals,c='r',label='Closed Individual Fit',marker='X')   
    a=plt.errorbar(concen_individuals,populations_monomer_individuals,yerr=populations_monomer_errors,linestyle='None',ecolor='b')  
    b=plt.errorbar(concen_individuals,populations_open_individuals,yerr=populations_open_errors,linestyle='None',ecolor='g')
    c=plt.errorbar(concen_individuals,populations_closed_individuals,yerr=populations_closed_errors,linestyle='None',ecolor='r')
    a[-1][0].set_linestyle('--')
    b[-1][0].set_linestyle('--')
    c[-1][0].set_linestyle('--')    
    plt.title(name)                 
    plt.legend()
    plt.xlabel('Concentrations(nM)')
    plt.ylabel('Fractional Populations')    
    plt.ylim((-0.1,1.1))
    plt.show()      
\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

the only way I could get this to work is....bad.

Yes. This is what Pandas was made for, and should replace basically everything that you've done in your current program (plotting aside; that part is vaguely OK).

The only big challenge is that your input file format is truly cursed. It has jagged rows, +/- separators, and what look to be dataset titles interspersed with real data.

The following approach can be used to normalize the data:

import pandas as pd

MAX_VARS = 20
MW = 42_000


def load(filename: str = 'scaled_uncertanty_fits.txt') -> pd.DataFrame:
    df = pd.read_csv(
        filename,
        sep=',|±',
        skiprows=1,  # skip the original headers - they aren't wide enough
        names=[
            'Sample', 'RedChi2', 'DoF', *range(3*MAX_VARS),
        ]
    )

    # Forward-fill the dataset name (e.g. WT_2017)
    is_dataset = df.iloc[:, 1].isna()
    df.insert(loc=0, column='dataset', value=df.loc[is_dataset, 'Sample'])
    df['dataset'] = df['dataset'].ffill()
    return df[~is_dataset]


def normalize_vars(df: pd.DataFrame) -> pd.DataFrame:
    """Normalize variable-solution-uncertainty triples"""
    var_offset = 4
    var_cols = df.iloc[:, var_offset:]
    meta_names = pd.Index(name='varmeta', data=['Variable', 'Solution', 'Uncertainty'])
    rectangular = pd.DataFrame(
        index=df.index,
        columns=pd.MultiIndex.from_product((
            meta_names,
            pd.RangeIndex(name='varno', start=0, stop=MAX_VARS),
        ))
    )

    n_vars = var_cols.notna().sum(axis=1)//3
    for row_vars, group in var_cols.groupby(n_vars):
        source = group.iloc[:, :row_vars]
        source.columns = pd.MultiIndex.from_product(
            (('Variable',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

        source = group.iloc[:, row_vars: row_vars*2]
        source.columns = pd.MultiIndex.from_product(
            (('Solution',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

        source = group.iloc[:, row_vars*2: row_vars*3]
        source.columns = pd.MultiIndex.from_product(
            (('Uncertainty',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

    long = rectangular.stack(level='varno')
    normalized = pd.merge(
        left=df[['dataset', 'Sample', 'RedChi2', 'DoF']], right=long[meta_names],
        left_index=True, right_on=long.index.get_level_values(0),
    ).drop('key_0', axis=1).set_index(long.index)

    return normalized.astype({
        'Solution': float, 'Uncertainty': float,
    })


def main() -> None:
    df = load()
    df = normalize_vars(df)
    # ...


if __name__ == '__main__':
    main()

sample output

From here, everything is "easy". For instance: want to convert concentrations, only for scaling_factor variables, only for the WT_2017 dataset and sample Open-Closed?

converted = df.loc[
    df['Variable'].str.startswith('scaling_factor')
    & (df['dataset'] == 'WT_2017')
    & (df['Sample'] == 'Open-Closed'),
    ['Solution', 'Uncertainty'],
] / MW * 1e9
            Solution   Uncertainty
   varno                          
22 1      220.922794  1.177406e-07
25 1      173.364558  4.268723e-08
28 1        0.000000  0.000000e+00

Here is an example demonstrating some of the logic that you wrote for concentrations and errors, with Pandas:

import numpy as np
import pandas as pd

MAX_VARS = 20
MW = 42_000


def load(filename: str = 'scaled_uncertanty_fits.txt') -> pd.DataFrame:
    df = pd.read_csv(
        filename,
        sep=',|±',
        skiprows=1,  # skip the original headers - they aren't wide enough
        names=[
            'Sample', 'RedChi2', 'DoF', *range(3*MAX_VARS),
        ]
    )
    df.index.name = 'csv_index'

    # Forward-fill the dataset name (e.g. WT_2017)
    is_dataset = df.iloc[:, 1].isna()
    df.insert(loc=0, column='dataset', value=df.loc[is_dataset, 'Sample'])
    df['dataset'].ffill(inplace=True)
    return df[~is_dataset]


def normalize_vars(df: pd.DataFrame) -> pd.DataFrame:
    """Normalize variable-solution-uncertainty triples"""
    var_offset = 4
    var_cols = df.iloc[:, var_offset:]
    meta_names = pd.Index(name='varmeta', data=['Variable', 'Solution', 'Uncertainty'])
    rectangular = pd.DataFrame(
        index=df.index,
        columns=pd.MultiIndex.from_product((
            meta_names,
            pd.RangeIndex(name='varno', start=0, stop=MAX_VARS),
        ))
    )

    n_vars = var_cols.notna().sum(axis=1)//3
    for row_vars, group in var_cols.groupby(n_vars):
        source = group.iloc[:, :row_vars]
        source.columns = pd.MultiIndex.from_product(
            (('Variable',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

        source = group.iloc[:, row_vars: row_vars*2]
        source.columns = pd.MultiIndex.from_product(
            (('Solution',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

        source = group.iloc[:, row_vars*2: row_vars*3]
        source.columns = pd.MultiIndex.from_product(
            (('Uncertainty',), range(row_vars)),
            names=('varmeta', 'varno'),
        )
        rectangular.loc[group.index, source.columns] = source

    long = rectangular.stack(level='varno')
    normalized = (
        pd.merge(left=df[['dataset', 'Sample']], right=long[meta_names], on='csv_index')
        .set_index(['dataset', 'Sample', 'Variable'], append=True)
        .astype({'Solution': float, 'Uncertainty': float})
        .unstack('Variable')
    )

    return normalized


def extract_factors(df: pd.DataFrame):
    names = df.columns[df.columns.get_loc('Solution')].droplevel(0)
    values = (
        names.get_level_values('Variable')
        .to_series(name='factor', index=names)
        .str.replace('_', '.')
        .str.extract(r'(\d+\.\d+)$', expand=False)
        .dropna()
        .astype(float)
    )
    return values


def main() -> None:
    df = load()
    df = normalize_vars(df)

    # For all datasets and Sample ~ Open-Closed*
    open_closed = df[df.index.get_level_values('Sample').str.contains('Open-Closed')]

    # io is converted concentrations from the number embedded in the scaling_factornnn names
    factors = extract_factors(df)
    io = conc = factors * 1e9/MW

    k = open_closed.loc[:, ('Solution', 'k')]
    k_error = open_closed.loc[:, ('Uncertainty', 'k')]

    fo = k/(k + 1)
    fc = 1/(k + 1)
    fm = 0

    h = 1e-8
    kh = k + h
    dk_fo = kh/(kh + 1)
    dk_fc = 1/(kh + 1)
    dk_fm = 0

    open_errors = k_error**2 * dk_fo**2
    closed_errors = k_error**2 * dk_fc**2
    monomer_errors = k_error**2 * dk_fm**2


if __name__ == '__main__':
    main()
\$\endgroup\$
1
  • \$\begingroup\$ Thank you for the feedback! I apologize for the late response! \$\endgroup\$
    – samman
    Sep 3, 2023 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.