Giter Club home page Giter Club logo

magresview's People

Contributors

stur86 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

magresview's Issues

Add screenshot button to main page body

Having to change tabs to take a screenshot means visualisation can behave in unpredictable ways. Better to have a button on the main body to do that, to avoid these side effects.

Visualization of `MagresAtomsView` fails using `_repr_png_()` due to `TypeError: unhashable type: 'MagresAtom'`

The visualization of bonding and J-coupling networks fails when using the _repr_png_() method of the MagresAtomsView class. The failure occurs when calling:

...
atoms_set = set(self.atoms)
...

with the error:

TypeError: unhashable type: 'MagresAtom`

Environment Details

OS: Windows Subsystem for Linux 2 (Ubuntu 20.04)
Kernel: 4.19.104-microsoft-standard

Using Miniconda3

$ conda --version
conda 4.9.2

Example

In the example notebook Bonding and J-coupling network output example.ipynb

from __future__ import print_function

from magres.atoms import MagresAtoms, MagresAtomsView

ethanol_atoms = MagresAtoms.load_magres('../samples/ethanol-all.magres')

castep_file = open('../samples/ethanol.castep').read()

ethanol_atoms.calculate_bonds()

At this point, no output is generated in the notebook (note: this is true even after removing the return None from the _repr_png_() method in MagresAtomsView.)

Explicitly calling ethanol_atoms._repr_png_() will then throw the TypeError.


Suggested Fix

Define a __dict__ and __key attribute for the MagresAtom class to make it "hashable".

See this Stackoverflow question

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.