aristoteleo / spateo-release

Spatiotemporal modeling of spatial transcriptomics
https://spateo-release.readthedocs.io/
BSD 2-Clause "Simplified" License
159 stars 27 forks source link

missing dict in morphofield_gp #264

Open Secretloong opened 1 week ago

Secretloong commented 1 week ago

when run morphofield_gp, I found there is no norm_dict and kernel_dict in morpho_class.py

File ~/miniconda3/envs/spateo/lib/python3.9/site-packages/spateo/tdr/morphometrics/morphofield/gaussian_process.py:102, in _gp_velocity(X, vf_dict)
    100 def _gp_velocity(X: np.ndarray, vf_dict: dict) -> np.ndarray:
    101     # pre_scale = vf_dict["pre_norm_scale"]
--> 102     norm_x = (X - vf_dict["norm_dict"]["mean_transformed"]) / vf_dict["norm_dict"]["scale_transformed"]
    103     if vf_dict["kernel_dict"]["dist"] == "cdist":
    104         quary_kernel = _con_K(norm_x, vf_dict["inducing_variables"], vf_dict["beta"])

KeyError: 'norm_dict'
File ~/miniconda3/envs/spateo_updated/lib/python3.9/site-packages/spateo/tdr/morphometrics/morphofield/gaussian_process.py:103, in _gp_velocity(X, vf_dict)
    100 def _gp_velocity(X: np.ndarray, vf_dict: dict) -> np.ndarray:
    101     # pre_scale = vf_dict["pre_norm_scale"]
    102     norm_x = (X - vf_dict["norm_dict"]["mean_transformed"]) / vf_dict["norm_dict"]["scale_transformed"]
--> 103     if vf_dict["kernel_dict"]["dist"] == "cdist":
    104         quary_kernel = _con_K(norm_x, vf_dict["inducing_variables"], vf_dict["beta"])
    105     elif vf_dict["kernel_dict"]["dist"] == "geodist":

KeyError: 'kernel_dict'
Sichao25 commented 2 days ago

Hi, thanks for raising this issue. I feel like those two dictionaries should be added in morpho_align_sparse() in alignment/morpho_alignment.py, which performs the continuous alignment of spatial transcriptomic coordinates.