Artist Tests
%matplotlib inline
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
import numpy as np
from leveldiagram.artists import Coupling, EnergyLevel
import leveldiagram as ld
Level Tests
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((0,10))
ax.set_ylim((0,10))
x = np.linspace(0,25,151)
y = np.sin(x)
lev = EnergyLevel(5, 2, 1,
r'$\left|n\mathrm{D}_{5/2}\right\rangle$', 'left', 'top', 'bottom',
color='b',alpha=0.8,linestyle='-', lw=2)
ax.add_line(lev)
ax.set_aspect('equal')
Coupling Tests
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((18,38))
ax.set_ylim((-2,2))
ax.add_line(Coupling((20,0),(20+15.81,0),1,color='r',alpha=0.25,linestyle='-', tail=False, arrow_kw={'ec':'none'},
label=r'$|n\mathrm{P}_{3/2}\rangle$', label_offset='center', label_kw={'rotation_mode':'default'}))
ax.set_aspect('equal')
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((5,40))
ax.set_ylim((-12,16))
ax.add_line(Coupling((20,0),(15,15),1,color='b',alpha=0.8,linestyle='-', arrow_kw={'ec':'none'},
label='Blue', label_offset='left', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0),(25,15),1,color='g',alpha=0.6,linestyle='-',
label='Couple', label_offset='right', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0),(20+15.81,0),1,color='r',alpha=0.5,linestyle='-', arrow_kw={'ec':'none'},
label=r'$|n\mathrm{P}_{3/2}\rangle$', label_offset='center', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (10,0), 1, color='m', alpha=0.5, linestyle='-',
label=r'$\Omega$', label_offset='center', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (20,-10), 1, tail=True, color='C0', alpha=0.5, linestyle='-', arrow_kw={'ec':'none'},
label=r'$\Gamma$', label_offset='center', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (25,-10), 1, tail=True, color='C1', alpha=0.5, linestyle='-',
label='Probe', label_offset='right', label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (15,-10), 1, tail=True, color='C2', alpha=0.5, linestyle='-', arrow_kw={'ec':'none'},
label='Dress', label_offset='center', label_kw={'rotation_mode':'default'}))
ax.set_aspect('equal')
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((5,40))
ax.set_ylim((-12,16))
ax.add_line(Coupling((20,0),(15,15),1,color='b',alpha=0.8,linestyle='-',
label='Blue', label_offset='left', label_rot=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0),(25,15),1,color='g',alpha=0.6,linestyle='-',
label='Couple', label_offset='right', label_rot=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0),(20+15.81,0),1,color='r',alpha=0.5,linestyle='-',
label=r'$|n\mathrm{P}_{3/2}\rangle$', label_offset='center', label_rot=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (10,0), 1, color='m', alpha=0.5, linestyle='-',
label=r'$\Omega$', label_offset='center', label_rot=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (20,-10), 1, tail=True, color='C0', alpha=0.5, linestyle='-',
label=r'$\Gamma$', label_offset='center', label_rot=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (25,-10), 1, tail=True, color='C1', alpha=0.5, linestyle='-',
label='Probe', label_offset='right', label_rot=True, label_flip=True, label_kw={'rotation_mode':'default'}))
ax.add_line(Coupling((20,0), (15,-10), 1, tail=True, color='C2', alpha=0.5, linestyle='-',
label='Dress', label_offset='left', label_rot=True, label_flip=True, label_kw={'rotation_mode':'default'}))
ax.set_aspect('equal')
Wavy Coupling Tests
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((0,40))
ax.set_ylim((-20,20))
x = np.linspace(0,25,151)
y = np.sin(x)
ax.add_line(Coupling((20,0),(15,15),2,
arrowratio=2,
waveamp=0.5,halfperiod=1,
color='b',alpha=0.8,linestyle='-', label=r'$\Gamma$'))
ax.add_line(Coupling((20,0),(25,15),2,
waveamp=0.5,halfperiod=1,
color='g',alpha=0.6,linestyle='-'))
ax.add_line(Coupling((20,0),(15,-15),2,
arrowratio=2,
waveamp=0.5,halfperiod=1,
color='b',alpha=0.8,linestyle='-'))
ax.add_line(Coupling((20,0),(25,-15),2,
waveamp=0.5,halfperiod=1,
color='g',alpha=0.6,linestyle='-', label='Test'))
ax.add_line(Coupling((20,0),(20+15.81,0),2,
waveamp=0.5,halfperiod=1,
color='r',alpha=0.5,linestyle='-', arrow_kw={'ec':'none'}))
ax.add_line(Coupling((20,0), (10,0), 2,
waveamp=0.5,halfperiod=1,
color='m', alpha=0.5, linestyle='-'))
ax.add_line(Coupling((20,0), (20,-20), 2,
waveamp=0.5,halfperiod=1,
color='m', alpha=0.5, linestyle='-'))
ax.set_aspect('equal')
Elliptic Wavy Coupling Tests
plt.close('all')
fig, ax = plt.subplots(1)
ax.set_xlim((0,40))
ax.set_ylim((-20,20))
x = np.linspace(0,25,151)
y = np.sin(x)
ax.add_line(Coupling((20,0),(15,15),2,
deflection=2,
arrowratio=2,
waveamp=0.5,halfperiod=1,
color='b',alpha=0.8,linestyle='-', label=r'$\Gamma$'))
ax.add_line(Coupling((20,0),(25,15),2,
deflection=3,
color='g',alpha=0.6,linestyle='-'))
ax.add_line(Coupling((20,0),(15,-15),2,
deflection=2,
arrowratio=2,
waveamp=0.5,halfperiod=1,
color='b',alpha=0.8,linestyle='-'))
ax.add_line(Coupling((20,0),(25,-15),2,
deflection=6,
tail=True,
color='g',alpha=0.6,linestyle='-', label='Test'))
ax.add_line(Coupling((20,0),(20+15.81,0),2,
deflection=4,
waveamp=0.5,halfperiod=1,
color='r',alpha=0.5,linestyle='-', arrow_kw={'ec':'none'}))
ax.add_line(Coupling((20,0), (10,0), 2,
deflection=-4,
waveamp=0.5,halfperiod=1,
color='m', alpha=0.5, linestyle='-'))
ax.add_line(Coupling((20,0), (20,-20), 2,
deflection=-3,
color='m', alpha=0.5, linestyle='-'))
ax.set_aspect('equal')
ld.about()
leveldiagram
====================
leveldiagram Version: 0.2.0
Dependencies
====================
Python Version: 3.10.8
NumPy Version: 1.23.4
Matplotlib Version: 3.5.3
NetworkX Version: 2.8.4