YaleDHLab / pix-plot

A WebGL viewer for UMAP or TSNE-clustered images

Home Page:https://s3-us-west-2.amazonaws.com/lab-apps/pix-plot/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug with get_heightmap and umap layouts

CarloOtano opened this issue · comments

Getting "TypeError: string indices must be integers" exception in get_manifest function:

if 'umap' in layouts and layouts['umap']:
get_heightmap(layouts['umap']['variants'][0]['layout'], 'umap', **kwargs) ,<-- Error (line 423)

Error happens if:

  • I run with a defined plot_id more than once (E.g. -- plot_id = "RepeatedName")
  • use_cache = True
  • cuml_ready = False

I think the issue is caused because process_single_layout_umap function can returns results structured in different ways:

  1. If an exiting files is found (and use_cache=True, cuml_ready=False), function returns path as a string
  2. If an no exiting files is found or use_cache = False or cuml_ready = True, function returns dictionary

One solution would be to replace line 611in process_single_layout_umap with:
return {'variants': [{'layout': out_path}]} instead of return out_path

e.g. if os.path.exists(out_path) and kwargs['use_cache']: return {'variants': [{'layout': out_path}]}

@CarloOtano thanks for this! Is there any chance you could send a little pull request? If so we'd be happy to get it merged!

@duhaime Please let me know if that is what you needed.

Cheers,
Carlo

Issues was resolved:
Merge pull request #265 from CarloOtano/bug_264