In [1]:
#%pylab inline

In [2]:
from stack import *

my_stack = load('io_files/saved_stack.txt')

# stack plotting check:
my_stack.plot()
my_stack.plot(show_inversion=True)


/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py:2760: UserWarning: Attempting to set identical bottom==top results
in singular transformations; automatically expanding.
bottom=0.0, top=0.0
  + 'bottom=%s, top=%s') % (bottom, top))

In [3]:
# check eigenmode being correctly solved:
# should get error msg: no emission mode exists here'
lmode = eigenmode('emission',8000.0,1.0,my_stack)

# check incident mode:
pmode = eigenmode('incident',8000.0,1.0,my_stack)
pmode.plot_field(5000)
pmode.plot_intensities()


error: emission mode does not exist at this frequency

In [4]:
# check stack setters and getters:
prange = [700,800]; lrange = [900,1000]
my_stack.set_gainlayers([1,3,5],prange,lrange)
print 'gain layers should be [1,3,5]:', my_stack.get_gainlayers()
print 'p=[700,800],l=[900,1000]:', my_stack.get_ranges('p'),my_stack.get_ranges('l')


gain layers should be [1,3,5]: [1 3 5]
p=[700,800],l=[900,1000]: [[700.0, 800.0]] [[900.0, 1000.0]]

In [5]:
# visual check on population inversion:
my_stack.add_inversion(0,50)
my_stack.add_inversion(1,10)
my_stack.add_inversion(3,20)
my_stack.add_inversion(5,30)
my_stack.add_inversion(-1,40)
my_stack.plot(show_inversion=True)



In [6]:
# checking which_layer function
print map(lambda j: my_stack.which_layer(my_stack.get_location(j) + 10.0),range(my_stack.get_stacksize()))


[0, 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]

In [7]:
# check stack connection function:
my_stack = load('io_files/saved_stack.txt')
my_stack2 = displace(my_stack,0,my_stack.get_location(-1)+500e3)
my_stack2.plot()
my_stack3 = connect(my_stack,my_stack2)
my_stack3.plot()



In [7]: