Difference between revisions of "Blood Flow Aneurysm Tutorial Publishing to SeedMe.org"

(Sharing automation script)
m (Sharing automation script)
 
(6 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
=== Required setup ===
 
=== Required setup ===
  
* [https://www.seedme.org/user/register Sign-up] at SeedMe.org
+
* [https://www.seedme.org/user Sign-in] or [https://www.seedme.org/user/register Sign-up] at SeedMe.org
  
 
* [https://www.seedme.org/user Download] your ''API Key file'', then move it to your [https://en.wikipedia.org/wiki/Home_directory Home directory].
 
* [https://www.seedme.org/user Download] your ''API Key file'', then move it to your [https://en.wikipedia.org/wiki/Home_directory Home directory].
Line 17: Line 17:
 
*Paste the following Python snippet into this tab
 
*Paste the following Python snippet into this tab
 
<source lang="python">
 
<source lang="python">
 +
#
 +
# file: aneurysm_seedme.py
 +
# info:
 +
# Example showing how to use SeedMe to publish a pathline animation
 +
#
 +
# Copied from:
 +
# http://visitusers.org/index.php?title=Blood_Flow_Aneurysm_Tutorial_Publishing_to_SeedMe.org
 +
 +
 
##############################################################################
 
##############################################################################
 
# To do : Set the following four variables
 
# To do : Set the following four variables
Line 24: Line 33:
 
my_content_privacy = "public" # private (default), group, public
 
my_content_privacy = "public" # private (default), group, public
 
my_share_list = "one@example.com, two@example.com" # comma delimited emails
 
my_share_list = "one@example.com, two@example.com" # comma delimited emails
 
+
 
+
 
# Set save window attributes including path where the rendered images will be saved
 
# Set save window attributes including path where the rendered images will be saved
 
sa = SaveWindowAttributes()
 
sa = SaveWindowAttributes()
Line 46: Line 55:
 
sa.advancedMultiWindowSave = 0
 
sa.advancedMultiWindowSave = 0
 
SetSaveWindowAttributes(sa)
 
SetSaveWindowAttributes(sa)
 
+
 
+
 
# Now save this pathline visualization in 20 frames (images)
 
# Now save this pathline visualization in 20 frames (images)
 
# Animate our pathlines by cropping based on time
 
# Animate our pathlines by cropping based on time
satts = StreamlineAttributes()
+
iatts = IntegralCurveAttributes()
satts.referenceTypeForDisplay = satts.Time
+
iatts.cropValue = iatts.Time
satts.displayEndFlag = 1
+
iatts.cropEndFlag = 1
  
 
nsteps = 20 # Number of steps
 
nsteps = 20 # Number of steps
 
final_time = .995
 
final_time = .995
 
for i in range(nsteps+1):
 
for i in range(nsteps+1):
  satts.displayEnd = final_time * i /nsteps
+
    iatts.cropEnd = final_time * i /nsteps
  SetPlotOptions(satts)
+
    SetOperatorOptions(iatts)
  SaveWindow() # will save images at the sa.outputDirectory provided above
+
    SaveWindow() # will save images at the sa.outputDirectory provided above
 
+
 
+
 
# ----------------------------------------------------------------------------------#
 
# ----------------------------------------------------------------------------------#
 
# Upload and share content at SeedMe.org                                                         
 
# Upload and share content at SeedMe.org                                                         
Line 68: Line 77:
 
# ----------------------------------------------------------------------------------#
 
# ----------------------------------------------------------------------------------#
 
import seedme
 
import seedme
 
+
# Create seedme object
 
obj = seedme.SeedMe()
 
 
 
 
# Set path to the APIKey file
 
# Set path to the APIKey file
 
obj.set_auth_via_file(seedme_apikey_path)
 
obj.set_auth_via_file(seedme_apikey_path)
 
+
 
# Create a dictionary for rendered image sequence
 
# Create a dictionary for rendered image sequence
 
my_seq = {
 
my_seq = {
Line 83: Line 89:
 
       "encode": True,
 
       "encode": True,
 
       }
 
       }
 
+
 
+
# Create seedme object
 +
obj = seedme.SeedMe()
 +
 
# Create a new collection using create_collection method
 
# Create a new collection using create_collection method
 
# composed with title and sequence with public access, shared with two people
 
# composed with title and sequence with public access, shared with two people
Line 91: Line 99:
 
                             sharing=my_share_list, # string = Comma delimited emails
 
                             sharing=my_share_list, # string = Comma delimited emails
 
                             notify=True, # Boolean = False(default) send email notification to above two emails
 
                             notify=True, # Boolean = False(default) send email notification to above two emails
                             sequences=my_seq, # upload sequence and create video from it at 2 frame per second
+
                             sequences=my_seq, # upload sequence
 
                             )
 
                             )
 
+
 
# create_collection returns the result as a string in json format
 
# create_collection returns the result as a string in json format
 
print result
 
print result
 
+
 
url = obj.get_url(result)
 
url = obj.get_url(result)
 
# Visit this url on your web browser
 
# Visit this url on your web browser
 
print("\n\nThe url for this collection is: " + url)
 
print("\n\nThe url for this collection is: " + url)
 +
 
</source>
 
</source>
  
Line 105: Line 114:
  
 
To view your shared content [https://www.seedme.org/user login] to SeedMe.org then navigate to [https://www.seedme.org/collections My collections].
 
To view your shared content [https://www.seedme.org/user login] to SeedMe.org then navigate to [https://www.seedme.org/collections My collections].
 +
 +
 +
------------
 +
 +
 +
To learn more about SeedMe Python API review the example [https://bitbucket.org/seedme/seedme-python-client/src/master/demo.py?at=master&fileviewer=file-view-default demo.py]
  
  
Line 110: Line 125:
  
 
[[ Blood_Flow_Aneurysm_Tutorial | Aneurysm Tutorial Index]]
 
[[ Blood_Flow_Aneurysm_Tutorial | Aneurysm Tutorial Index]]
 +
 +
[[Category: VisIt Tutorial]]

Latest revision as of 05:05, 8 November 2016

Results from visualization and analysis are often shared with collaborators. SeedMe.org provides an easy to automate sharing and collaboration platform.

Required setup

Sharing automation script

In this section we will render and save pathline trace in 20 steps. Then upload and share the rendered 20 images as a sequence and instuct SeedMe to encode a video from these set of images at 2 frames per second. A sample video can be seen here

Brief explanation is provided in comments and detailed example can be seen here.

  • Open the Commands Window
    • [Controls Menu]->Command
  • Find an empty tab
  • Paste the following Python snippet into this tab
#
# file: aneurysm_seedme.py
# info:
# Example showing how to use SeedMe to publish a pathline animation 
#
# Copied from:
# http://visitusers.org/index.php?title=Blood_Flow_Aneurysm_Tutorial_Publishing_to_SeedMe.org


##############################################################################
# To do : Set the following four variables
##############################################################################
seedme_apikey_path = '/absolute/path/to/seedme.txt'
my_rendered_image_path = "/absolute/path/for/images/" # does not traverse recursively
my_content_privacy = "public" # private (default), group, public
my_share_list = "one@example.com, two@example.com" # comma delimited emails
 
 
# Set save window attributes including path where the rendered images will be saved
sa = SaveWindowAttributes()
sa.outputToCurrentDirectory = 0
sa.outputDirectory = my_rendered_image_path
sa.fileName = "pathline"
sa.family = 1
sa.format = sa.PNG
sa.width = 512
sa.height = 512
sa.screenCapture = 0
sa.saveTiled = 0
sa.quality = 80
sa.progressive = 0
sa.binary = 0
sa.stereo = 0
sa.compression = sa.PackBits  # None, PackBits, Jpeg, Deflate
sa.forceMerge = 0
sa.resConstraint = sa.ScreenProportions  # NoConstraint, EqualWidthHeight, ScreenProportions
sa.advancedMultiWindowSave = 0
SetSaveWindowAttributes(sa)
 
 
# Now save this pathline visualization in 20 frames (images)
# Animate our pathlines by cropping based on time
iatts = IntegralCurveAttributes()
iatts.cropValue = iatts.Time
iatts.cropEndFlag = 1

nsteps = 20 # Number of steps
final_time = .995
for i in range(nsteps+1):
    iatts.cropEnd = final_time * i /nsteps
    SetOperatorOptions(iatts)
    SaveWindow() # will save images at the sa.outputDirectory provided above
 
 
# ----------------------------------------------------------------------------------#
# Upload and share content at SeedMe.org                                                         
# Instruct the seedme module to upload 20 images then encode a video from it
# seedme module ships with VisIt 2.9.x +                                                          
# ----------------------------------------------------------------------------------#
import seedme
 
# Set path to the APIKey file
obj.set_auth_via_file(seedme_apikey_path)
 
# Create a dictionary for rendered image sequence
my_seq = {
       "filepath": my_rendered_image_path,
       "title": "Pathline",
       "description": "Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.",
       "fps": 2,
       "encode": True,
      }
 
# Create seedme object
obj = seedme.SeedMe()
 
# Create a new collection using create_collection method
# composed with title and sequence with public access, shared with two people
result=obj.create_collection(title="Aneurysm vis",
                             privacy=my_content_privacy,  # string = One of private(default), group, public
                             sharing=my_share_list, # string = Comma delimited emails
                             notify=True, # Boolean = False(default) send email notification to above two emails
                             sequences=my_seq, # upload sequence
                             )
 
# create_collection returns the result as a string in json format
print result
 
url = obj.get_url(result)
# Visit this url on your web browser
print("\n\nThe url for this collection is: " + url)
  • Click Execute

To view your shared content login to SeedMe.org then navigate to My collections.




To learn more about SeedMe Python API review the example demo.py


Next: Calculating the Flux Though a Surface

Aneurysm Tutorial Index