Skip to content

Commit

Permalink
docstrings corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi0395 committed Aug 7, 2024
1 parent ea57c41 commit 7dffcd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion qsoabsfind/absfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def read_single_spectrum_and_find_absorber(fits_file, spec_index, absorber, **kw
and METADATA which must contain keyword Z_QSO.
spec_index (int): Index of the quasar spectrum to retrieve from the FITS file.
absorber (str): Name of the absorber to search for (e.g., 'MgII', 'CIV').
kwargs (dictionary): search parameters as defined in constants.py
kwargs (dict): search parameters as described in qsoabsfind.constants()
Returns:
tuple: Contains lists of various parameters related to detected absorbers.
Expand Down
4 changes: 2 additions & 2 deletions qsoabsfind/parallel_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run_convolution_method_absorber_finder_QSO_spectra(fits_file, spec_index, ab
fits_file (str): Path to the FITS file containing Normalized QSO spectra.
spec_indices (list or numpy.array): Indices of quasars in the data matrix.
absorber (str): Absorber name for searching doublets (MgII, CIV). Default is 'MgII'.
kwargs (dictionary): search parameters as described in qsoabsfind.constants()
kwargs (dict): search parameters as described in qsoabsfind.constants()
Returns:
tuples containing detected absorber details
Expand Down Expand Up @@ -80,7 +80,7 @@ def parallel_convolution_method_absorber_finder_QSO_spectra(fits_file, spec_indi
spec_indices (list or numpy.array): Indices of quasars in the data matrix.
absorber (str): Absorber name for searching doublets (MgII, CIV). Default is 'MgII'.
n_jobs (int): Number of parallel jobs to run.
kwargs (dictionary): search parameters as defined in constants.py
kwargs (dict): search parameters as described in qsoabsfind.constants()
Returns:
dict: A dictionary containing combined results from all parallel runs.
Expand Down
17 changes: 10 additions & 7 deletions qsoabsfind/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@ def vel_dispersion(c1, c2, sigma1, sigma2, resolution):

def plot_absorber(spectra, absorber, zabs, show_error=False, xlabel='obs wave (ang)', ylabel='residual', title='QSO', plot_filename=None):
"""
Saves a plot of spectra with absorber(s) (full spectrum + zoomed version)
in the current working directory.
Saves a plot of spectra with absorber(s) (full spectrum + zoomed version) along
with its Gaussian fit in the current working directory or in the user-defined
directory.
Args:
spectra (object): spectra class, output of QSOSpecRead()
Expand Down Expand Up @@ -419,7 +420,9 @@ def plot_absorber(spectra, absorber, zabs, show_error=False, xlabel='obs wave (a
current_dir = os.getcwd()

# Define the full path for the plot
plot_path = os.path.join(current_dir, plot_filename)
plot_path = plot_filename
if not os.path.isabs(plot_filename):
plot_path = os.path.join(current_dir, plot_filename)

# Save the plot
plt.savefig(plot_path)
Expand All @@ -434,12 +437,12 @@ def read_nqso_from_header(file_path, hdu_name='METADATA'):
"""
Read the NAXIS2 value from the header of a specified HDU in a FITS file.
Parameters:
- file_path: str, path to the FITS file.
- hdu_name: str, name of the HDU from which to read NAXIS1 (default: 'METADATA').
Args:
file_path: str, path to the FITS file.
hdu_name: str, name of the HDU from which to read NAXIS1 (default: 'METADATA').
Returns:
- naxis2_value: int, value of NAXIS2 from the specified HDU header.
naxis2_value: int, value of NAXIS2 from the specified HDU header.
"""
# Check if the file exists
if not os.path.isfile(file_path):
Expand Down

0 comments on commit 7dffcd4

Please sign in to comment.