Difference between revisions of "Seedme"

(Setup your SeedMe Account)
(VisIt [https://www.seedme.org/ SeedMe.org] Integration)
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
= VisIt [https://www.seedme.org/ SeedMe.org] Integration =
 
= VisIt [https://www.seedme.org/ SeedMe.org] Integration =
  
Share your visualizations results easily via the SeedMe python module which is now included in VisIt, starting with version 2.9.0.  
+
[https://www.seedme.org SeedMe.org] provides video encoding (from images), data sharing, description and discussion capabilities that may be convenient for collaboration.
This page provides a short example of how you can use VisIt and the SeedMe python module.
+
VisIt provides two methods to upload content to SeedMe.org
 +
* SeedMe Graphical Widget: Available under File > SeedMe menu (version 2.12.x+)
 +
* SeedMe Python module (version 2.9.0+): Useful for scripting/automation purposes
  
For more examples of how to use Seedme, see the the [https://www.seedme.org/documentation/programmatic-python-usage Seedme Python programatic guide], the examples in [https://bitbucket.org/seedme/seedme-python-client/src/master/demo.py?at=master demo.py] and the [https://www.seedme.org/cli-guide Seedme command line guide].
+
[[Use case for VisIt users]]
  
 +
Creating video such that they will playback on different devices is very cumbersome, as they require different bitrates and codec profiles. SeedMe.org provides this video capability along with sharing for easy collaboration. Furthermore, users are not limited to creating and sharing videos, you may describe each video, and share other relevant data. VisIt integration allows users to add automation via command line, python scripting or sampling using graphical widget may save significant time for sharing your content. Below are simple examples for using SeedMe.org from visit.
  
== Setup your SeedMe Account ==
 
  
*[https://www.seedme.org/user/register Sign-up] at SeedMe.org
+
== Required: Setup your SeedMe Account ==
  
* [https://www.seedme.org/user Download] your ''Web Services Authorization File'', then move it to your [https://www.seedme.org/web-auth-file Home Folder Location].
+
*[https://www.seedme.org/user/register Sign-up] at SeedMe.org. We recommend using CILogon option which enables you to use your institution credentials.
  
== Create and Share Video from an Image Sequence ==
+
*[https://www.seedme.org/user Download] your ''API Key file'', then move it to your [https://en.wikipedia.org/wiki/Home_directory Home directory].
  
This example creates a simple visualization using VisIt and uploads rendered images from this visualization to SeedMe.org to create video from it at desired frame rate. Videos are created at several different resolutions automatically. These may be downloaded, played back on many devices or shared with others easily.
 
  
This script uses 'example.silo' data,  which can be obtained [http://portal.nersc.gov/project/visit/cyrush/sc13/visit_tutorial_data.tar.gz here].
+
== TASK: Create and Share Video from an Image Sequence ==
 +
In this example we create a simple animation using VisIt, then upload the rendered images to SeedMe.org to create video from it at a desired frame rate. Videos are created at several resolutions automatically. These videos may be downloaded or played back on variety of devices including smart phone/tablets or shared with others easily.  
  
To run this example, here are two paths you can take:
 
  
*Open VisIt and make sure 'example.silo' is open and the selected active database.
+
=== SeedMe Graphical Widget Example ===
*Copy and paste this script into an empty tab in VisIt's `Commands` window and click execute.
+
Create an animation image sequence
 +
*[http://portal.nersc.gov/project/visit/cyrush/sc13/visit_tutorial_data.tar.gz Download tutorial_data] and unzip it
 +
*Start VisIt,
 +
*Under wave_data directory open file wave*.silo database
 +
*Add > Psuedocolor > Pressure
 +
*File > Save Movie > New simple movie > Under Choose format | PNG images > Choose filename | set Output directory as desired > Keep all other settings as is
  
 +
Encode video from this image sequence and share it with others
 +
* Peform SeedMe account setup as described above. Your SeedMe APIKey must be in your home folder
 +
* File > SeedMe
 +
* Sharing > Group
 +
* Collection title > Test movie
 +
* Share emails > one@example.com    (use space separated emails)
 +
* Browse > Select all png images that were rendered above
 +
* Submit | This will upload the images and create a video at 10 frames per second and also share it with one@example.com
 +
* Click on the link to open the video in a web browser
 +
OR
 +
* Download video | Available after uploading images. Choose Quality of videos for download. Note: It may take several minutes for videos to be generated and available
 +
 +
Lean more about other options by exploring [https://www.seedme.org/help SeedMe capabilities]
 +
 +
=== SeedMe Python Module Example ===
 +
 +
'''Requirements'''
 +
* Peform SeedMe account setup as described above. Your SeedMe APIKey must be in your home folder
 +
* Download 'example.silo' data from [http://portal.nersc.gov/project/visit/cyrush/sc13/visit_tutorial_data.tar.gz here].
 +
 +
 +
To run this example, you may use one of the following paths:
 +
*Open VisIt and make sure 'example.silo' is open and selected as active database.
 +
*Open Controls > Commands > Copy and paste this script into an empty tab > Click execute.
 
Or
 
Or
 
 
*Save this script as "visit_seedme_post_example.py" and run using:
 
*Save this script as "visit_seedme_post_example.py" and run using:
 
   visit -o example.silo -nowin -cli -s visit_seedme_post_example.py
 
   visit -o example.silo -nowin -cli -s visit_seedme_post_example.py
  
=== Example Script ===
 
 
<source lang="python">
 
<source lang="python">
 
#############################################################################
 
#############################################################################
Line 106: Line 134:
 
aatts.databaseInfoFlag = 0
 
aatts.databaseInfoFlag = 0
 
aatts.legendInfoFlag = 0
 
aatts.legendInfoFlag = 0
satts.displayEndFlag = 1
 
satts.displayEnd = 0
 
 
SetAnnotationAttributes(aatts)
 
SetAnnotationAttributes(aatts)
  
Line 123: Line 149:
 
for ts in range(0,50):
 
for ts in range(0,50):
 
     satts.displayEnd = ts * .5
 
     satts.displayEnd = ts * .5
 +
    satts.displayEndFlag = 1
 
     swatts.fileName = "seedme_streamline_crop_example_%04d.png" % ts
 
     swatts.fileName = "seedme_streamline_crop_example_%04d.png" % ts
 
     SetPlotOptions(satts)
 
     SetPlotOptions(satts)
Line 133: Line 160:
 
# Now publish this sequence to SeedMe
 
# Now publish this sequence to SeedMe
 
#############################################################################
 
#############################################################################
 +
# Silence InsecurePlatformWarning for some Python versions prior to 2.7.9
 +
# Reference https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
 +
#import logging
 +
#logging.captureWarnings(True)
  
 
import seedme
 
import seedme
Line 162: Line 193:
 
my_notify = True
 
my_notify = True
  
 
+
####
# Create a new collection using create_collection() method that
+
# Create a new collection using create_collection() method that uploads all specified contents
#  Uploads all specified contents
+
# Returns a JSON string response with status and collection_id  
#   Returns a JSON string response with status and collection_id  
+
####
 
 
 
result = obj.create_collection(privacy=my_privacy,
 
result = obj.create_collection(privacy=my_privacy,
 
                               sharing=my_list,
 
                               sharing=my_list,
Line 174: Line 204:
 
                               sequences=my_sequence)
 
                               sequences=my_sequence)
  
# Extract collection id from result which may be used to
+
 
#   Update/append content
+
####
#   Query and list content
+
# Extract collection id from result
 +
####
 
my_cid = obj.get_id(result)
 
my_cid = obj.get_id(result)
  
  
# View your collection at
+
# Once we have the collection ID, we may
print ('View your collection at: https://www.seedme.org/node/' + my_cid)
+
#  Update/append content using update_collection() method or other add_* methods
 +
#  Query and list content using query() method
 +
#  Download content using download() method
 +
#  See all methods available at https://www.seedme.org/help/programmatic/python/methods
 +
 
 +
# For example
 +
# Upload another sequence to this collection
 +
# obj.add_sequence(my_cid, filepath='/path/to/*png', title='Another sequence', description=None, fps=30, encode=True)
 +
#
 +
# Upload a single file to this collection
 +
# obj.add_file(my_cid, filepath='/path/to/file', title='A simple file', description=None)
 +
 
  
 +
####
 +
# View your collection using web browser at
 +
####
 +
print ('View your collection using web browser at: https://www.seedme.org/node/' + my_cid)
 +
 +
 +
####
 
# Download the video for the above sequence using download() method
 
# Download the video for the above sequence using download() method
# Note: Video encoding may take few seconds to several minutes,  
+
####
# so we must wait before trying/retrying to download the videos.
+
# Notes: Video encoding may take few seconds to several minutes,  
# You may add a sleep/pause here for some duration
+
#           so we must wait before trying/retrying to download the videos.
 
+
#           You may add a sleep/pause here for some duration.
 +
#            Programmatic download is only supported for Public collections for all files except (sequences)
 +
#            These limitations will be fixed in future.
 +
#            All collections can be viewed and download via web browser
  
 
# download() method parameters
 
# download() method parameters
Line 199: Line 251:
  
  
# Note: Download is currently only supported for Public Collections, also
+
####
# downloading of sequence files is not supported presently, but will be soon.
 
# Private and Group Collections currently require web browser login for viewing/download
 
 
 
 
# Clean up by deleting the seedme object
 
# Clean up by deleting the seedme object
 +
####
 
del obj
 
del obj
  
 
</source>
 
</source>
 +
 +
For more detailed example, see [https://bitbucket.org/seedme/seedme-python-client/src/master/demo.py?at=master demo.py] and the [https://www.seedme.org/help/use/command-line Seedme command line guide].
 +
 +
[[Category: User Documentation]]
 +
[[Category: Scripting]]

Latest revision as of 21:26, 14 November 2016

VisIt SeedMe.org Integration

SeedMe.org provides video encoding (from images), data sharing, description and discussion capabilities that may be convenient for collaboration. VisIt provides two methods to upload content to SeedMe.org

  • SeedMe Graphical Widget: Available under File > SeedMe menu (version 2.12.x+)
  • SeedMe Python module (version 2.9.0+): Useful for scripting/automation purposes

Use case for VisIt users

Creating video such that they will playback on different devices is very cumbersome, as they require different bitrates and codec profiles. SeedMe.org provides this video capability along with sharing for easy collaboration. Furthermore, users are not limited to creating and sharing videos, you may describe each video, and share other relevant data. VisIt integration allows users to add automation via command line, python scripting or sampling using graphical widget may save significant time for sharing your content. Below are simple examples for using SeedMe.org from visit.


Required: Setup your SeedMe Account

  • Sign-up at SeedMe.org. We recommend using CILogon option which enables you to use your institution credentials.


TASK: Create and Share Video from an Image Sequence

In this example we create a simple animation using VisIt, then upload the rendered images to SeedMe.org to create video from it at a desired frame rate. Videos are created at several resolutions automatically. These videos may be downloaded or played back on variety of devices including smart phone/tablets or shared with others easily.


SeedMe Graphical Widget Example

Create an animation image sequence

  • Download tutorial_data and unzip it
  • Start VisIt,
  • Under wave_data directory open file wave*.silo database
  • Add > Psuedocolor > Pressure
  • File > Save Movie > New simple movie > Under Choose format | PNG images > Choose filename | set Output directory as desired > Keep all other settings as is

Encode video from this image sequence and share it with others

  • Peform SeedMe account setup as described above. Your SeedMe APIKey must be in your home folder
  • File > SeedMe
  • Sharing > Group
  • Collection title > Test movie
  • Share emails > one@example.com (use space separated emails)
  • Browse > Select all png images that were rendered above
  • Submit | This will upload the images and create a video at 10 frames per second and also share it with one@example.com
  • Click on the link to open the video in a web browser

OR

  • Download video | Available after uploading images. Choose Quality of videos for download. Note: It may take several minutes for videos to be generated and available

Lean more about other options by exploring SeedMe capabilities

SeedMe Python Module Example

Requirements

  • Peform SeedMe account setup as described above. Your SeedMe APIKey must be in your home folder
  • Download 'example.silo' data from here.


To run this example, you may use one of the following paths:

  • Open VisIt and make sure 'example.silo' is open and selected as active database.
  • Open Controls > Commands > Copy and paste this script into an empty tab > Click execute.

Or

  • Save this script as "visit_seedme_post_example.py" and run using:
  visit -o example.silo -nowin -cli -s visit_seedme_post_example.py
#############################################################################
# file: visit_seedme_post_example.py
#
# note: This script uses 'example.silo' data,  which can be obtained from:
# http://portal.nersc.gov/project/visit/cyrush/sc13/visit_tutorial_data.tar.gz
#
# usage:
# 
#  Make sure 'example.silo' is open and the selected active database.
#  Copy and paste this script into an empty tab in VisIt's `Commands` 
#  window and click execute.
#
# or download as "visit_seedme_post_example.py" and run using:
#  >visit -o example.silo -nowin -cli -s visit_seedme_post_example.py
#
#############################################################################

#############################################################################
# We create an image sequence of cropped streamlines starting with one of 
# the VisIt scripting  tutorials.
# http://visitusers.org/index.php?title=VisIt-tutorial-Python-scripting#Using_all_of_VisIt.27s_Building_Blocks
#############################################################################

# clear any previous plots
DeleteAllPlots()
# Create a plot of the scalar field 'temp'
AddPlot("Pseudocolor","temp")
# Slice the volume to show only three
# external faces.
AddOperator("ThreeSlice")
tatts = ThreeSliceAttributes()
tatts.x = -10
tatts.y = -10
tatts.z = -10
SetOperatorOptions(tatts)
DrawPlots()
# Find the maximum value of the field 'temp'
Query("Max")
val = GetQueryOutputValue()
print "Max value of 'temp' = ", val
# Create a streamline plot that follows
# the gradient of 'temp'
DefineVectorExpression("g","gradient(temp)")
AddPlot("Streamline","g")
satts = StreamlineAttributes()
satts.sourceType = satts.SpecifiedBox
satts.sampleDensity0 = 7
satts.sampleDensity1 = 7
satts.sampleDensity2 = 7
satts.displayMethod = satts.Tubes
satts.coloringMethod = satts.ColorBySeedPointID
satts.referenceTypeForDisplay = satts.Time
SetPlotOptions(satts)
DrawPlots()

#
# To extend this example to create an image sequence,  
# we animate the path of these streamlines.
#

# Setup a better view
ResetView()
v = GetView3D()
v.RotateAxis(0,44)
v.RotateAxis(1,-23)
SetView3D(v)

# Disable annotations
aatts = AnnotationAttributes()
aatts.axes3D.visible = 0
aatts.axes3D.triadFlag = 0
aatts.axes3D.bboxFlag = 0
aatts.userInfoFlag = 0
aatts.databaseInfoFlag = 0
aatts.legendInfoFlag = 0
SetAnnotationAttributes(aatts)

# Setup basic save options
swatts = SaveWindowAttributes()
swatts.family = 0
swatts.format = swatts.PNG 
swatts.width = 1024
swatts.height = 1024


####
# Render cropped streamlines at increasing time values
####
for ts in range(0,50):
    satts.displayEnd = ts * .5
    satts.displayEndFlag = 1
    swatts.fileName = "seedme_streamline_crop_example_%04d.png" % ts
    SetPlotOptions(satts)
    DrawPlots()
    SetSaveWindowAttributes(swatts)
    SaveWindow()
    

#############################################################################
# Now publish this sequence to SeedMe
#############################################################################
# Silence InsecurePlatformWarning for some Python versions prior to 2.7.9
# Reference https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
#import logging
#logging.captureWarnings(True)

import seedme
# Create an object from SeedMe class
obj = seedme.SeedMe()

# Set path for authorization file if not stored in your home folder or renamed. 
# obj.set_auth_via_file('/path/seedme.txt') 

# Now post/upload this image sequence to SeedMe

# Create a dictionary about image sequence as follows
my_sequence = {'filepath': 'seedme_streamline_crop_example_*png', 
# Required, this may be a directory (not read recursively) or wildcard path 
               'title': 'Example Cropped Streamline Paths',  # Recommended
               'fps': '24', # Frame rate for video (default:30) #optional
               'encode': True, # Create video from this sequence (default:False) #optional
              }

# Set privacy of collection as one of private(default), group or public
my_privacy = 'public'


# Emails (comma separated) with whom you wish to share this collection
my_list = 'test1@seedme.org, test2@seedme.org'


# Notify the above people once uploaded (Default: False)
my_notify = True

####
# Create a new collection using create_collection() method that uploads all specified contents
# Returns a JSON string response with status and collection_id 
####
result = obj.create_collection(privacy=my_privacy,
                               sharing=my_list,
                               notify=my_notify,
                               title='VisIt Seedme Example Collection',
                               tags='VisIt',
                               sequences=my_sequence)


####
# Extract collection id from result
####
my_cid = obj.get_id(result)


# Once we have the collection ID, we may 
#   Update/append content using update_collection() method or other add_* methods
#   Query and list content using query() method
#   Download content using download() method
#   See all methods available at https://www.seedme.org/help/programmatic/python/methods

# For example 
# Upload another sequence to this collection
# obj.add_sequence(my_cid, filepath='/path/to/*png', title='Another sequence', description=None, fps=30, encode=True)
# 
# Upload a single file to this collection
# obj.add_file(my_cid, filepath='/path/to/file', title='A simple file', description=None)


####
# View your collection using web browser at
####
print ('View your collection using web browser at: https://www.seedme.org/node/' + my_cid)


####
# Download the video for the above sequence using download() method
####
# Notes: Video encoding may take few seconds to several minutes, 
#            so we must wait before trying/retrying to download the videos.
#            You may add a sleep/pause here for some duration.
#            Programmatic download is only supported for Public collections for all files except (sequences)
#            These limitations will be fixed in future. 
#            All collections can be viewed and download via web browser

# download() method parameters
# cid = Collection ID
# content = one of 'all' or 'video' or wildcard for example *png
# path = path to save the downloaded files
# retry = number of time to retry download. Default: 3
# interval = number of seconds to wait before retry. Default: 60

obj.download(cid=my_cid, content='video', path='~/Desktop', retry=3, interval=120)


####
# Clean up by deleting the seedme object
####
del obj

For more detailed example, see demo.py and the Seedme command line guide.