AdvancedPhotonSource / cohere

Other
13 stars 7 forks source link

Initialization scope in Rec and CoupledRec #33

Open jacione opened 4 hours ago

jacione commented 4 hours ago

The CoupledRec class has a lot of attributes that are not defined by __init__(). While Python is technically ok with that, I've noticed that it can make it difficult to keep track of things while debugging.

I was planning on moving what I could into the constructor, but then it occurred to me that the Rec class has the same issue. I'm happy to take a look at both if you want.

bfrosik commented 3 hours ago

The Rec class constructor takes in params argument that is a dictionary with all the parameters defined by configuration. The constructor sets mandatory missing parameters to defaults and saves the updated dictionary to self.params. The Rec code uses then self.params dictionary to access the parameters. The parameters would not change. The CoupledRec class follows the model but I see some attributes created, I suppose needed during computing and most likely modified during processing.