ALSVID is a package for command line processing of FITS images. It
includes other utilities also useful in astronomical and science data
processing.  

Release 5.9 includes programs to work with data from the TESS satellite.  They
address the implementation of BINTABLES for storage of image slices, and of
extended headers on full frame images that present difficulties for simple
processing.  Routines to query TESS and Gaia databases are also available.  The
code files explicitly for TESS are in a separate source directory


===


Alsvid is not a library.  It is a collection of routines that are tested and have
been useful to us.  They maybe used as is, or they may be templates for versions
that are more suitable for your uses.


The most recent version is available from 

http://www.astro.louisville.edu/software/alsvid

These programs will run on any operating system with Python 3 and where
needed, Julia 1.5 or higher. 


For Python, Linux systems will usually have the Python core (Version >=3.8
tested) available.    As root user, use "pip" to add the other packages not
provided by the OS  distribution.  Alternatively, install your own Python from
source on Linux, by making it independent of the system and therefore more
easily self-maintained. A packaged  distribution such as Anaconda
is the standard  practice for scientific computing on Windows or OSX. 

https://www.python.org/downloads/

https://www.anaconda.com/products/individual 

Packages in addition to the base Python that are recommended or required are

  dateutil
  matplotlib with tkinter
  plotly
  numpy 
  scipy
  scikit-image
  astropy
  pyastronomy
  OpenEXR
  astropy
  skyfield

These are provided by the distributions, and will  be pulled in 
as needed when you use "pip" to install one that does not have its dependencies.
 
For Julia, Linux distributions usually supply the stable 1.1 release at this time.  
A more recent version, such as 1.6 may be obtained from either

https://julialang.org/
https://juliacomputing.com/products/juliapro/

Juliapro provides a supportive development environment but it requires registration.

Alsvid works in conjunction with any camera or visualization software that 
produces FITS image files.  It does not require IRAF or IDL, and in many cases
will replace those environments with a system that is simple to implement with
modern Linux, Windows, or MacOS computing.  Furthermore, Alsvid allows scripted
operation and is suitable for server-side web-based applications.

For a graphical user interface with validated and versatile photometry, 
consider AstroImageJ in addtion to Alsvid.  AIJ provides real-time photometry
and includes the image processing code of ImageJ as well. It is suitable for a 
variety of astronomical image applications that require user interaction. 
Alsvid also supports region selection to and from AIJ and ds9.  Where possible,
Alsvid parallels in Python the underlying algorithms of AIJ, and provides added capability.
 
Usage help for Alsvid routines  is given in response  to a command line execution 
without arguments. If in doubt, read the source code which is heavily commented 
and easily modified for other uses.



