-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: develop
Are you sure you want to change the base?
Conversation
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
There was a problem hiding this 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.
|
||
#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) |
There was a problem hiding this comment.
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.
am.addOrReplaceAttributeArray(f32arr) | ||
|
||
# Add AttributeMatirx to DataContainer | ||
dc.addOrReplaceAttributeMatrix(am) | ||
|
There was a problem hiding this comment.
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.