the function plot_phase_fold raise error.
In the plot.py file the funciton plot_phase_fold are defined as:
def plot_phase_fold(sample, data=None, ax=None,
with_time_unit=False, n_phase_samples=4096,
add_labels=True, show_s_errorbar=True, residual=False,
remove_trend=True, plot_kwargs=None, data_plot_kwargs=None)
this function will raise a error when run like :
tj.plot_phase_fold(joker_samples, ax=ax) # without data input
the error message:
Traceback (most recent call last):
File ".py", line , in
tj.plot_phase_fold(joker_samples, ax=ax)
File "/Users/sky/opt/miniconda3/envs/py39tj/lib/python3.9/site-packages/thejoker/plot.py", line 329, in plot_phase_fold
orbit.radial_velocity(t0 +
UnboundLocalError: local variable 't0' referenced before assignment
the error is raised because in the plot.py file the line "t0 = sample.get_t0()" is inside the " if data is not None:"
if data is not None:
rv = data.rv
if remove_trend:
# HACK:
trend = orbit._vtrend
orbit._vtrend = lambda t: 0.
rv = rv - trend(data.t)
v0_offset_names = get_v0_offsets_equiv_units(sample.n_offsets).keys()
for i, offset_name in zip(range(1, sample.n_offsets+1),
v0_offset_names):
_tmp = sample[offset_name].item()
rv[ids == i] -= _tmp
t0 = sample.get_t0()
but in the source I downloaded from github, the line "t0 = sample.get_t0()" are outside the if condition:
P = sample['P'].item()
t0 = sample.get_t0()
if data is not None:
rv = data.rv
So I hope in the following version, this would be fixed.
PS:
I installed thejoker by pip: pip install thejoker and installed thejoker 1.2.2
the function plot_phase_fold raise error. In the plot.py file the funciton plot_phase_fold are defined as: def plot_phase_fold(sample, data=None, ax=None, with_time_unit=False, n_phase_samples=4096, add_labels=True, show_s_errorbar=True, residual=False, remove_trend=True, plot_kwargs=None, data_plot_kwargs=None)
this function will raise a error when run like : tj.plot_phase_fold(joker_samples, ax=ax) # without data input
the error message: Traceback (most recent call last): File ".py", line , in
tj.plot_phase_fold(joker_samples, ax=ax)
File "/Users/sky/opt/miniconda3/envs/py39tj/lib/python3.9/site-packages/thejoker/plot.py", line 329, in plot_phase_fold
orbit.radial_velocity(t0 +
UnboundLocalError: local variable 't0' referenced before assignment
the error is raised because in the plot.py file the line "t0 = sample.get_t0()" is inside the " if data is not None:"
but in the source I downloaded from github, the line "t0 = sample.get_t0()" are outside the if condition:
So I hope in the following version, this would be fixed.
PS: I installed thejoker by pip: pip install thejoker and installed thejoker 1.2.2