diff --git a/__pycache__/viper.cpython-38.pyc b/__pycache__/viper.cpython-38.pyc index 1c25b45..8147de0 100644 Binary files a/__pycache__/viper.cpython-38.pyc and b/__pycache__/viper.cpython-38.pyc differ diff --git a/__pycache__/yiwinframe.cpython-38.pyc b/__pycache__/yiwinframe.cpython-38.pyc index dce2de7..231960e 100644 Binary files a/__pycache__/yiwinframe.cpython-38.pyc and b/__pycache__/yiwinframe.cpython-38.pyc differ diff --git a/data/output/A05D.csv b/data/output/A05D.csv index a30ef85..f7417c1 100644 --- a/data/output/A05D.csv +++ b/data/output/A05D.csv @@ -18,12 +18,4 @@ A05D;361.239;363.37;365.499;367.629;369.757;371.886;374.014;376.141;378.268;380. 2011-01-28 00:00:32;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 2011-01-28 00:01:04;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 2011-01-28 00:04:05;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:04:17;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:00:32;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:01:14;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:04:15;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:04:28;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:00:32;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:01:04;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 -2011-01-28 00:04:05;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 2011-01-28 00:04:17;0.8305056633026656;0.8325321223666662;0.8477343375953059;0.8601924590104929;0.8530328354333705;0.8378920897036354;0.8278074911784873;0.8281535772736721;0.8417669229372159;0.8473064396407075;0.8451939009990256;0.8410243863409358;0.8479581706965038;0.8676094047653992;0.8806548654683316;0.8875074181220398;0.8755968269842033;0.8777756237790573;0.8748735428020378;0.8676597912829026;0.8704645496346483;0.8727319781313622;0.8649909567571952;0.8721575362183431;0.886225999256613;0.9099807102527446;0.9088359728118274;0.8916444191236714;0.8681689931461386;0.8425965254793315;0.8346772021921453;0.8585663394574234;0.8862767799770718;0.8932636649579137;0.9016317118599789;0.9027624687336095;0.9206516865749377;0.9327846116837807;0.9602005701082441;0.9749891716558136;0.9822944403965026;0.9980056154719704;0.9971909884161739;0.9953411369380588;0.980520016102744;0.963201502501569;0.9451480182379225;0.922528030922861;0.8934585007801298;0.8735535833075148;0.8568626944267983;0.846250552191586;0.8461889028458536;0.8409568386226679;0.8328901277495963;0.8483302297194842;0.8456103705892927;0.8914627131614281;0.8849406412861658;0.8925392667763073;0.8682470089065448;0.8921760017495045;0.858390169114441;0.8810786335268779;0.8647374668201232;0.85690573098644;0.8405116083956596;0.8617405341002237;0.8449614552030993;0.8315423161484212;0.8288571519252356;0.8391334842228164;0.8259496474372849;0.8471735149886767;0.8669084157988203;0.8636174656790235;0.8621669493064881;0.8672941380017757;0.8717982089000185;0.8741990630034071;0.8807292197068987;0.879892511276376;0.897020726571207;0.8726308550865656;0.878554371723866;0.875596437065776;0.8734230914842722;0.859859624976091;0.8561093411090327;0.8479426564886996;0.8451858934662784;0.8380022320259202;0.8271645355713448;0.8294739360598545;0.828021188697714;0.8143999709099917;0.8196652203175339;0.8161645324006923;0.8267073210046172;0.8307557596462992;0.8360231304121594;0.8354486131287958;0.834551856913814;0.8451021977332801;0.8526591779318539;0.8581371739734327;0.8579392174274951;0.8705774573361329;0.864887645088894;0.8760630862896586;0.8715859290156174;0.8694462134308505;0.8491883740797094;0.8477291317378446;0.8520118593582244;0.8382094189056998;0.8434800583068083;0.8342736274210578;0.8443139134138795;0.8391470329473713;0.8040621199041593;0.8026041595590329;0.8036283456825588;0.8131726969574389;0.794921410649323;0.7743657931703682;0.7777447552614511;0.7966044992420602;0.7744360262982289;0.7678296693929938;0.7545534490887005;0.7811929239565515;0.793525285169995;0.7886861168733466;0.7870419062303593;0.7887618277147204;0.7964518241361067;0.83321518746133;0.816002956206773;0.8186066971506032;0.8143945713688479;0.8290437211608577;0.8360384903681481;0.8432741387654823;0.8530485889104499;0.8385138438976305;0.8501032066931371;0.8486977553063845;0.9263518656726755;0.8951313435071966;0.8797814969438251;0.8769019958942749;0.9329430134806274;0.9240753624656644;0.8860313572020637;0.9104167759321247;0.9236090419674579;0.9039283935350704;0.858165736452889;0.8265244773128144;0.9091412984432874;0.8431365236315567;0.8448562434611381;0.9290461664919509;0.8911707503961119;0.865979555097736;0.8959972168515246;0.9552104309849322;0.9481920484111184;0.9263735367210038;0.8707014812076432;1.0786663244566084;0.9369920092400867;0.7793586775626422;1.0350866890705963 \ No newline at end of file diff --git a/myViper.py b/myViper.py new file mode 100644 index 0000000..f859a70 --- /dev/null +++ b/myViper.py @@ -0,0 +1,389 @@ + +from dataclasses import dataclass +from pathlib import Path +from typing import List, Any, Callable +from pubsub import pub +import numpy as np +from enum import Enum +import struct +import math +import time + +from myconfig import TOKEN, DATA_DIR, FILE_MARK, OUTPUT_DIR, CAL_DIR +from myconfig import PURE_WATER_FNAME, SAVE_EXT_NAME +from myexception import MyException +from mypath import MyDir + +class WorkMode(Enum): + FILEMODE=1 + DEVICEMODE=2 + +class AlgorithMode(Enum): + A720=1 + PureWater=2 + +class PureWaterData: + wavelength=[360.0, 365.0, 370.0, 375.0, 380.0, 385.0, 390.0, 395.0, 400.0, 405.0, 410.0, 415.0, 420.0, 425.0, 430.0, 435.0, 440.0, 445.0, 450.0, 455.0, 460.0, 465.0, 470.0, 475.0, 480.0, 485.0, 490.0, 495.0, 500.0, 505.0, 510.0, 515.0, 520.0, 525.0, 530.0, 535.0, 540.0, 545.0, 550.0, 555.0, 560.0, 565.0, 570.0, 575.0, 580.0, 585.0, 590.0, 595.0, 600.0, 605.0, 610.0, 615.0, 620.0, 625.0, 630.0, 635.0, 640.0, 645.0, 650.0, 655.0, 660.0, 665.0, 670.0, 675.0, 680.0, 685.0, 690.0, 695.0, 700.0, 705.0, 710.0, 715.0, 720.0, 725.0] + coeff=[0.0158, 0.0149, 0.0142, 0.0133, 0.0125, 0.0119, 0.0114, 0.0108, 0.0104, 0.0101, 0.0098, 0.0096, 0.00924, 0.00928, 0.00925, 0.0094, 0.01025, 0.01121, 0.01272, 0.01292, 0.01299, 0.01311, 0.0135, 0.0142, 0.0154, 0.0161, 0.0174, 0.0196, 0.0226, 0.0277, 0.0345, 0.0416, 0.0428, 0.0435, 0.0451, 0.0469, 0.049, 0.0526, 0.058, 0.061, 0.0632, 0.0655, 0.0708, 0.0784, 0.0908, 0.1111, 0.1362, 0.1682, 0.2234, 0.2587, 0.2653, 0.2687, 0.2764, 0.2842, 0.2924, 0.302, 0.3116, 0.3257, 0.3407, 0.3717, 0.4107, 0.4296, 0.4396, 0.4486, 0.4656, 0.4866, 0.5166, 0.5595, 0.6245, 0.7045, 0.8275, 1.0075, 1.2315, 1.4894] + +@dataclass +class SerialPort : + port: str = None + baudrate: int = None + bytesize: int = None + parity: str =None + stopbit: int =None + + def __post_init__(self): + pass + + def set_serial_port_(self, sp:dict): + self.port = sp['port'] + self.baudrate = sp['baudrate'] + self.bytesize = sp['bytesize'] + self.parity = sp['parity'] + self.stopbit = sp['stopbit'] + pass + + +@dataclass +class Registers : + slaveaddress: int + functioncode: int + DataBeginAddress: int + SNAddress: int + SNLen: int + WLBeginAddress: int + count: int + wavelengthBuf: bytes + intensityBuf: bytes + + def __post_init__(self): + pass + + def set_register(self, rg:dict): + self.DataBeginAddress = rg['DataBeginAddress'] + self.SNAddress = rg['SNAddress'] + self.SNLen = rg['SNLen'] + self.WLBeginAddress = rg['WLBeginAddress'] + self.count = rg['count'] + self.functioncode = rg['functioncode'] + self.slaveaddress = rg['slaveaddress'] + + pass + +@dataclass +class LogSetting : + LogInterval: int =None + RefreshInterval: int =None + def set_log_setting(self, dct:dict): + self.LogInterval = dct['LogInterval'] + self.RefreshInterval = dct['RefreshInterval'] + + +@dataclass +class PlotSetting : + LineBegin: int =None + LineInterval: int =None + def set_plot_setting(self, dct:dict): + self.LineBegin = dct['LineBegin'] + self.LineInterval = dct['LineInterval'] + +@dataclass +class Retrieve : + beginWL: int =None + endWL: int=None + interval: int=None + def set_retrieve(self, dct:dict): + self.beginWL = dct['beginWL'] + self.endWL = dct['endWL'] + self.interval = dct['interval'] + +@dataclass +class Algorithm : + A720: int =None + PureWater: int =None + def set_algorithm(self, dct:dict): + self.A720 = dct['A720'] + self.PureWater = dct['PureWater'] + +@dataclass +class ConfigViper : + SN: str = None + lightPath: float = None + mode:WorkMode = None + filePath: Path = None + rawWavelength: list = None + rawIntensity: list = None + Wavelength: list = None + Intensity: list = None + # raw_wavelength_np = np.array([]) + purewaterWavelength: list = None + purewaterAttenuation: list = None + purewaterAttAfterInterp: np.ndarray = None + outputWavelength: list = None + beginSite:int =None + endsite:int = None + measureTime:str =None + retrieve: Retrieve = None + algorithm: Algorithm = None + serailPort: SerialPort = None + register: Registers = None + logSetting: LogSetting = None + plotSetting: PlotSetting = None + absorptionCoef:list =None + + def __post_init__(self): + self.retrieve = Retrieve() + self.algorithm = Algorithm() + pass + + +class MyViper(object): + def __init__(self, sn: str = None): + self.viper = ConfigViper(SN=sn) + self.cfg= None + self.file_lst =[] + self.mydir = MyDir() + pass + + def set_SN(self, sn :str): + self.viper.SN = sn + self.__prepare_for_save() + + def set_mode(self, mode:WorkMode=WorkMode.FILEMODE): + self.viper.mode = mode + if self.viper.mode == WorkMode.FILEMODE: + pass + if self.viper.mode == WorkMode.DEVICEMODE: + self.viper.serailPort =SerialPort() + self.viper.serailPort.set_serial_port_( self.cfg['comsetting']) + self.viper.register =Registers() + self.viper.register.set_register( self.cfg['register']) + pass + + def set_cfg_viper(self, cfg: dict): + ''' cfg 从config.yaml 读出来的数据 ''' + self.cfg = cfg + if self.viper.SN != cfg['device']['UISN']: + raise Exception(f" 波长 不匹配") + self.viper.lightPath= cfg['device']['UIPath'] + self.viper.algorithm.set_algorithm( cfg['algorithm'] ) + self.viper.retrieve.set_retrieve(cfg['retrieve'] ) + self.viper.logSetting =LogSetting() + self.viper.logSetting.set_log_setting(cfg['logsetting'] ) + self.viper.plotSetting =PlotSetting() + self.viper.plotSetting.set_plot_setting(cfg['plotsetting'] ) + # if self.viper.mode == WorkMode.FILEMODE: + # pass + # if self.viper.mode == WorkMode.DEVICEMODE: + # self.viper.serailPort =SerialPort() + # self.viper.serailPort.set_serial_port_( cfg['comsetting']) + # self.viper.register =Registers() + # self.viper.register.set_register( cfg['register']) + # pass + pass + + def set_retrieve(self, rtv:dict ): + self.viper.retrieve.set_retrieve(rtv ) + pass + + def set_raw_wavelength(self, raw_wavelength ): + if self.viper.retrieve is None: + return + self.viper.rawWavelength = [float(i) for i in raw_wavelength] + self.get_begin_end() + + pass + + def set_raw_intensity(self, sn, time_str, intensity): + if self.viper.retrieve is None: + return + if sn != self.viper.SN : + raise MyException(f" 数据的波长 [{sn}] 与系统波长 [{self.viper.SN}] 不匹配 ") + + # 取有效波长范围数据 ,因为浊度校正须在720nm左右,去掉720以后波长 + intensity = intensity[self.viper.beginSite:self.viper.endsite] + + # 赋值,并转为浮点 + self.viper.rawIntensity = [float(i) for i in intensity ] + + # 浊度校正 + data = self.correction_turbidity( np.array(self.viper.rawIntensity) ) + + + # 计算 吸收系数 + data = data * (1000 * math.log(10,math.e) / self.viper.lightPath ) + + + # 对纯水系数系数进行校正 + data = self.correction_pure_water( data ) + + data = data.tolist() + self.viper.measureTime = time_str + self.viper.absorptionCoef = data + + # 分发数据 + self.distribute_data(self.viper.measureTime,self.viper.absorptionCoef) + + pass + + def set_pure_water(self,wavelength, atten): + self.viper.purewaterWavelength = [float(i) for i in wavelength] + self.viper.purewaterAttenuation = [float(i) for i in atten] + print(f"== {self.viper.purewaterWavelength}") + print(f"== {self.viper.purewaterAttenuation}") + if self.viper.rawWavelength is None: + raise MyException(f" 没有波长数据。") + self.interpo_pure_water() + self.__prepare_for_save() + + def interpo_pure_water(self): + self.viper.purewaterAttAfterInterp = np.interp( + np.array(self.viper.outputWavelength), + np.array(self.viper.purewaterWavelength), + np.array(self.viper.purewaterAttenuation)) + pass + + def get_begin_end(self,) -> list: + # 读取配置文件 + for i in range(len(self.viper.rawWavelength)): + # print(f"i {i} {self.viper.rawWavelength[i]}") + if self.viper.rawWavelength[i] < self.viper.retrieve.beginWL \ + and self.viper.rawWavelength[i+1] > self.viper.retrieve.beginWL: + self.viper.beginSite = i+1 + pass + if self.viper.rawWavelength[i] < self.viper.retrieve.endWL \ + and self.viper.rawWavelength[i+1] > self.viper.retrieve.endWL: + self.viper.endsite = i+2 + break + self.get_output_wavelength() + msg = "起始波长 : " + \ + str(self.viper.outputWavelength[0]) + \ + " , 结束波长 : " + str(self.viper.outputWavelength[-1]) + self.__set_msg("notice", msg) + pub.sendMessage(self.msg) + + def get_output_wavelength(self,): + self.viper.outputWavelength = self.viper.rawWavelength[self.viper.beginSite:self.viper.endsite] + pass + pass + + # def deal_sn_time_data(self, sn, time_str, data): + # if sn!= self.viper.SN: + # raise Exception(f" wrong SN file") + + # # 浊度校正 + # data = self.correction_turbidity( np.array(data) ) + + # # 取有效波长范围数据 + # data = data[self.viper.beginSite:self.viper.endsite] + + # # 计算 吸收系数 + # data = data * (1000 * math.log(10,math.e) / self.viper.lightPath ) + + # # 对纯水系数系数进行校正 + # data = self.correction_pure_water( data ) + + # data = data.tolist() + # self.viper.measureTime = time_str + # self.viper.absorptionCoef = data + + # self.__set_msg( "data", {"time":time_str, "data":data } ) + # pub.sendMessage("update", msg=self.msg) + + # # 保存数据 ??? + # self.mydir.setContent(self.viper.absorptionCoef,TOKEN,self.viper.measureTime) + # self.mydir.writeContent() + + def distribute_data(self, time_str, data, mode =0): + self.__set_msg( "data", {"time":time_str, "data":data } ) + pub.sendMessage("update", msg=self.msg) + + # 保存数据 ??? + self.mydir.setContent(self.viper.absorptionCoef,TOKEN,self.viper.measureTime) + self.mydir.writeContent() + if mode == 1: + print(f" \ + wavelenght : {self.viper.outputWavelength[0]} \ + coef : {self.viper.absorptionCoef[0]} \ + purewater : {self.viper.purewaterAttAfterInterp[0]} \ + rawInt : {self.viper.rawIntensity[self.viper.beginSite]} \ + ") + + def deal_measure_time_data(self, sn, res_time, res_data): + ''' + # res_time ['2011-01-28 00:00:32', '2011-01-28 00:01:04', '2011-01-28 00:04:05', '2011-01-28 00:04:17'] + # res_data [ [[,,,]], [[,,,]], [[,,,]], [[,,,]]] 取 res_data[0] + ''' + # log.info(f" -> time : {res_time}",__name__, "deal_one_measure_time_data") + # log.info(f" -> datalen : {len(res_data)} ",__name__, "deal_one_measure_time_data") + if sn != self.viper.SN: + raise MyException(f" wrong SN file {sn} !! [SN={self.viper.SN}]") + for i in range(len(res_time)): + self.set_raw_intensity( sn,res_time[i], res_data[i][0] ) + self.__set_msg( "notice", "文件处理完毕" ) + pub.sendMessage( "update", msg = self.msg ) + + def correction_turbidity(self, data:np.ndarray ): + '''浊度校正, 吸光度 + 0 : 默认11项平均 + 1 : 720 + 2 : 不浊度校正 + ''' + # log.debug( "correction_turbidity .....",__name__, 'correction_turbidity' ) + if self.viper.algorithm.A720 == 0: + count = data.shape[0] + tmp = 0.0 + for i in range(count-11,count,1): + tmp = tmp + data[i] + tmp = tmp/11 + # print(f"tmp ....{tmp}") + return data - tmp + pass + if self.viper.algorithm.A720 == 1: + count = data.shape[0] + tmp = data[count] - (self.viper.outputWavelength[count]-720) * (data[count] -data[count-1]) \ + / (self.viper.outputWavelength[count]-self.viper.outputWavelength[count-1]) + # print(f"tmp .... {tmp}") + return data-tmp + pass + if self.viper.algorithm.A720 == 2: + return data + return data + pass + + def correction_pure_water(self, data:np.ndarray ): + '''纯水校正 + 0 : 不变 + 1 : 加纯水衰减系数 + ''' + # log.info(f"... {self.cfg['algorithm']['PureWater']}",__name__,'correction_pure_water') + # print( self.purewater_after_interp ) + if self.viper.algorithm.PureWater == 0: + return data + pass + if self.viper.algorithm.PureWater == 1: + return data + self.viper.purewaterAttAfterInterp + pass + return data + pass + + def __prepare_for_save(self,) -> bool: + dir = Path().joinpath(DATA_DIR, OUTPUT_DIR) + self.mydir.setBaseDir(dir) + self.mydir.newDirIfNot() + self.mydir.newFileIfNot(self.viper.SN+SAVE_EXT_NAME) + + self.mydir.setHeader(self.viper.outputWavelength, TOKEN, self.viper.SN) + if self.mydir.checkHeader() == 0: + self.mydir.writeHeader() + if self.mydir.checkHeader() == -1: + # self.popDialog(" 文件头不一致, 请备份到其他目录,并在该目录下删除") + raise MyException(" 文件头不一致, 请备份到其他目录,并在该目录下删除") + + def __set_msg(self, typ, d): + self.msg = {} + self.msg.update( {"type":typ} ) + self.msg.update( {"data":d} ) + pass \ No newline at end of file diff --git a/viper.py b/viper.py index 3aa9f37..7fb0841 100644 --- a/viper.py +++ b/viper.py @@ -149,13 +149,17 @@ class Viper(object): for i in range(len(res_time)): data = self.convert_str_2_float_list( res_data[i][0][self.begin:self.end] ) + print(f" before {data}") # 浊度校正 data = self.correction_turbidity( np.array(data) ) + print(f" after {data}") + # 取对数,光程归一 ?? 纯水校正,是吸光度校正还是系数校正 # data = ( data * (1000 * math.log(10,math.e)))/self.cfg['device']['UIPath'] data = data * (1000 * math.log(10,math.e) / self.cfg['device']['UIPath']) # data = data.tolist() + print(f" coef {data}") # 纯水系数校正 data = self.correction_pure_water( data ) @@ -216,7 +220,7 @@ class Viper(object): for i in range(count-11,count,1): tmp = tmp + data[i] tmp = tmp/11 - # print(f"tmp ....{tmp}") + print(f"a720=0 tmp ....{tmp}") return data - tmp pass if self.cfg['algorithm']['A720'] == 1: diff --git a/yiwinframe.py b/yiwinframe.py index c8088f5..329f6ae 100644 --- a/yiwinframe.py +++ b/yiwinframe.py @@ -4,7 +4,7 @@ import time import threading import numpy as np from pathlib import Path,PurePath -from wx.lib.pubsub import pub +from pubsub import pub # from configobj import ConfigObj from listctrl import Listctrl @@ -21,7 +21,7 @@ from uiconfig.uiabout import About from uiconfig.uihelp import Help from myconfig import DeviceType,YAML_FILE_NAME,RETRIEVE_CFG_FILE -from myconfig import TOKEN,DATA_DIR,FILE_MARK,OUTPUT_DIR,SAVE_EXT_NAME +from myconfig import TOKEN,DATA_DIR,FILE_MARK,OUTPUT_DIR,SAVE_EXT_NAME,CAL_DIR,PURE_WATER_FNAME from myconfig import MyConfig from configuration import Configuration # from awrams import AWRAMS,HandHeldBuf @@ -32,8 +32,9 @@ from mypath import MyDir from mythread import Mythead from readcal import ReadCal from uart import Uart -from viper import Viper +# from viper import Viper from dataplot import DataPlot +from myViper import MyViper,WorkMode,PureWaterData # -定义菜单ID,关联Event------------------------- """ @@ -64,6 +65,7 @@ ID_PLOT_RULE = 17 ID_HELP = 21 ID_ABOUT = 22 ID_ALGORITHM = 30 + class YiwinFrame( wx.Frame ): '''将buf类传进来''' def __init__(self, title, parent, size=(900, 750)): @@ -118,19 +120,28 @@ class YiwinFrame( wx.Frame ): self.__set_properties() # self.__read_config() self.__setTimer() + log.info(f"system init....",__name__, "__init__") + self.mycfg = MyConfig() - self.mydir = MyDir() - self.mycfg.set_retrieve() self.__read_config() self.ui_sn = self.syscfg['device']['UISN'] self.device_sn = '' self.file_sn = '' - self.interval = self.syscfg['logsetting']['LogInterval'] - self.port = self.syscfg['comsetting']['port'] + # self.interval = self.syscfg['logsetting']['LogInterval'] + # self.port = self.syscfg['comsetting']['port'] + + + self.myviper = MyViper( sn=self.syscfg['device']['UISN'] ) + self.myviper.set_cfg_viper(self.syscfg) + + self.mydir = MyDir() + self.mycfg.set_retrieve() + + self.uart = Uart() - self.viper = Viper() + # self.viper = Viper() self.dataplot = DataPlot() self.plot_pure_water() @@ -274,7 +285,7 @@ class YiwinFrame( wx.Frame ): self.plotpanel.clear_past() self.plotpanel.plot_one( d['time'] - ,np.array(self.viper.output_wavelength) + ,np.array(self.myviper.viper.outputWavelength) ,np.array(d['data']) ) pass @@ -299,16 +310,57 @@ class YiwinFrame( wx.Frame ): self.syscfg = self.mycfg.read_yaml() retrieve = self.mycfg.read_rtv_yaml() self.syscfg.update( { "retrieve" : retrieve } ) + + def __read_cal_file(self,): + ''' 读取 纯水文件 传参myviper ''' + fpath = Path().joinpath(CAL_DIR, PURE_WATER_FNAME) + if not fpath.exists(): + self.myviper.set_pure_water(PureWaterData.wavelength,PureWaterData.coeff) + else: + _,tmp_purewater_wavelength = ReadCal.read_columns_set_by_mark( + fpath, FILE_MARK, 0) + _,tmp_purewater_attenuation = ReadCal.read_columns_set_by_mark( + fpath, FILE_MARK, 1) + self.myviper.set_pure_water(tmp_purewater_wavelength[0],tmp_purewater_attenuation[0]) + + + def __get_raw_wavelenght_from_onefile(self,fpath, sn): + ''' 读取 纯水文件 传参myviper ''' + sn = ReadCal.readFileSNbyIDDevice(fpath) + if sn[-4:] != self.ui_sn: + raise MyException(" 标定文件SN 与系统不一致") + _,tmp_wavelength = ReadCal.read_columns_set_by_mark( + fpath, FILE_MARK, 0) + self.raw_wavelength= tmp_wavelength[0] + self.myviper.set_raw_wavelength( self.raw_wavelength ) + def OnDealFile(self, e)-> None: + self.myviper.set_mode(mode=WorkMode.FILEMODE) self.__OnDeviceStop() log.info( f"OnDealFile: 处理测量文件", __name__, "", "" ) + + ## 获取待处理文件self.file_lst + fdir:Path = Path().joinpath(DATA_DIR) + self.get_data_files(fdir) + + ## 获取波长并传参 + if self.file_lst[0] is None: + raise MyException(f"没有可以处理的文件!") + try: + self.__get_raw_wavelenght_from_onefile(self.file_lst[0],self.ui_sn) + except: + raise MyException(f"无法获取文件的波长信息!") + + ## 获取纯水标定文件 + self.__read_cal_file() + self.alterStatus_0("成功获取波长和标定文件。") + # 线程守护 self.mt = Mythead() - self.viper.set_cfg(self.syscfg) + # self.viper.set_cfg(self.syscfg) try: - self.viper.get_data_files() - self.mt.set_task( self.viper.deal_file_lst ) + self.mt.set_task( self.deal_file_lst ) self.mt.start() self.alterStatus_0(" 处理完所有文件" ) except Exception as e: @@ -316,6 +368,23 @@ class YiwinFrame( wx.Frame ): self.popDialog( e ) pass + + def get_data_files(self,fdir:Path) -> list: + fmt="*/*.DAT" + ret = [] + tmp_files = fdir.glob(fmt) + for tfs in tmp_files: + if tfs.is_file(): + ret.append(tfs) + self.file_lst = ret + + + def deal_file_lst(self, ): + for fl in self.file_lst: + ReadCal.read_columns_sets_by_mark_callback( + fl, FILE_MARK, self.myviper.deal_measure_time_data, 1) + + def OnDeviceSN(self, e)-> None: self.__OnDeviceStop() log.info(f"OnDeviceSN: 获取device sn ", __name__, "", "") @@ -420,9 +489,11 @@ class YiwinFrame( wx.Frame ): self.__OnDeviceStop() self.plotpanel.set_title_x_y( *self.plotpanel.purewater_legend ) time_ = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()) - - wl = np.array(self.viper.purewater_wavelength) - att = np.array(self.viper.purewater_attenuation) + + # wl = np.array(self.myviper.viper.purewaterWavelength) + # att = np.array(self.myviper.viper.purewaterAttenuation) + wl = np.array( PureWaterData.wavelength ) + att = np.array( PureWaterData.coeff ) self.plotpanel.plot_one(time_, wl, att) pass @@ -610,6 +681,8 @@ class YiwinFrame( wx.Frame ): dlg.ShowModal() + + # class SerialThread(threading.Thread): # """进度条类 """ # def __init__(self, parent):