tomas3svoboda / ChroMo

Chromatography model determination
2 stars 0 forks source link

Testing Framework #22

Open meloun67 opened 1 year ago

meloun67 commented 1 year ago

Define testing framework for functions evaluation.

svoboad3 commented 1 year ago

Created a function for comparison of 2 ExperimentSets to easily test Correction functions.

To use it, call Compare_ExperimentSets(experimentSet1, experimentSet2)

The function will then go experiment by experiment, component by component, comparing concentrationTime DataFrames. If it finds a mismatch, it will ask you if you want to print it. Input Y to print mismatching concentrationTimes as table and as graph, input N to skip printing or input E to exit function.

image

(in Pycharm, matplotlib shows graphs in separate popup window, which pauses the process. To continue, close graph windows)

meloun67 commented 1 year ago

Well done! Could you please check out why my function Fit_Gauss.py does not work? (I have just pushed newest version).

image

svoboad3 commented 1 year ago

When I tried to call Fit_Gauss function, I get an error with indexing dataframe: image

Fixed that by using iloc in GaussSum: image

But the GaussSum function seems to return all zeroes: image

Also I have been getting this warning from scipy, might be part of the problem: image

But at least the Compare_ExperimentSets function seems to be working Compare_ExperimentSets had some issues with names of columns and different lengths of comparing DataFrames, but they should be fixed in last commit.

meloun67 commented 1 year ago

Thanks a lot! I think there is problem with initial values... I will figure it out

meloun67 commented 1 year ago

I just wonder why I did not receive any error messages... 🧐

svoboad3 commented 1 year ago

Well if it works for you now I wouldn't worry about it 😄

meloun67 commented 1 year ago

Well if it works for you now I wouldn't worry about it 😄

Yep, I guess so. 😄 Do you have something to do next or everything is done from your side so far?

svoboad3 commented 1 year ago

Mass_Balance_Cor, but I need to a little help with that. See that issue #8

meloun67 commented 1 year ago

what does it mean please? image

svoboad3 commented 1 year ago

It means first components of first experiments in the two experimentSets are not different. You can input Y to print them out to see what's the difference.

svoboad3 commented 1 year ago

Because we started to develop the Start function in Operator, for testing I created new function Start_For_Testing, in which we can test functions separately from the structure of the Start function. Currently the main program runs the Start_For_Testing. If you'd like to run the Start function, in main.py file rewrite operator.Start_For_Testing() to operator.Start()

meloun67 commented 1 year ago

I've been testing the latest commit (front-end for testing) and I have some feedbacks:

1) where is this comming from? image

2) Nasel jsem v kodu FIt_Gauss.py tenhle chunk, nevis k cemu to je? image

3) Kdyz uz existuje slozka Gauss_graphs hodi to error, mohlo by se to zeptat neco jako: "The Gauss_graphs file already exists and is about to be rewriten. Do you want to proceed?"

4) pri vykresleni prvniho grafu Loss Function value se vykreslej vsechny Fit_Gauss grafy

5) po vykresleni grafu loss funkce by se to melo zeptat "Do you want to save this figure into the file?" A ulozit do slozky "Loss_Function_value" pod kodem _Kto_Dto_e.png

6) nejdriv jel vypuis po procentu a potom ne, zvlastni image image

7) ty time shifty nejak nesedej, musime to predelat... nejde posouvat kazdej pik zvlast, jedine celej experiment - nadefinuju to do prislusnzho issue a prosim udelej to jakmile budes mit cas mezi zkouskama - diky image

meloun67 commented 1 year ago
meloun67 commented 1 year ago

kdyz chci vygenerovat vic ney jeden chromatogram, hodi to error - ze slozka uy existuje image

svoboad3 commented 1 year ago

I've been testing the latest commit (front-end for testing) and I have some feedbacks:

  1. where is this comming from? image
  2. Nasel jsem v kodu FIt_Gauss.py tenhle chunk, nevis k cemu to je? image
  3. Kdyz uz existuje slozka Gauss_graphs hodi to error, mohlo by se to zeptat neco jako: "The Gauss_graphs file already exists and is about to be rewriten. Do you want to proceed?"
  4. pri vykresleni prvniho grafu Loss Function value se vykreslej vsechny Fit_Gauss grafy
  5. po vykresleni grafu loss funkce by se to melo zeptat "Do you want to save this figure into the file?" A ulozit do slozky "Loss_Function_value" pod kodem _Kto_Dto_e.png
  6. nejdriv jel vypuis po procentu a potom ne, zvlastni image image
  7. ty time shifty nejak nesedej, musime to predelat... nejde posouvat kazdej pik zvlast, jedine celej experiment - nadefinuju to do prislusnzho issue a prosim udelej to jakmile budes mit cas mezi zkouskama - diky image
  1. It's from Fit_Gauss function, should I remove it? image
  2. It seems that it drops all the rows where time is negative for ManOH component. Don't remember when or why it was added.
  3. I known about this but wasn't sure if it was a problem or not, you can just delete/move them and run it again. In "production" you probably wouldn't have these folders and files already existing and you wouldn't run it multiple times, but for testing purposes it sure is annoying, so I'll try to fix these "file/folder already exists" issues.
  4. Yea stupid mistake, should be fixed in last commit.
  5. Will do.
  6. Thats fine, it calculates percentages based on interval and step you choose after each cycle.
  7. It shifts all the peaks in the same cluster to match the time. Clustering is done based on components and conditions. You can see TestExperiment 3 and 4 are in the same cluster, so the peaks shift to average time of all of them (because its 2 peaks, one peak is shifted for X value and the second for -X). TestExperiment7 is alone, so it doesn't shift at all. If that is not correct, we have to redefine the Ret_Time_Cor function.

Rounding is also a easy fix, should be done in latest commit. Chromatogram is the same issue as 3.