Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 64 lines (54 sloc) 1.739 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
import sys, os
from movierot import Movie

def brightmax(i):
    """
Smoothly varying brightness with time so that the movie looks good

This version keeps the R band constant, while G and B bands get brighter with time
"""
    return [brightmax0, brightmax0/(1.0+(float(i)/700)**2), brightmax0/(1.0+(float(i)/500)**2)]


# Parse command line arguments
execname = os.path.split(sys.argv[0])[-1]
try:
    runid = sys.argv[1]
    it1 = int(sys.argv[2])
    it2 = int(sys.argv[3])
except (IndexError, ValueError):
    print "Usage: %s RUNID ITIME1 ITIME2 [IDELTA THETA PHI BRIGHTMAX]" % execname
    exit

# Optional orientation arguments
try:
    idelta = int(sys.argv[4])
except (IndexError, ValueError):
    idelta = 1

try:
    th0 = float(sys.argv[5])
    ph0 = float(sys.argv[6])
except (IndexError, ValueError):
    th0, ph0 = 0.0, 0.0

# Optional brightness arguments
# set defaults
brightmax0 = 1.e7
bandscales = [0.2, 1.0e-6, 1.0e-9]
try:
    # 7th arg is scalar: use to set brightmax0
    brightmax0 = float(sys.argv[7])
except IndexError:
    pass
except ValueError:
    try:
        # 7th arg is triplet: use to set bandscales
        bandscales = [float(x) for x in sys.argv[7].split()]
    except ValueError:
        # otherwise, just use defaults
        pass

Movie.emtypes = ["neut00", "PAH000", "FF06cm"]
Movie.bandscales = bandscales
movieid = "evo%+3.3i%+3.3i" % (th0, ph0)
movie = Movie(runid=runid, movieid=movieid,
time=it1, dtime=idelta, frame=it1/idelta,
              nframes=1+(it2-it1)/idelta, verbose=1, force=0)
movie.imageprefix = "rgb-CPF-%s-%s" % (runid, movieid)
movie.brightmaxfunc = brightmax
movie.camera.set_steps(0.0, 0.0)
movie.camera.set_angles(th0, ph0)

movie.makemovie()
Something went wrong with that request. Please try again.