Related to Issue 97 (and Manu Stalport's fix also fixes this), but broader, this applies to any TTV fit with two or more transiting planets because of how the lightcurve dictionary is built. The current code (starting from line 618 of fit.py) has the following:
if dictype == 'lc':
for i in range(ninstruments):
dictionary[inames[i]]['TTVs'] = {}
for pi in numbering_planets:
dictionary[inames[i]]['TTVs'][pi] = {}
dictionary[inames[i]]['TTVs'][pi]['status'] = False
dictionary[inames[i]]['TTVs'][pi]['parametrization'] = 'dt'
dictionary[inames[i]]['TTVs'][pi]['transit_number'] = []
for pri in self.priors.keys():
[...]
if pri[0:2] == 'dt' or pri[0:2] == 'T_':
if pri[0:2] == 'T_':
dictionary[
inames[i]]['TTVs'][pi]['parametrization'] = 'T'
planet_number, instrument, ntransit = pri.split('_')[1:]
if inames[i] == instrument:
dictionary[inames[i]]['TTVs'][int(
planet_number[1:])]['status'] = True
dictionary[inames[i]]['TTVs'][int(
planet_number[1:])]['transit_number'].append(
int(ntransit))
As the line storing the parametrization is not in a loop on pi and there has already been such a loop, it will only alter it for the last planet - all the others will remain with parametrization = dt as initialized.
To fix this while also making it more similar to how the rest of the TTV dictionary is written, I suggest moving that key writing down with the others, like so:
if pri[0:2] == 'dt' or pri[0:2] == 'T_':
planet_number, instrument, ntransit = pri.split('_')[1:]
if inames[i] == instrument:
if pri[0:2] == 'T_':
dictionary[inames[i]]['TTVs'][int(
planet_number[1:])]['parametrization'] = 'T'
dictionary[inames[i]]['TTVs'][int(
planet_number[1:])]['status'] = True
dictionary[inames[i]]['TTVs'][int(
planet_number[1:])]['transit_number'].append(
int(ntransit))
which has the advantage of using the same method to get the planet number key for all the TTV keys, and appears to work correctly (my fit now runs, at least!).
Related to Issue 97 (and Manu Stalport's fix also fixes this), but broader, this applies to any TTV fit with two or more transiting planets because of how the lightcurve dictionary is built. The current code (starting from line 618 of fit.py) has the following:
As the line storing the parametrization is not in a loop on
pi
and there has already been such a loop, it will only alter it for the last planet - all the others will remain with parametrization = dt as initialized.To fix this while also making it more similar to how the rest of the TTV dictionary is written, I suggest moving that key writing down with the others, like so:
which has the advantage of using the same method to get the planet number key for all the TTV keys, and appears to work correctly (my fit now runs, at least!).