Commit 2580a788 authored by Vigeesh Gangadharan's avatar Vigeesh Gangadharan
Browse files

Merge branch 'typo_fixes'

parents 58fa7d65 0bada30e
Pipeline #2331 passed with stage
in 2 minutes and 47 seconds
......@@ -2,7 +2,8 @@
image: 'continuumio/miniconda3:latest'
.before_script_linux: &before_script_linux
- apt-get -qq update && apt-get -qq install -y make
- apt-get update --fix-missing
- apt-get -qq install -y make
- conda create -n gris_inv -c conda-forge mpi4py numpy scipy gfortran_linux-64 lapack matplotlib
- conda init bash
- source ~/.bashrc
......
......@@ -193,7 +193,7 @@ def vfisv(
inv_data : dict of numpy arrays
The dict contains the following variables
S0+S1,
vel_los, inclination, azimuth, field_strength and the corresponding uncertainities
vel_los, inclination, azimuth, field_strength and the corresponding uncertainties
chi_square.
stokes_data : dict of numpy arrays
......@@ -306,22 +306,6 @@ class FitsCardGroup:
self.cardlist = cardlist
self.header = None
def add_card(self, card):
"""
Parameters
----------
card : str
a fits keyword
Returns
-------
empty fits card with the keyword
"""
fitscard = fits.Card(card, None, "")
return fitscard
def to_header(self):
"""
......@@ -339,7 +323,7 @@ class FitsCardGroup:
for card in self.cardlist:
if card != "HISTORY":
self.header.append(self.add_card(card), end=True)
self.header.append(fits.Card(card, None, ""), end=True)
return self.header
......@@ -434,10 +418,6 @@ def get_stokes_fits(data, vfisv_params):
array from vfisv containing all the data
vfisv_params :
the vfisvpackage class instance that holds all the params
index : int
the index of the desired variable based on VFISV manual
units :
the astropy.units that should be assigned to the data
Returns
-------
......@@ -646,11 +626,11 @@ def write_fits(data, header, out, errors=None):
out : str
Output filename
errors : str
Output filename for uncertainities
Output filename for uncertainties
"""
if errors == None:
if errors is None:
print(termcolors.text + f"\nWriting results to {out}" + termcolors.end, end="")
# header.comments['NAXIS1'] = 'Length of data axis 1'
......@@ -675,7 +655,7 @@ def write_fits(data, header, out, errors=None):
# adding the description
hdu.header["BTYPE"] = vfisv_naming[iquant]["annotate"]
# adding the unit of the qauntity
# adding the unit of the quantity
hdu.header["BUNIT"] = str(vfisv_naming[iquant]["unit"])
# append the hdu in the list
......@@ -689,10 +669,10 @@ def write_fits(data, header, out, errors=None):
out, overwrite=True, output_verify="silentfix+exception", checksum=True
)
if errors == None:
if errors is None:
print(termcolors.text + ". " + termcolors.okay + "Done.\n" + termcolors.end)
if errors != None:
if errors is not None:
hdu_list = []
for iquant in vfisv_errors_naming:
......@@ -710,7 +690,7 @@ def write_fits(data, header, out, errors=None):
# adding the description
hdu.header["BTYPE"] = vfisv_errors_naming[iquant]["annotate"]
# adding the unit of the qauntity
# adding the unit of the quantity
hdu.header["BUNIT"] = str(vfisv_errors_naming[iquant]["unit"])
# append the hdu in the list
......@@ -1144,7 +1124,7 @@ def plot_image(
----------
data : dict of numpy arrays
The dict contains the following variables
Continnum_I, vel_los, inclination, azimuth, field_strength
Continuum_I, vel_los, inclination, azimuth, field_strength
header : object
Astropy fits header
preview : str
......@@ -1162,7 +1142,7 @@ def plot_image(
cfmt : str
colorbar label format
cticks : list
colobar ticks
colorbar ticks
"""
......@@ -1261,7 +1241,7 @@ def correct_field(data, unit_data, unit_vmax, cticks, cfmt):
# change the maximum if the max is less than the default
unit_vmax = (
np.max(unit_data.value)
if (unit_vmax != None) and (unit_vmax > np.max(unit_data.value))
if (unit_vmax is not None) and (unit_vmax > np.max(unit_data.value))
else unit_vmax
)
# if the field strength is large then round the max and use matplotlib ticks
......@@ -1284,7 +1264,7 @@ def correct_field(data, unit_data, unit_vmax, cticks, cfmt):
def convert_units(data, vmin, vmax):
"""Convert the units of data based on vmin/vmax"""
if vmax == None:
if vmax is None:
# if vmax is not provided with a unit
unit_data = data
unit_vmin = vmin
......@@ -1320,7 +1300,7 @@ def merge_to_gif(filelist, outfile):
def switch_coordinates(lon, lat, canvas):
"""in case the the labels are nor proper, switch the axis"""
# Check if the left or the bottom labels are drwan.
# Check if the left or the bottom labels are drawn.
# If not, then this is possibly due to slit aligned horizontally.
if ("l" not in lat.ticklabels.text) or ("b" not in lon.ticklabels.text):
lon.set_ticks_position("l")
......@@ -1423,7 +1403,7 @@ def create_preview(data, header, preview):
# velocity calibration for preview images only
if iquant == "vlos":
# setting a magnetic field mask of 1000 Guass.
# setting a magnetic field mask of 1000 Gauss.
mag_mask = data["bmag"].value < 1000.0
quant_data -= np.mean(quant_data[mag_mask])
......@@ -1459,7 +1439,7 @@ def write_log_file(log, header, data, stokes, total_time, numproc):
header : object
Astropy header object
data : dict of numpy arrays
Array containing the inversion results and uncertainities
Array containing the inversion results and uncertainties
stokes : dict of numpy arrays
Array containing the stokes vector and fits
total_time : float
......@@ -1496,7 +1476,7 @@ def write_log_file(log, header, data, stokes, total_time, numproc):
f.write(f"Number of processors : {numproc}\n")
f.write(f"Total profiles inverted : {data['vlos'].size}\n\n")
# Some info about the uncertainities
# Some info about the uncertainties
f.write(f"Mean chi_sqr : {data['chsq'].value.mean():5.2f}\n")
f.write(f"Best chi_sqr : {data['chsq'].value.min():5.2f}\n")
f.write(f"Worst chi_sqr : {data['chsq'].value.max():5.2f}\n")
......@@ -1597,7 +1577,8 @@ class VFISVpackage:
self.LY = self.header["NAXIS2"] # Length of the slit
self.LZ = 16 # VFISV data structure
def get_line_list(self):
@staticmethod
def get_line_list():
"""Get the list of available lines"""
line_list = (
pkgutil.get_data("grisinv", os.path.join("data_files", "line_names.csv"))
......@@ -1762,10 +1743,10 @@ class VFISVpackage:
),
)
# Set the pix continnum to pix_ini
# Set the pix continuum to pix_ini
self.pix_cont = self.pix_ini
# Set the start of the wavelenght array for
# Set the start of the wavelength array for
self.wave_start = wave_array[self.pix_ini]
else:
......@@ -1923,7 +1904,7 @@ class VFISVpackage:
@click.option("-l", "--line", type=float, help="Wavelength of the line Angstrom")
@click.option("-w", "--width", type=float, help="Wavelength range in Angstrom")
@click.option("--preview", type=str, help="Filename to save the plot")
@click.option("--errors", type=str, help="Filename to save the uncertainities")
@click.option("--errors", type=str, help="Filename to save the uncertainties")
@click.option("--diagnose", type=str, help="Filename to write the inversion fits")
@click.option("--log", type=str, help="Filename to write the log file")
def main(path, id, out, numproc, line, width, preview, errors, diagnose, log):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment