phoebe2 icon indicating copy to clipboard operation
phoebe2 copied to clipboard

ce() missing 2 required positional arguments: 'Aell' and 'phi0'

Open amiszuda opened this issue 1 year ago • 3 comments

Hi,

I have noticed that sometimes EBAI fails with TypeError: ce() missing 2 required positional arguments: 'Aell' and 'phi0' error. The working example can be found in the attachment, and the full error log is provided below:

2G model C failed with error: Residuals are not finite in the initial point.
2G model CE failed with error: Residuals are not finite in the initial point.
2G model CG failed with error: Residuals are not finite in the initial point.
2G model CGE failed with error: Residuals are not finite in the initial point.
2G model CG12 failed with error: Residuals are not finite in the initial point.
2G model CG12E1 failed with error: Residuals are not finite in the initial point.
2G model CG12E2 failed with error: Residuals are not finite in the initial point.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-390114a87a57> in <module>
      1 b.add_solver('estimator.ebai', solver='lc_est_ebai_mlp', ebai_method='mlp', overwrite=True)
----> 2 b.run_solver('lc_est_ebai_mlp', solution='lc_soln_ebai_mlp', overwrite=True)
      3 print(b.adopt_solution('lc_soln_ebai_mlp', overwrite=True, trial_run=True))

~/.local/lib/python3.6/site-packages/phoebe/parameters/parameters.py in _send_if_client(self, *args, **kwargs)
    422 
    423         else:
--> 424             return fctn(self, *args, **kwargs)
    425 
    426     return _send_if_client

~/.local/lib/python3.6/site-packages/phoebe/frontend/bundle.py in run_solver(self, solver, solution, detach, return_changes, **kwargs)
  13647 
  13648         solver_class = getattr(_solverbackends, '{}Backend'.format(solver_ps.kind.title()))
> 13649         params = solver_class().run(self, solver_ps.solver, compute, solution=solution, **{k:v for k,v in kwargs.items() if k not in ['compute']})
  13650         metawargs = {'context': 'solution',
  13651                      'solver': solver_ps.solver,

~/.local/lib/python3.6/site-packages/phoebe/solverbackends/solverbackends.py in run(self, b, solver, compute, **kwargs)
    553 
    554         else:
--> 555             rpacketlists_per_worker = [self.run_worker(**packet)]
    556 
    557         logger.debug("rank:{}/{} calling _fill_solution".format(mpi.myrank, mpi.nprocs))

~/.local/lib/python3.6/site-packages/phoebe/solverbackends/solverbackends.py in run_worker(self, b, solver, compute, **kwargs)
   1248             lcModel = ligeor.models.Polyfit(phases=phases_shifted[s], fluxes=fluxes[s], sigmas=sigmas[s])
   1249 
-> 1250         lcModel.fit()
   1251         ebai_phases = np.linspace(-0.5,0.5,ebai_phase_bins)
   1252         ebai_fluxes = lcModel.compute_model(ebai_phases, best_fit=True)

~/.local/lib/python3.6/site-packages/phoebe/dependencies/ligeor/models/twogaussian.py in fit(self, fit_funcs, param_vals)
    100             # compute all model light curves
    101 
--> 102         self.compute_twoGaussian_models()
    103         # compute corresponding BIC values
    104         self.compute_twoGaussian_models_BIC()

~/.local/lib/python3.6/site-packages/phoebe/dependencies/ligeor/models/twogaussian.py in compute_twoGaussian_models(self)
    619 
    620         for fkey in self.fits.keys():
--> 621             models[fkey] = self.twogfuncs[fkey](self.phases, *self.fits[fkey])
    622 
    623         self.models = models

TypeError: ce() missing 2 required positional arguments: 'Aell' and 'phi0'

failing_EBAI.tar.gz

amiszuda avatar Apr 17 '24 11:04 amiszuda

Does the error go away if you disable phase-binning in the solver options? See also https://github.com/phoebe-project/phoebe2/discussions/829 and https://github.com/phoebe-project/phoebe2/discussions/743.

This seems to be happening more and more though, so we'll try to bump its priority up and try to fix it in an upcoming bugfix. (Changing the title just so that it is a little more discoverable since this does occur for other solvers as well).

kecnry avatar Apr 17 '24 12:04 kecnry

Disabling phase_bin does help, though I thought to emphasize this error knowing that it happened before and possibly has not been fully resolved. Thanks though!

amiszuda avatar Apr 17 '24 12:04 amiszuda

Yep - still definitely needs to be fixed (or at least raising an error suggesting disabling phase-binning), so good to have this filed as an actual issue. Thanks!

kecnry avatar Apr 17 '24 12:04 kecnry