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

Improve Python Example use_case_02.py with additional example codes #423

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

mhitzem
Copy link
Contributor

@mhitzem mhitzem commented Aug 11, 2021

  • Generates a new csv file with random data (fake scalar data)
  • Data from file is read and put into uint32 and float32 arrays and added to AttributeMatrix and DataContainer

Copy link
Contributor

@imikejackson imikejackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could we also add an argument "--output_dir" to the main args that allows the user to set where all of the output files are created. Be sure to flow that through all needed parts of the code.

Wrapping/Python/Examples/use_case_02.py Show resolved Hide resolved
Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved
Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved

#Creates arrays from data with shape of (# of vertices x 1)
uintarr = np.ndarray(shape=(37989, 1), dtype=np.uint32, buffer=uints)
floatarr = np.ndarray(shape=(37989, 1), dtype=np.float32, buffer=f32s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the numVerts variable from above instead of the 37989 hard coded value.

Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved
Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved
@imikejackson imikejackson changed the title Adding scalar data to XYZ coordinate Improve Python Example use_case_02.py with additional example codes Aug 12, 2021
@imikejackson imikejackson added Enhancement Code added that makes life easier good first issue labels Aug 12, 2021
Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved
Wrapping/Python/Examples/use_case_02.py Outdated Show resolved Hide resolved
am.addOrReplaceAttributeArray(f32arr)

# Add AttributeMatirx to DataContainer
dc.addOrReplaceAttributeMatrix(am)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if you can add the DREAM3D filter "apply_transformation_to_geometry" which is in the DREAM3DReview plugin. Take a look at https://github.com/dream3d/DREAM3DReview/blob/develop/Test/Python/Apply_Transformation_To_Geometry.py file for inspiration.

In that example we are using a transformation matrix but see if you can figure out how to use just a scaling factor in each direction. Try out a scaling factor of 10x in each direction just to make it obvious when the data is viewed.

Write out the dream3d file before the transformation and after then use ParaView to view the results and verify that you have successfully scaled the vertices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Code added that makes life easier good first issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants