[SSO] Performances#265
Conversation
|
The speedup is great for SOCCA and I think it will shine most when we use sHG1G2 for cleaning data - which used to be one of the bottlenecks when dealing with ATLAS. Regarding cleaning data in the case of ZTF I think it does more harm than good. We have a relatively low number of points per lightcurve (100-300 vs the 1,000-3,000 of ATLAS) and in any of my analyses until this point I don't filter any outliers from ZTF (as is already done for all other models in the ssoft). On the 5 points per peak, it comes from VanderPlas 2018 but the choice here is the lower limit of a suggestion :
and:
hence the choice for SOCCA. Given that the samples per peak argument is directly proportional to the number of periodograms evaluatedI'm not surprised to see a significant speed up when it's =2 instead of =5 especially when computing the bootstrap score of the period estimate. I am unsure of how it will affect the quality of the period evaluations at scale, but I plan on taking a sub-sample of SOCCA solutions using ZTF data that are very near the low period limit of the period parameter space (~2 hours or so) and reavulating them with a different period parameter space (say 0.1 - 2 hours). This is will be detrimental in terms of the number of periodogram evaluations so the only way to remedy that will be by reducing the oversampling of the periodogram peaks. So that can serve as a benchmark for the quality of solutions when the peak sampling is lower. |
SHG1G2
Code in
profiling.py:Run with:
# main 0.56 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:175 - func_hg1g2 0.57 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:205 - func_shg1g2 0.63 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:1533 - build_eqs_for_spins 0.66 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:2332 - fit_spin 0.66 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:1757 - estimate_sso_paramsversus
# branch issue/264/perf 0.01 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:171 - func_hg1g2 0.02 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:198 - func_shg1g2 0.05 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:1549 - build_eqs_for_spins 0.08 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:2368 - fit_spin 0.08 seconds - /home/peloton/codes/fink-utils/fink_utils/sso/spins.py:1784 - estimate_sso_paramsTest suite has been improved to further validate code change.
SOCCA
I use the following script:
Run with:
and here are profiling results (I checked parameter values are the same):
Almost factor of 2 speed-up.
Cleaning procedure
The results above do not use the cleaning procedure from Odysseas. If I trigger it, I get the following results:
rmsf_obsPeriod_classget_fit_paramstimeValues are close, but
get_fit_paramsstruggles a lot to converge if I get supposedly cleaned values! Note that I am using ZTF only, so maybe the cleaning procedure decimates too much the lightcurve, hence the fits struggles (for2000 HR66used here, we have initially 21 measurements in g and 46 measurements in r). I tried onWallenquist(173 in g, 228 in r): the timings are the same with or without cleaning, but the rms is smaller with cleaning (ouf !):rmsf_obsPeriod_classget_fit_paramstimeSo we should keep an eye on undersampled lightcurves which might be artificially degraded by cleaning procedures (which are relative and not absolute).
Further speed-up
At this point, one of the limiting function was
model.autopowerwhich was called 50+ times. One of the parameter of that function issamples_per_peak (default is 5). If I modify this parameter, I get (results using2000 HR66and cleaning procedures):samples_per_peakrmsf_obsPeriod_classget_fit_paramstimeNote that the case for 5 and 2 samples per peak give the same period, but
Period_classis different (and there is a factor 2 in terms of performance!). Weird?Note that if I use no cleaning +
samples_per_peak = 2, I get the same result than with cleaning, which might indicates thatsamples_per_peak = 5is overkill. And indeed, using a more densely sampled lightcurve (Wallenquist, 173 in g, 228 in r):samples_per_peakrmsf_obsPeriod_classget_fit_paramstimeSame results, but 2x faster with 2 samples per peak.