Skip to content

Instantly share code, notes, and snippets.

@maneesh29s
Last active July 7, 2023 05:29
Show Gist options
  • Select an option

  • Save maneesh29s/839cce964c46a8b17363b38bd41f2adb to your computer and use it in GitHub Desktop.

Select an option

Save maneesh29s/839cce964c46a8b17363b38bd41f2adb to your computer and use it in GitHub Desktop.
Compares all fits files in 2 given directories, using `fitsdiff`. `fitsdiff` is available in astropy conda/pip package.
#!/usr/bin/env bash
if [[ $# -ne 2 ]]
then
echo "Usage: $0 first_dir second_dir";
echo "Both inputs are directories containing the FITS images to compare";
exit 1;
fi
first=$1
second=$2
for path in $first/*
do
imageName=`basename $path`
# -k DATE: ignores date
# -q: quite mode, only outputs exit status
# -n 100: will report 100 data differences (image pixel or table element)
fitsdiff -q -n 100 -k DATE $first/$imageName $second/$imageName
if [[ $? -ne 0 ]]
then
echo "fitsfile different: ${imageName}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment