Comments (7)
Im not sure about this; isn't the whole point of "models" in napari to separate the logic from specifically the GUI? AFAIK the whole model thing is simply a way to implement the event loop and all the logic related to it without depending on the qt frontend. Am I wrong?
As for our case: there was really no reason to keep the abstract classes, since it added nothing. The only use it had was to enforce the implementation of _data_setter
in subclasses, which as easily done by raising NotImplementedError
and requires less importing and fewer lines of code.
Where do you see a need/benefit of using abstract classes and/or "models"?
from blik.
Generally I just like the abstract class pattern, my feelings pretty much align with what this person thinks in that it's just the right object for the job (we never instantiate datablocks directly)
I'm not excessively bothered by it though and happy to go either way!
For the models, you might be right about the event loop stuff but more broadly I like the idea of it being obvious where all of the base components are and their implementations separate - for creating this separation there are two solutions
- some obvious thing in the filename of the 'DataBlocks' directory, like
_model.py
- a separate module for
components
, where all of the abstract base classes for different types of things we work with would live
What're your thoughts?
from blik.
I see your point about abstract classes... Maybe that's better! But yeah, function-wise it's not that important.
As for models: I still don't get it... can you give me a practical example for peepingtom? What would you split into a "model" and its "implementation", how roughly?
from blik.
Yep sure
The DataBlock class would be a 'model' the way I'm seeing it, either as an abstract class in its own file in a components
module or in a datablock_model.py
file in the directory with all of the classes which inherit from it. The implementations are then each class which inherits from that base class
from blik.
So you're basically saying that we should make DataBlock
and other base classes into abstract classes, and those should be called models
for clarity?
If yes, this is a completely different thing from how model
is defined in napari... It resembles more what they do with layers
, where base
contains what you are calling model
s, and the daughter classes are in separate things.
This is what we had at some point, with a base.py
in every module, but I don't really like that because it makes the file/module not self-explanatory (same reason why we should probably change all the utils
into something better). I think datablock.py
is clearly enough the base implementation of all the datablocks.
from blik.
not necessarily changing the name of the class, just indicating in the file name that it's a model - I actually prefer the other option I suggested, having all of the base classes as components
in a separate components
module, in any case it's not super important just a choice, I like the clear separation :)
from blik.
Addressed this with the addition of abstract classes in #84. Names stayed more or less the same, but they are logically separated by the rest.
from blik.
Related Issues (20)
- Use dask HOT 5
- failed reading of star file HOT 1
- Images HOT 3
- Dependency issues HOT 2
- Failed to load mrc HOT 9
- saving files should add extension if needed
- saving star file does not save pixel size correctly HOT 1
- issue with star file reading? HOT 7
- reducing coordinate opacity makes black dots on the image layer HOT 12
- Generating the same particle twice overrides the existing layer but with broken orientations HOT 2
- Minor issue: expected MRC file extension HOT 1
- Suggestion: show tomograms in the same orientation as IMOD HOT 3
- out of slice fading of point and orientation layer HOT 2
- colouring points by data attribute HOT 4
- install error using Napari GUI HOT 7
- gaussian filter has no "Run" button HOT 2
- Convert meshblock to a multiblock HOT 1
- Clean up non-visualization code
- Import times are SLOW HOT 3
- Documentation
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 blik.