Comments (2)
This looks like a nontrivial challenge, glad that you're putting thought in it. Having a quick look around, it looks like Matplotlib uses a decorator for this, image_comparison
, within a full testing
module devoted to such comparisons.
from qsurface.
This problem is even harder than I imagined. The figures in opensurfacesim are interactive and utilizes the Tkinter framework, which is loaded by matplotlib.use('TkAgg')
. By loading the tk framework, each figure window is effectively a Tkinter GUI. The problem that many encounter is that the test suite waits until the GUI window is closed.
The way I see it, the testing of the plotting features can be performed in two ways.
- Direct comparison with saved images. This is what the
image_comparison
decorator from matplotlib does. - Testing by only asserting an error has occurred if an exception is raised.
Since plotting in opensurfacesim is highly dynamic, the second method might be preferable. The current implementation utilizes a custom matplotlib.blocking_input
object for which we can alter the waiting time. If the waiting time is set to 0, the problem described above is avoided. Currently, testing functions for a large amount of the plotting features is already bundled under the @pytest.mark.plotting
mark, and we can successfully perform these tests, locally.
For CI, since there is no DISPLAY
or renderer for the GUI, calling matplotlib.use('TkAgg')
becomes quite problematic. More investigation into this matter is needed. A possible solution is to use a Xvfb framebuffer, which also has a pytest integration.
from qsurface.
Related Issues (20)
- Move decorators to their appropriate modules HOT 1
- Limit class reset methods to increase performance HOT 1
- Interactive erasure on 3D plot bug HOT 1
- Format docstrings HOT 2
- Add my binder integration HOT 1
- Add configuration file to repeat simulations
- debug decorator class HOT 1
- Confusing simulation setup HOT 1
- Split graph objects and base elements; use inherited graph objects HOT 1
- Remove pprint from requirements.txt
- Update Patch3D plotting HOT 1
- Floating point used as pandas index for error probability HOT 2
- Update tests HOT 1
- Cannot plot non-interactively HOT 1
- KeyError: 'max_cardinality' HOT 3
- Inquiry on plots for unionfind decoder
- Multiprocessing `RecursionError: maximum recursion depth exceeded while calling a Python object` [WINDOWS ISSUE]
- How to generate .gif as in example
- An Example Code for the simplest Case
- Update the BenchmarkDecoder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qsurface.