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

Python Bindings Known Issues #913

Open
1 of 3 tasks
imikejackson opened this issue Apr 13, 2024 · 6 comments
Open
1 of 3 tasks

Python Bindings Known Issues #913

imikejackson opened this issue Apr 13, 2024 · 6 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Comments

@imikejackson
Copy link
Contributor

imikejackson commented Apr 13, 2024

Actions need to be documented

@imikejackson

  • Completed
    There is currently NO documentation for each of the actions.

Filter Parameters Documentation

@imikejackson

  • Completed

Each Parameter should have a screen shot from the User Interface to help the user identify the parameter

IDE Filter Documentation

@imikejackson

  • Completed

Update the .pyi files to include first paragraph from filters documentation

@imikejackson imikejackson added the bug Something isn't working label Apr 13, 2024
@imikejackson
Copy link
Contributor Author

imikejackson commented Apr 13, 2024

  • DOCS: Create a short tutorial about writing basic python + simplnx integration #925 Hopefully included in this PR

  • Preflight is tough. Need examples and thorough docs
    Preflight Actions need explanation

  • Generate Python Skeleton
    Needs some more docs to fully explain the options

  • DataArray API
    Tuple/Comp dims functions tDims?

  • Filter Writing: when to use certain parameters in what situation

  • Update the docs more with this kind of information

@imikejackson
Copy link
Contributor Author

imikejackson commented Apr 13, 2024

Pipeline Objects

import simplnx as nx
import nxutility
import numpy as np

# Create the DataStructure instance
data_structure = nx.DataStructure()
# Read the pipeline file
pipeline = nx.Pipeline().from_file( 'lesson_2.d3dpipeline')

# Append a new filter onto the end of the pipeline
create_geom_args : dict = {
        "array_handling": 0,
        "cell_attribute_matrix_name": "Cell Data",
        "dimensions": [ 100, 100, 100 ],
        "geometry_name": nx.DataPath("Output Geometry"),
        "geometry_type": 0,
        "length_unit_type": 7,
        "origin": [ 0.0, 0.0, 0.0 ],
        "spacing": [ 1.0, 1.0, 1.0 ],
        "warnings_as_errors": False
}

# Execute the modified pipeline
pipeline.append(nx.CreateGeometryFilter(), create_geom_args)
result = pipeline.execute(data_structure)
nxutility.check_pipeline_result(result=result)

pipeline.to_file( "Modified Pipeline", "Pipelines/lesson_2_modified_pipeline.d3dpipeline")

The last line in this python will fail because not all of the arguments are present in the create_geom_args dictionary. We should just write it out using the default arguments at that point

@imikejackson
Copy link
Contributor Author

imikejackson commented Apr 14, 2024

  • Completed

Pipeline Filter

There should be easier access to the "human_name" and the "name" attributes for the Pipeline filter, i.e., a developer should not have to jump through pipeline_filter.get_filter().human_name()

pipeline_filter.human_name()
pipeine_filter.name()

@imikejackson
Copy link
Contributor Author

imikejackson commented Apr 14, 2024

  • Completed

C++ Filter Naming

All filters should end with "Filter"

@imikejackson
Copy link
Contributor Author

imikejackson commented Apr 15, 2024

PreflightUpdatedValues

  • Completed

In the Python Filter, one cannot return preflight updated values.

The following does not work, throwing an error about supported types.

return nx.IFilter.PreflightResult(output_actions=output_actions, errors=None, warnings=None, preflight_values=preflight_values)

Progress Messages:

  • Completed

This does not work because ProgressMessage is not exposed

    message_handler(nx.IFilter.Message(nx.IFilter.Message.Type.Progress, f'Progress Message:', 50))

DataStructure API Additions

  • Completed
path_exists(nx.DataPath)
path_exists(str)
nx.filter.XXX
nx.parameter.XXX
nx.geometry.XXX

AttributeMatrix API Additions

  • Completed
tuple_shape()
component_shape()
__size__() 

@imikejackson imikejackson added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 15, 2024
@imikejackson
Copy link
Contributor Author

Breakdown the API into more namespaces

  • Completed

This is Non-Trivial. Putting a pin in it for now.
The real problem is generating the .pyi files with the namespace

JDuffeyBQ added a commit that referenced this issue May 13, 2024
- Some changes are for #913
- No longer require name argument on `Pipeline.to_file`
- Added `Pipeline.to_json_str`
- Added `Pipeline.name`
- Added `PipelineFilter.comments`
- `IFilter::toJson` now uses default values when the value in the arguments doesn't exist instead of failing
- Fixed the lifetime of docstrings generated at runtime
- Removed `registerPluginPyFilters`

Signed-off-by: Jared Duffey <jared.duffey@bluequartz.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants