ukhsa-collaboration / pygom

ODE modelling in Python
GNU General Public License v2.0
27 stars 20 forks source link

SquareLoss with non-empty Target_State leads to failed minimize via .costIV #49

Open js1200 opened 4 years ago

js1200 commented 4 years ago

The problem is in the parsing of the Target_State for initial condition fitting. A list of lists is returned instead of a list of integer indices. Fixing this in base_loss.py corrected the error. Professor John S. McCaskill, European Centre of Living Technology, Venice

def _getTargetStateIndex(self):
        """
        Get the indices of our targeted states
        """
        if self._targetState is None:
            index_list = range(self._num_state)
        else:
            # index_list = [self._ode.get_state_index(i) for i in self._targetState]   # original version
            index_list = list()                                                          # JSM
            for i in self._targetState:                                             # JSM
                index_list.extend(self._ode.get_state_index(i))    # JSM
        return index_list
twomagpi commented 4 years ago

Thank you. I'll investigate further.

The Loss classes are due a little work