Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot access local variable 'ad' where it is not associated with a value #28

Open
CollapsarSpectrum opened this issue Feb 18, 2025 · 0 comments

Comments

@CollapsarSpectrum
Copy link

Parameter Passing Failure in anndata_to_train_val() During GEMS Construction.

When attempting to run the construct_gems_using_nsf() function with the example dataset (Mouse_embryo_svg_E9.5.h5ad), I encountered a bug. It appears that the anndata_to_train_val() function fails to correctly accept the ad argument passed from _gem_construction.py. This is strange because when I run the anndata_to_train_val() function separately with the adata from example dataset as the input, it works fine.

The code

fs.pp.construct_gems_using_nsf(adata,
                            n_gems = 20,
                            layer_key = 'count',
                            length_scale = 5.0)

Error massage

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
Cell In[5], line 1
----> 1 fs.pp.construct_gems_using_nsf(adata,
      2                             n_gems = 20,
      3                             layer_key = 'count',
      4                             n_inducing_pts = 500,
      5                             length_scale = 10)

File ~/anaconda3/envs/space_py311/lib/python3.11/site-packages/flowsig/preprocessing/_gem_construction.py:70, in construct_gems_using_nsf(adata, n_gems, layer_key, spatial_key, n_inducing_pts, length_scale)
     68 # Take raw count data for NSF
     69 training_fraction = 1.0
---> 70 D,Dval = anndata_to_train_val(ad,
     71                         layer=layer_key,
     72                         train_frac=training_fraction,
     73                         flip_yaxis=True)
     74 Ntr,J = D["Y"].shape
     75 Xtr = D["X"]

UnboundLocalError: cannot access local variable 'ad' where it is not associated with a value

pacakge version

spatial_factorization==0.0.1
FlowSig==0.1.2
commot==0.0.3
pyliger==0.2.3
tensorflow==2.18.0
numpy==1.26.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant