Tag Archive


amateur astronomy awk bash be b[e] supergiant cartoon conference convert exoplanet fedora figaro fits fun galaxy history iraf jupiter latex linux magellanic clouds massive star matplotlib meteor mypaper ondrejov observatory optical paper peblo photometry planet pro-am pyraf python scisoft skinakas observatory small magellanic cloud smc spectroscopy starlink talk theli ubuntu university of crete video x-ray

Fast coordinate conversion with ds9

Fast and easy conversion of a .reg file with image coordinates (x,y positions) to sky coordinates (RA,Dec;sexagesimal):

ds9 image.fits -regions load input_imageCoordinates.reg -regions system wcs -regions skyformat sexagesimal -regions save outout_skyCoordinates.reg -exit

with automatic exit of the program!

Thanks to Alexandros M. for providing some examples!

References:
[1] ds9: http://ds9.si.edu/site/Home.html
[2] ds9 command list: http://ds9.si.edu/ref/command.html

Bash scripting: convert float to integer

As bash is not able to handle floats the best way is to convert a float number (which is represented as a string, for example an output with awk) into an integer.

To do this [1,2]:
float=1.23
int=${float%.*}

Refs:
[1] Stackexchange.com/Unix & Linux
[2] Linuxquestions.org

Gregorian calendar date to Julian Date number

JD = (1461 x (Y + 4800 + (M – 14)/12))/4 + (367 x (M -2 -12 x ((M – 14)/12)))/12 – (3 x ((Y + 4900 + (M – 14)/12)/100))/4 + D – 32075

where JD=julian date number, Y=year, M=month, D=day of month
and valid for JD≥0, date after -4713 November 23.

source:
Cox A.N., “Allen’s Astrophysical Quantities”, New York, Springer-Verlag, 2000 (4rth ed.)

Manipulating postscript/pdf files

Postscript files (.ps) are usual and in many cases some manipulation is needed. [for more see also here]

Convert from a ps to pdf file:
$ ps2pdf input_file.ps output_file.ps

Merge 2 or more files:
$ psmerge -ooutput_file.ps input_file_1.ps input_file_2.ps [more_files]
note: that -o and output_file’s name are not separated by any space

Put more pages per page:
$ psnup [options] -n input_file.ps output_file.ps
[options]: -l , -r which “corrects” for orientation
-n: number of pages from input_file.ps that will be on a single page of output_file.ps (for example -2 for 2 pages/new page, -4 for 4, etc.)

Sexagesimal and radian to degree conversion

A. If you want to convert sexagesimal numbers (RA=hh:mm:ss.s Dec=±dd:mm:ss) to degrees then use these relations:

RA>deg: 15 x (hh + mm/60 + ss.s/3600)
Dec>deg: ±dd ± (mm/60 + ss/3600)

These relations are pretty easy to remember since
> 1 hour the sky rotates 15 degrees (360degrees in 24 hours)
> 1 minute = 60 seconds
> 1 hour = 60 minutes = 60 seconds
> Caution with Dec: when Dec is positive you add the rest while when it is negative you subtract.

B. For radians to degrees conversion use the relation:

radians x 180o / π