ALSVID Python utilities for working with FITS images and data
=============================================================
                                                                                                              
  fits_1d_to_dat.py                              Extract a 1-dimensional FITS array as data
  fits_absolute_value.py                         Absolute value of an image
  fits_add_datetime.py                           Add a date and time to a FITS file header
  fits_add_filter_to_filename.py                 Add the filter id to the file name
  fits_add_instrument.py                         Add an instrument to the FITS file header
  fits_autocorrelate.py                          Create a stack of autocorrelated images from stack of  fits images
  fits_background_remove.py                      Fit and subtract a background
  fits_bias.py                                   Subtract a bias frame
  fits_bin_1d.py                                 Bin a stack of images along the time or z-axis
  fits_bin_2d.py                                 Bin nxn each image in a stack
  fits_border.py                                 Zero values outside borders
  fits_clean_head.py                             Clean all but essential items from the header
  fits_clip.py                                   Clip an image at minimum and maximum values          
  fits_convert.py                                Convert an image from one type to another
  fits_convolve_gaussian.py                      Convolve an image with a Gaussian blur
  fits_copy_header.py                            Copy header from one fits file to another
  fits_correlate.py                              Create a correlation stack from a temporal stack of  fits images
  fits_crop_all.py                               Crops fits all files in a directory  to m x n starting at x y
  fits_crop.py                                   Crops a single fits file to m x n starting at x y
  fits_dark.py                                   Subtract a dark frame from an image
  fits_derivative.py                             Create a derivative stack from a temporal stack of FITS images
  fits_divide.py                                 Divide one FITS file by another
  fits_edit_head.py                              Edit the FITS header
  fits_fft_2d.py                                 Create a stack of 2D Fourier Transformed images from a stack of  fits images
  fits_fft.py                                    Create a frequency stack from a temporal stack of FITS images
  fits_fft_test.py                               Template to generate test stack for fits_fft.py
  fits_find_stars.py                             Find stars in an image
  fits_fix_col.py                                Repair a bad column
  fits_flat.py                                   Divide an image by a flat frame                      
  fits_flip_lr.py                                Flip an image left-right
  fits_flip_ud.py                                Flip an image up-down
  fits_from_exr.py                               Create RGB FITS files from a 16-bit color EXR file
  fits_from_png.py                               Convert a PNG file to a FITS file
  fits_from_pngs.py                              Convert PNG files to a FITS file
  fits_from_raster.py                            Built a FITS file from a stack of 1d raster data files
  fits_from_raw_dslr.py                          Extract R, B, and B fits images from a RAW Canon, Nikon, or Sony image
  fits_from_text.py                              Create a FITS image from a text file
  fits_from_tifs.py                              Generate FITS images from TIF files
  fits_histogram.py                              Export a histogram for an image
  fits_level.py                                  Fit and remove a plane gradient 
  fits_list_date-obs.py                          List the dates of observation for all files in a directory
  fits_list_date.py                              List the file dates from the FITS headers of all files in a directory
  fits_list_exposure.py                          List all exposures for FITS files in a directory
  fits_list_head_entry.py                        List all the values for a header entry searching files in a directory
  fits_list_head.py                              List the FITS header for a file
  fits_list_head_to_csv.py                       Make a CSV file of  the FITS headers for all files in a directory
  fits_lucy_richardson.py                        Peform interative Lucy-Richardson deconvolution using a Gaussian PSF on a FITS image file
  fits_make_threshold_mask.py                    Create a mask by setting threshold levels 
  fits_mask.py                                   Mask regions from a FITS image
  fits_mast_to_dat.py                            Extract data from MAST spectral fits table file 
  fits_mean.py                                   Take the mean of several images
  fits_median_1d.py                              Take the median of several images
  fits_median_2d.py                              Median filter 3x3 all images in a stack
  fits_mef_to_fits_images.py                     Extract individual FITS images from a Multi-Extension file
  fits_multiply.py                               Multiply two FITS images of the same size
  fits_nan_to_num.py                             Change "NAN" elements to numbers
  fits_norm.py                                   Normalize an image
  fits_nstats.py                                 Statistics on a stack of images
  fits_phoenix_hires_to_dat.py                   Extract spectra from a PHOENIX model
  fits_pixel_photometry.py                       Aperture photometry on an image from pixel coordinates
  fits_pixel_to_wcs_photometry.py                Aperture photometry from pixel coordinates outputing sky coordinates
  fits_pix_to_ds9.py                             Convert an x,y list to ds9 regions
  fits_pix_to_sky.py                             Convert an x,y list to a WCS ra,dec list                     
  fits_radial_average.py                         Take an average assuming circular symmetry
  fits_rd.py                                     Create a random decrement autocorrelation  stack from a temporal stack of FITS images
  fits_relative_transients.py                    Identify relative transient events in an otherwise static image stack
  fits_remove_stars.py                           Use a pixel x,y list to remove stars from an image
  fits_remove_stars_with_psf.py                  Remove stars and replace based on a model point spread function
  fits_roll.py                                   Rolls and wraps by dx and dy within the same image size
  fits_rotate_90.py                              Rotate an image in 90 degree increments          
  fits_rotate.py                                 Rotate an image an arbitrary angle
  fits_scaled_dark.py                            Dark subtraction scaling exposure time
  fits_scale.py                                  Quadratically scale image data
  fits_sigma.py                                  Create a standard deviation (sigma) image from a stack of fits images
  fits_signal_autocorrelate.py                   Create a stack of autocorrelated images from stack of  fits images using scipy signal
  fits_sky_radec_to_aij.py                       Convert an RA Dec AstroImageJ file to a an AIJ x,y apertures file                 
  fits_sky_to_aij.py                             Create AIJ x,y apertures from a sky ra,dec list
  fits_sky_to_ds9.py                             Create ds9 x,y regions from a sky ra,dec list
  fits_sky_to_pix.py                             Create plain x,y text from ra,dec
  fits_sliding_median.py                         Perform a sliding median smoothing to an image stack
  fits_sqrt.py                                   Create a new image that is a square root of the input image
  fits_stats.py                                  Statistics on a single image
  fits_subtract.py                               Subtract two FITS images of the same size
  fits_sum_centered.py                           Center and sum an image stack
  fits_sum_cols.py                               Sum selected columns (for spectra)
  fits_sum.py                                    Sum an image stack
  fits_sum_region.py                             Sum over a region bounded by rows and columns
  fits_sum_rows.py                               Sum selected rows (for spectra)
  fits_to_float32.py                             Convert an integer (or other) FITS image to 32-bit float image removing the pedestal if any
  fits_to_lin_png.py                             Create a linear 16-bit gray-scale png
  fits_to_log_png.py                             Create a logarithmic 16-bit gray-scale png 
  fits_to_tiles.py                               Generate a stack of tiled png files for web display of large images
  fits_unmask.py                                 Unmask regions from a FITS image
  fits_viewer.py                                 View a FITS image in Python GUI
  fits_wcs_photometry.py                         Aperture photometry from sky coordinates  



ALSVID Python utilities 
========================

  aij_table_reader.py                            Read an AIJ data table
  bls_astropy_bokeh.py                           BLS search of data with bokeh plot output
  decimal_deg_to_dms.py                          Convert decimal degrees to dd:mm:ss.sss
  decimal_radeg_to_hms.py                        Convert decimal RA in degrees to hh:mm:ss.sss
  dms_to_decimal.py                              Convert ddd:mm:ss to decimal
  file_renumber.py                               Renumber files sequentially
  jd.py                                          Provide the Julian day now
  lomb_scargle_astropy.py                        Lomb Scargle search using astropy code
  lomb_scargle_scipy.py                          Lomb Scagle search using scipy code
  lst.py                                         Provide the local sidereal time now
  moon.py                                        Position and phase of the Moon now and a list for other JD's
  plotly_data.py                                 Plot an x,y data file interactively with Plotly
  process_fits.py                                Batch process raw data in a directory based on a configuration file.
  query_mast_gaia_to_csv.py                      Query MAST for Gaia stars around a target 
  query_simbad_to_aij.py                         Query Simbad for to produce AstroImageJ apertures
  sliding_median_normalize.py                    Normalize a data file with a sliding median
  spectrum_airtovac.py                           Convert spectral 2-column wavelength, flux file from air to vacuum wavelengths
  spectrum_crosscorr.py                          Cross correlate target and template spectra to find the radial velocity of the target
  spectrum_heliovel.py                           Return the barycentric velocity correction accounting for the topocentric motion of the observer 
  spectrum_rotbroad.py                           Broaden a stellar template spectrum with a model of vsini and linear limb darkening
  spectrum_thermal.py                            Compute a black body spectrum at requested temperature
  spectrum_vactoair.py                           Convert spectral 2-column wavelength, flux file from vacuum to air wavelengths
  sun.py                                         Position of the Sun now and a list for other JD's           
  tiles_from_png.py                              A companion to fits_to_tiles.py taking a png file as input
  tk_plot_3d.py                                  Plot x,y,x data interactively with a Tk interface
  tk_plot.py                                     Plot x,y data interactively with a Tk interface
  tk_query_mast_edr3_to_aij_radec.py             Query MAST for Gaia EDR3 stars around a target and export AIJ apertures with Tk interface             
  unix_time_from_date.py                         Return Unix time from a data and time
  unix_time.py                                   Current unix time
  utc.py                                         Current universal time
  


ALSVID for TESS data processing
===============================  

  ffi_for_fft.py                                 Prepare a time series image stack for temporal FFT
  fits_clean_up_ffi.py                           Remove all low DATAQUALITY TESS FFI's and empty FITS files from the current directory 
  fits_detrend_sliding_median.py                 Detrend an image stack with a sliding median             
  fits_detrend_sliding_minimum.py                Detrend an image stack with a sliding minimum 
  fits_extract_tess_background.py                Extract background from  a stack of TESS fits images
  fits_extract_tess_cutout_images.py             Extact a simple stack of FITS images from a TESS cutout BINTABLE file
  fits_extract_tp_images.py                      Extract a simple stack of FITS images from a TESS fast cadence TIC pixel file
  fits_ffi_to_simple_images.py                   Simply full frame TESS images by removing all  but the image  and its header
  fits_find_tess_annulus_background.py           Find the background of a TESS FFI images
  fits_level_by_column.py                        Remove median bias for column noise
  fits_list_xhead_entry.py                       List all values of  entry in the first extended FITS header for a directory
  fits_list_xhead.py                             List the entire first extended header for a FITS file 
  fits_relative_transients.py                    Identify relative transient events in an otherwise static image stack
  fits_remove_tess_background.py                 Remove background from  a stack of TESS fits images
  query_mast_gaia_to_csv.py                      Search a field for Gaia stars and generate a database
  query_mast_tic_to_csv.py                       Search a field for TIC stars and generate a database
  query_simbad_to_aij.py                         Convert an object named on the command line to an AIJ aperture format file
  query_tic_to_aij.py                            Search a 2.5 arcminute field for TIC stars and generate an AIJ aperture file
  tk_query_mast_edr3_to_aij_radec.py             Use a Tk interface to search Gaia EDR3 for nearby stars and generate an AIJ aperture file
  tk_query_mast_tic_to_aij_radec.py              Use a Tk interface to search TIC for nearby stars and generate an AIJ aperture file
  tls.py                                         Transit least squares model from  time-series data
  transitmodel.py                                Create a model for transit photometry and compare to an observation            


  
  
