Closed atrettin closed 2 years ago
Also note that a lot of changes are just my editor removing trailing whitespace. When you hide whitespace in the diff view, it looks much less intimidating. :)
Hi, this look fine to me, but let's give a chance to the high stats folks to comment
Maybe I should add backwards compatibility to re-map fit_octants
to octants
and fit_ranges
to ranges
and issue a deprecation warning. That way, this PR should not introduce any changes to already existing analyses.
I think that would be nice to have, and then we should also be able to merge this right away without causing other issues downstream
Okay so now at least in theory this PR should not break anyone's configuration. It would be nice if @kayla-leonard and @ts4051 could confirm that their analysis still runs with these changes!
Since there are no further comments, I would say that this is fine and merge later today. The unit test does check that the backwards compatibility works. The Retro-Sample people seem to be using their own fork anyway (although I hope that this PR in particular can reduce the need for forking, because analysis-specific stages can be defined externally).
This PR greatly improves the support for externally defined custom PISA stages and custom fit methods.
Concerning fit methods, it turns out that I had designed the
BasicAnalysis
class in a dumb way, I could have done it far easier with thegetattr
method instead of writing my own dictionary. It is now possible to easily implement custom fit methods in a sub-class, all they have to do is to follow the_fit_{method}
naming scheme. This is also tested in a unit test.The only change for analyzers is that
fit_ranges
has been renamed toranges
andfit_octants
has been renamed tooctants
for consistency.For externally defined stages, PISA will now search for stage definitions in the
{stage_name}.{service_name}
module if it fails to find a stage inpisa.stages.{stage_name}.{service_name}
. This makes it possible to define custom stages for an analysis without changing PISA, as long as one adds the directory with the stage definitions to thePYTHONPATH
.