tomas3svoboda / ChroMo

Chromatography model determination
2 stars 0 forks source link

Function Ret_Time_Cor.py #5

Closed meloun67 closed 9 months ago

meloun67 commented 2 years ago

Uses ExperimentClusterCompCond and for each group (time series of same compounds and conditions) shiftes datapoints in time so the peaks of all timeseries precisely matches (in an average of each peak's maxima). Saves the resulting dorrected timeseries into ExperimentSetCor1

in: ExperimentSet ExperimentClusterCompCond out: ExperimentSetCor1

meloun67 commented 2 years ago

@svoboad3 could you please program loop which finds max concentration's time for each time series and calculates average value of these times for each cluster (CompCond)?

Then please program the loop which calculates difference between that average value and max concentration's time value for each timeseries and then add this difference to all the times in the timeserie. Store the result as a experimentSetCor1 and return this object.

Summary: find max for each timeserie > calculate average for each cluster > calculate difference for each timeserie in each cluster > change all the times in all the timeseries by adding calculated difference

svoboad3 commented 2 years ago

Done

Found one small problem. Creating a whole new ExperimentSet with experiments and components in the correct place I found to be pretty difficult, because we're making changes based on ExperimentClusters. My solution was to create a deep copy of the ExperimentSet before calling this function, and then make corrections inplace. The problem is, that the ExperimentClusters were referencing components in the original set, so by changing components in cluster, the changes are made in the original set, not the copy.

There is few ways to fix this:

  1. Create the copy before creating cluster, and use the copy to create cluster
  2. Set the copy as the original (They should be identical)
  3. Bite the bullet and try to create new ExperimentSet inside the function, which would be difficult and probably much slower

I would go with 1. or 2. They both are pretty easy and I don't see reason why they should pose a problem.

meloun67 commented 2 years ago

I agree. I think I will have similar problem with Gauss_fit.py

We need to discuss this on call. Check email I send invitation.

meloun67 commented 1 year ago

Please program new Ret_Time_Cor.py - current version behaves weirdly and it is anyway insufficient! Description of task in in this file: docu/Zadani Ret_Time_Cor algoritmu.docx