comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Distance calculation for lots of stars
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Distance calculation for lots of stars [message #91422] Mon, 13 July 2015 10:45 Go to previous message
Matthew is currently offline  Matthew
Messages: 18
Registered: February 2006
Junior Member
Hello,

I have been tasked with finding stars within 1 arcsecond of each other through multiple epochs of data over a few years.

I have developed a program to do so but it takes quite a long time to complete due to for loops and a very large data set.

I would like to optimize the part of my code that loops through each star individually (categorized by epoch) and compares it against all other stars in the data set. This is clearly the step that is taking the longest and if I optimize this step then the entire process should speed up exponentially. All other for looping that is done is done over much smaller sets of data so I'm not too worried about those.

This step is a very basic distance calculation and I'm wondering if there is a quicker way to do it. So far that part of my code looks like this:

for f = 0, sectioncount-1 do begin
;Sectioncount is the individual stars in a certain epoch to search for

StarDist = sqrt((arcALLRA-arcRA(f))^2+(arcAllDEC-arcDEC(f))^2)

multistars = where(Stardist lt 1, starcount)
;Finding the location of the stars that are within one arcsecond after doing the distance calculation
...

Since any iteration in the for loop doesn't affect the next, I'd be willing to bet that there's a faster way to do it. Is there any way to speed up the distance computation for all stars in the 'individual star' data set?

I have looked at David Fanning's post on the matter and tried to use Match_2d from JD Smith. Every time I do, I encounter an error and have since abandoned the idea.

Any help is greatly appreciated,

Matthew
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLWAVE and &$ blocks
Next Topic: Easy question on for loops and if statements

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:55:06 PDT 2025

Total time taken to generate the page: 0.00387 seconds