Log in

View Full Version here: : [Solved] Algorithm wanted


DavidLJ
27-05-2012, 11:23 AM
Spherical geometry is not my strong point. I'm looking for an algorithm that will calculate the span (i.e. width as measured in seconds of RA) of a camera frame on the celestial sphere at a particular declination given that its span on the celestial equator is known. I want to use the algoritm in a function that accepts (1) the value of the equatorial span and (2) the specified declination as input arguments and outputs the value of the span at the specified declination.

The function would look something like :
function GetRASpan(EquatorialSpan,Declinatio n:real):Real;
begin
(the algoritm goes here to calculate the output result)
end;

For example, if the known span at the celestial equator is 39 seconds the function could be used to get the span at 60º declination by calling the function thus :

NewSpan := GetRaSpan(39,60)

NewSpan (the variable holding the calculated value) should then be approx. 79 seconds.

As a practical point, to allow for the curvature of lines of RA at high celestial latitudes, the function would need to be applied to the span of the camera frame as measured at the midpoint between the frame's top and bottom edges. But this will not affect the form of the algorithm.

Any suggestions for a suitable algorithm would be much appreciated.

trent_julie
27-05-2012, 11:59 AM
David,
Could the separation of lines of longitude given a known latitude be reapplied to RA and dec eg. 60cos(LL)? (LL = local latitude), thus ending up with 60cos(RA)? or something similar or have I missed the point?

Trent

DavidLJ
27-05-2012, 07:56 PM
Trent - thanks for your reply. The phrase “separation of lines of longitude given a known latitude” seems to be in the right ballpark. The lines of RA on the celestial globe converge as latitude changes away from the celestial equator towards the celestial poles. This is the same pattern of convergence as applies to lines of longitude on the terrestrial globe.


Assume that an imaging camera has a frame size of 1,000 pixels across and 1,000 pixels down. Also assume that the camera's pixels are square. Then the ratio of the camera frame's width to height is a constant 1 : 1. Now assume that with a particular optical train involving a specified telescope, specified focal reducer, etc. the frame spans 1,272 arc-seconds across and down. If the camera is aligned along the lines of RA and Dec then at the celestial equator its frame will vertically span 21min:12sec in declination (1,272 seconds = 21min:12sec) and it will horizontally span 1min:25sec in RA (i.e. 1,272 x 86,400 / 1,296,000 = 85 seconds = 1min :25sec). There are 1,296,000 arc seconds in 360 degrees and 86,400 seconds in 24 hours. Now assume that the camera is aimed at an object at +80º declination. Its frame will still span 1,272 arc-seconds across and down and it will still vertically span 21min:12sec in declination. But, by my measurement on a sky atlas, it will now horizontally span about 8min in RA.


What is needed is an algorithm that will accept as two arguments (1) the1min:24sec span in RA at the equator and (2) the 80º declination and will output a value of about 8min span in RA. I'm struggling to understand how to apply the the formula you quote to get this result. If you could perhaps write out the formula using the above mentioned input values so that it produces the required output value I'd be most grateful.

naskies
27-05-2012, 08:23 PM
Hi David,

This is relatively straightforward to solve using basic trigonometry. The hard part is drawing the appropriate 2D plane diagrams of a 3D sphere. I think what you're after is this:

NewSpan := 2 * atan(tan(EquatorialSpan/2)/cos(Declination))

where:

* atan is the inverse tangent function,
* EquatorialSpan/Declination/NewSpan are all in the same units specified by your atan/tan/cos functions (either degrees or radians),
* Declination is between 0 and 90 degrees (inclusive),
* EquatorialSpan is between 0 and 180 degrees (inclusive),
* your NewSpan value will be between 0 and 180 degrees (inclusive).

With wide field of fields, you'll also have to take into account atmospheric refraction. Very narrow fields of view should be "close enough".

Hope this helps!

trent_julie
27-05-2012, 08:47 PM
Ok
So the 60 value relates to how many nautical miles between each line of longitude, eg. 60Nm between each line of longitude

Therefore and excusing my last value of 60, try 15 instead, this is because each hour of RA is separated by 15 degrees. therefore 15cos(Dec)

I would then convert so I could ratio against my arc sec per pixel. here is a useful link
http://www.wilmslowastro.com/software/formulae.htm

I hope it helps.
Trent

DavidLJ
27-05-2012, 10:36 PM
Thanks Dave and again Trent. What wonderful people populate this forum. I'll need some time to digest what you have written and I'll report progress one way or the other.

RobF
28-05-2012, 12:13 AM
If you're writing some code that can access ASCOM, you might find the ASCOM Novas astrometry routines of use David. I only know enough to be dangerous, but if you google it there is some powerful stuff accessible via .COM

naskies
28-05-2012, 02:38 PM
I just found the NOVAS website - there's source code for Fortran, C, and Python too in case you didn't want to rely on ASCOM being installed.

http://aa.usno.navy.mil/software/novas/novas_info.php

This is very useful (I have a project in mind for later in the year) - thanks for pointing this out, Rob :)

DavidLJ
01-06-2012, 03:04 PM
Reporting progress (or the lack of it) as promised.

Firstly, thanks guys for the various references to websites that describe astro formulae. However, so far I haven't been able to find a solution to my problem there.

The following values were measured for the center line of an imaging frame oriented along lines of equal Right Ascension and Declination and positioned at various latitudes in declination :

Latitude in Declination : Span of imaging frame in Right Ascension
0º : 30 seconds (= 0.008333... hours)
30º : 34 seconds (= 0.009444... hours)
60º : I minute (= 0.01666... hours)
80º : 2 minutes 50 seconds (= 0.047222... hours)
85º : 5 minutes 40 seconds (= 0.09444... hours)
89º : 26 minutes (= 0.4333... hours)
90º : 12 hours

These measurements are estimated by reference to my sky atlas but they should be sufficiently accurate for use in proving the validity of a formula.

The pattern of the change curve is clear. From 0º through the lower and middle latitudes the curve's rise accelerates but only very slowly . Only when latitudes above 85º are reached does the curve start to skyrocket dramatically until it tops out at 90º.

Dave - Using your formula “NewSpan := 2 * atan(tan(EquatorialSpan/2)/cos(Declination))” in a speadsheet I get the following results for an entered EquatorialSpan of 30 seconds (i.e. 0.008333 hours) :

Latitude in Declination : Formula result (rounded to 3 decimal places)
0º : 0.008
30º : 0.054
60º : - 0.009
80º : - 0.076
85º : - 0.009
89º : 0.016
90º : - 0.019

There seem to be both positive and negative results. I realise that atan, tan and cos work with radians but I don't quite see how I can relate the formula's results to the required output values.

Trent – assuming that the phrase “15cos(Dec)“ is to be used as NewSpan = EquatorialSpan x 15 x cos(Dec) I get the following results :

Latitude in Declination : Formula result (rounded to 3 decimal places)
0º : 0.125
30º : 0.019
60º : - 0.119
80º : - 0.014
85º : - 0.123
89º : 0.064
90º : - 0.056

Again there are both positive and negative results. And I don't see how I can relate them to the required output values.

I'm not too sure where to go from here.

naskies
01-06-2012, 07:05 PM
You have a unit conversion problem... you're passing your angles in units of degrees to the atan/tan/cos functions, but it's expecting them in units of radians.

Try converting your equatorial span and declination inputs into radians first:

radians = degrees / 180 * PI()

i.e. for every 180 degrees there are Pi (3.14159...) radians.

You then apply my formula using radians as inputs, and you'll get an answer in radians. Convert the radians back to arc seconds this way:

arcsecs = radians / PI() * 180 * 60 * 60

i.e. for every Pi radians, there are 180 degrees; for every degree, there are 60 arc mins; for every arc min, there are 60 arc seconds.

Once you get the conversions right, you'll find that my formula gives the same values as your reference answers :thumbsup:


Edit: Here's a worked example just to clarify things.

Equatorial Span = 30 arc sec
= 30/60/60 degrees
= 30/60/60/180*PI radians
= 0.00014544 radians

Declination = 85 degrees
= 85/180*PI radians
= 1.48352986 radians

RA Span at DEC 85 = 2 * atan(tan(EquatorialSpan/2)/cos(Declination))
= 2 * atan(tan(0.00014544/2)/cos(1.48352986))
= 0.001668736 radians
= 0.001668736/PI*180 degrees
= 0.0956 degrees
= 0.0956*60 arc mins
= 5.74 arc mins (as per your reference value)

Hope this helps!

DavidLJ
01-06-2012, 07:45 PM
Dave. Thanks. Looks spot on! I'll need to digest it some more in order to implement it but hey - I'm able to get on my way again. What a relief.

The only small residual concern I have is that RA is expressed in hours : minutes : seconds rather than degrees : minutes : seconds. Of course the scaling factors for minutes (x 60) and seconds (x 60 x 60) are the same in both cases but I wonder if the difference between 360 degrees and 24 hours is somehow a complicating factor? I'll work at it and see what comes up.

Again many thanks.

DavidLJ
02-06-2012, 09:16 AM
OK, finally got it bolted down Dave. The formula works just dandy inside a pascal function and the matter of the difference between hours and degrees is solved by scaling the truncated part of the returned degree value by 12 / 180.

naskies
02-06-2012, 10:12 AM
No worries, good luck with the rest of it :thumbsup:

Poita
05-06-2012, 09:58 AM
I followed along and wrote a program in Atari BASIC and it works a treat. The old 800 is still in almost daily use...