Other ACID Functions
This page outlines some of the additional functions available in ACID outside of the main ACID functions, some of which were highlighted in the Quickstart tutorial.
Continuing sampling
If you wish to continue sampling the MCMC after the initial run of ACID, you can do so using the :py:function:`ACID_code.Result.continue_sampling` method. This method takes the same keyword arguments as the nsteps argument in ACID, allowing you to specify how many additional steps to run.
import ACID_code as acid
result = acid.Result.load_result('example_result.pkl')
# Continue sampling for an additional 2000 steps
result.continue_sampling(nsteps=2000)
# You can then plot the updated walkers and corner plots
result.plot_walkers()
result.plot_corner()
This allows you to extend the MCMC sampling if you feel that the initial number of steps was insufficient for convergence.
Note again that if multiple orders or frames were calculated, this method must be called from the ACID_code.Result object returned by ACID,
not from a saved .pkl file.
Performing LSD directly
The ACID package can perform traditional LSD with a standalone LSD class. This can be useful for comparison to ACID results or for quick-look analysis. The class is used internally throughout the ACID package. The LSD class can be used as an example as follows:
import ACID_code as acid
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
spec_file = fits.open('example/sample_spec_1.fits')
wavelength = spec_file[0].data # Wavelengths in Angstroms
spectrum = spec_file[1].data # Spectral Flux
error = spec_file[2].data # Spectral Flux Errors
sn = spec_file[3].data # SN of Spectrum
linelist = 'example/example_linelist.txt' # Insert path to line list
# choose a velocity grid for the final profile(s)
deltav = acid.calc_deltav(wavelength)
velocities = np.arange(-25, 25, deltav)
# Initiate LSD class
LSD = acid.LSD() # Can be initiated with an instance of :py:class:`ACID_code.Acid`
# Perform LSD
LSD.run_LSD(wavelength, spectrum, error, sn, linelist, velocities)
# Extract useful attributes
profile = LSD.profile
profile_errors = LSD.profile_errors
# Example plot
plt.errorbar(velocities, LSD.profile, yerr=LSD.profile_errors, ecolor='red')
plt.title('LSD Profile')
plt.xlabel('Velocity (km/s)')
plt.ylabel('LSD Profile Value')
plt.show()
See the ACID_code.LSD API for more information on available methods and attributes.