34 lines
692 B
Python
Executable File
34 lines
692 B
Python
Executable File
#! /usr/bin/env python
|
|
|
|
"""
|
|
Plot the t=0 density expectation value in Lieb-Liniger (n-hole wavepacket).
|
|
|
|
Setup:
|
|
- ensure matplotlib and numpy are installed in your python environment
|
|
- make this file executable (chmod +x plot_to.py)
|
|
|
|
Usage: ./plot_t0.py [rho file name]
|
|
"""
|
|
|
|
|
|
import math
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
import sys
|
|
|
|
filename = str(sys.argv[1])
|
|
|
|
x = np.loadtxt(filename.replace('.rhoxt','.x'), unpack=True)
|
|
|
|
rho = np.loadtxt(filename, usecols=(0), unpack=True)
|
|
|
|
plt.plot(x, rho, '.', markersize=4)
|
|
|
|
plt.xlabel('x')
|
|
plt.ylabel(r'$\rho(x, t=0)$')
|
|
plt.title('Density expectation value\n' + filename)
|
|
|
|
plt.savefig(filename.replace('.rhoxt', '.png'))
|
|
|
|
plt.show()
|