Skip to content

Commit

Permalink
MR: Small correction in lsq function
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuR18 committed Aug 7, 2024
1 parent a67e6c6 commit 345837c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ForMoSA/nested_sampling/nested_modif_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ def lsq_fct(flx_obs_spectro, err_obs_spectro, star_flx_obs, transm_obs, flx_mod_
if len(system_obs) > 0:
A_matrix = np.zeros([np.size(flx_obs_spectro), 1 + len(star_flx_obs[0][0]) + len(system_obs[0][0])])
for j in range(len(system_obs[0][0])):
A_matrix[:,1+len(star_flx_obs[0][0])+j] = system_obs[0][:,j] * err_obs_spectro
A_matrix[:,1+len(star_flx_obs[0][0])+j] = system_obs[0][:,j] / err_obs_spectro
else:
A_matrix = np.zeros([np.size(flx_obs_spectro), 1 + len(star_flx_obs[0][0])])

for j in range(len(star_flx_obs[0][0])):
A_matrix[:,1+j] = star_flx_obs[0][:,j] * err_obs_spectro
A_matrix[:,1+j] = star_flx_obs[0][:,j] / err_obs_spectro

A_matrix[:,0] = flx_mod_spectro * err_obs_spectro
A_matrix[:,0] = flx_mod_spectro / err_obs_spectro

# Least square
res = optimize.lsq_linear(A_matrix, flx_obs_spectro * err_obs_spectro, bounds=([0]*len(A_matrix[0]), [1]*len(A_matrix[0])))
res = optimize.lsq_linear(A_matrix, flx_obs_spectro / err_obs_spectro, bounds=([0]*len(A_matrix[0]), [1]*len(A_matrix[0])))
cp = res.x[0]

cs = np.array([])
Expand Down

0 comments on commit 345837c

Please sign in to comment.