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

Onto codevelopment #162

Merged
merged 109 commits into from
Mar 17, 2023
Merged

Onto codevelopment #162

merged 109 commits into from
Mar 17, 2023

Conversation

liamhuber
Copy link
Member

@liamhuber liamhuber commented Jan 24, 2023

This is the base PR for integrating ontological typing with pyiron_ontology. The ontology module is still under active development and not even available as a dependency on conda forge yet. This will stay as a draft until that dependency is available.

WARNING: the binder link will fail because the pyiron_ontology dependency is not yet listed!

Since the ontology module is still quite new, I'll be actively developing it together with ironflow until I'm satisfied enough to release it on conda. To get far enough along the ironflow development to really know what I even need from pyiron_ontology would make this a beast of a PR, so I'll use the stacked-PR paradigm again.

In this particular PR, I lay the most fundamental groundwork:

  • Introduce a new port field, otype, to track ontological typing
  • Add a new node for selecting material properties from the ontology, and convert input to generic units in output
  • Add available ontological typing to the Murnaghan node
  • (De)serialization working with otypes
  • Perform ontological validation for ontologically typed input ports (not output ports -- their output can be valid regardless of where it gets used downstream)
  • Add ontological typing to Lammps and BulkStructure nodes
  • Pass ontological conditions upstream for ontological validation of input connections

Note that for now I plan to keep all the type checking with the dtype.
On the one hand, this makes node definitions a bit verbose, as both dtype and otype should be defined.
On the other hand...

  • I can imagine many places where a value could come from a typed port...or it could just come from, like, a np.linspace as user input. There is a field in the ontology for user input, so we could get fancy here at some point, but for now let's keep it simple and let users manually feed in data of the correct dtype if they want.
  • Type checking also watches for batched/unbatched data conflicts, but in terms of ontological hinting it will be very useful to get node suggestions that ignore this since you can always index/batch those fields to change their effective batch status.
    So for the time being I want to keep separate the idea of using ontological typing for workflow construction hints and suggestions, and data typing for workflow connection requirements.

As of this PR, you can send Murnaghan output to the material property node and get it correctly converted to the generic units. When building up the graph, where both input and output are ontologically typed, input validation now also confirms that the ontological type being input matches the ontological conditions, and these conditions are collected by traversing the graph downstream and collecting all downstream conditions. Thus, in the simple graph below, the Lammps structure input is aware that it needs a bulk-like structure.

Screen Shot 2023-01-26 at 13 19 12

From here on out we'll make stacked PR's to handle the recommender system. Then hopefully merge and get a release based on a conda-forge version of pyiron_ontology, then extend everything to the surface energy use-case.

Edit: Stacked PRs (to be) merged in

  • Add a "recommended" nodes tab powered by the ontology
  • Highlight ontologically-valid ports within the graph
  • Add an example for ontologically-driven design of a bulk modulus workflow
  • Add ontological typing of projects
  • Add a slab surface creator
  • Add a surface energy node
  • Add an example for ontologically-driven design of a surface energy workflow
  • Sync dependency with a new version of pyiron_ontology
  • Update readme

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch pyiron/ironflow/onto_codevelopment

liamhuber and others added 26 commits January 24, 2023 15:59
That didn't make any sense, I would have wanted to index 1. Anyhow it worked and I don't even need it because the ontology namespace is already removed in the `name` attribute
Not yet extensible, only works with ontologies that ironflow already knows about in its code base. For now that's ok, we can work out a registration system later.
Need to go work out the onto logic; right now it just always passes.
Output is as output does; if it's got a valid value it's valid regardless who it's connected to.
And kick the can down the road for making sure it's correct in the context of the entire workflow
I'll need to actually add more nodes that use the ontology before this is properly testable, but at least it doesn't break single-jump connections.
They're pyiron_ontology Parameter objects, not just generic owlready2 Things.
pyiron_ontology doesn't exist on pip or conda yet, so tests will fail, but that's ok for now.
Totally unrelated to this PR. Let's just sneak it in and get it done with.
It used to be called model, but it's not HasSession it really is GUI. Name it so.
liamhuber and others added 24 commits March 13, 2023 12:39
Pass around the actual ports and not just the otypes. We'll need to do a recursive check that all upstream guys also satisfy their downstream requirements
This doesn't get the job done, but it's getting close for input ports. It is terribly slow, but let's worry about efficiency after it's working.
Remove redundant variable
It still has the chance to make multiple tree construction calls, but this still seems unavoidable to me right now
By using iterators instead of list comprehensions in `any` and `all` calls
Otype checking itself is actually not terribly un-performant, but the current architecture is trying to do it per-draw, which is a bit crazy.
@liamhuber liamhuber added format_black Invoke black formatting CI and removed format_black Invoke black formatting CI labels Mar 17, 2023
@liamhuber liamhuber merged commit 7a38f6e into main Mar 17, 2023
@liamhuber liamhuber deleted the onto_codevelopment branch March 17, 2023 20:17
@liamhuber liamhuber mentioned this pull request Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format_black Invoke black formatting CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants