InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
254 stars 223 forks source link

bug within the analysis.py (not able to pass **kwargs) #375

Closed zsliu98 closed 2 years ago

zsliu98 commented 3 years ago

I encountered this bug when I tried to pass *kwargs to `Sim.compute_fit(self, args, **kwargs):` (so that I could compute MSE)

def compute_fit(self, *args, **kwargs):
    self.fit = cva.Fit(self, *args, **kwargs)
    return self.fit

Then I took a look at cva.Fit(self, *args, **kwargs):

class Fit(Analyzer):
    def __init__(self, sim, weights=None, keys=None, custom=None, compute=True, verbose=False, die=True, **kwargs):
        super().__init__(**kwargs) # Initialize the Analyzer object
        # something else here

However, the Analyzer.__init__() doesn't accept any **kwargs.

class Analyzer(sc.prettyobj):
    def __init__(self, label=None):
    # something else here
cliffckerr commented 2 years ago

Well spotted, looks like a bug!

cliffckerr commented 2 years ago

Fixed in the 3.1.0 release coming soon.