Skip to content
Snippets Groups Projects
Commit c3b11576 authored by Laura Schreiber's avatar Laura Schreiber
Browse files

version with where_stars optimised

parent 4e216d1d
No related branches found
No related tags found
No related merge requests found
; $Id: extract_stars.pro, v 1.1 Mar 2012 e.d. $ ; $Id: extract_stars.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -26,11 +26,24 @@ ...@@ -26,11 +26,24 @@
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E. D., March 2012). ; 1) Created this file (E. D., March 2012).
; 2) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
FUNCTION extract_stars, list, n FUNCTION extract_stars, list, n
on_error, 2 on_error, 2
s = where_stars(list, n) s = where_stars(list, n)
if n ne 0 then return, list[s] else return, -1 if n ne 0 then begin
sublist = starlist(n)
sublist.x = list.x[s]
sublist.sigma_x = list.sigma_x[s]
sublist.y = list.y[s]
sublist.sigma_y = list.sigma_y[s]
sublist.f = list.f[s]
sublist.sigma_f = list.sigma_f[s]
sublist.c = list.c[s]
sublist.is_a_star = list.is_a_star[s]
endif else $
sublist = -1
return, sublist
end end
; $Id: is_star.pro, v 1.0 Sep 2024 e.d. $
;
;+
; NAME:
; IS_STAR
;
; PURPOSE:
; Check status of one or more elements in the list of stars and presumed stars.
;
; CATEGORY:
; STARFINDER auxiliary procedures.
;
; CALLING SEQUENCE:
; Result = IS_STAR(List, S)
;
; INPUTS:
; List: list of stars and presumed stars
;
; S: subscript(s) of element(s) to be checked
;
; OUTPUTS:
; Return scalar or array of binary values for each element defined by parameter S.
; Returned value is 1 for a confirmed star, 0 otherwise.
;
; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, September 2024.
;-
FUNCTION is_star, list, s
on_error, 2
return, list.is_a_star[s] and 1B
end
; $Id: merge_list.pro, v 1.1 Mar 2001 e.d. $ ; $Id: merge_list.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E. D., March 2012). ; 1) Created this file (E. D., March 2012).
; 2) Fixed bug when input list L1 is empty (E. D., April 2012). ; 2) Fixed bug when input list L1 is empty (E. D., April 2012).
; 3) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
FUNCTION merge_list, l1, l2 FUNCTION merge_list, l1, l2
...@@ -31,13 +32,17 @@ FUNCTION merge_list, l1, l2 ...@@ -31,13 +32,17 @@ FUNCTION merge_list, l1, l2
if n_tags(l1) eq 0 then $ if n_tags(l1) eq 0 then $
l = l2 else $ l = l2 else $
begin begin
n1 = n_elements(l1) n1 = n_elements(l1.is_a_star)
; if n1 eq 0 then l = l2 else $ n2 = n_elements(l2.is_a_star)
; begin
n2 = n_elements(l2)
l = starlist(n1 + n2) l = starlist(n1 + n2)
l[0] = l1 & l[n1] = l2 l.x = [l1.x, l2.x]
; endelse l.sigma_x = [l1.sigma_x, l2.sigma_x]
l.y = [l1.y, l2.y]
l.sigma_y = [l1.sigma_y, l2.sigma_y]
l.f = [l1.f, l2.f]
l.sigma_f = [l1.sigma_f, l2.sigma_f]
l.c = [l1.c, l2.c]
l.is_a_star = [l1.is_a_star, l2.is_a_star]
endelse endelse
return, l return, l
end end
StarFinder v 1.8.2a Starfinder v 1.8.2b
WEB PAGE WEB PAGE
http://davide2.bo.astro.it/?page_id=5128 https://www.ict.inaf.it/gitlab/laura.schreiber/starfinder2
ARCHIVE CONTENT ARCHIVE CONTENT
...@@ -33,7 +32,7 @@ This archive includes the following files: ...@@ -33,7 +32,7 @@ This archive includes the following files:
INSTALLATION INSTALLATION
Open the compressed archive StarFinder.zip and put all its Open the compressed archive Starfinder.zip and put all its
content in a new directory named 'starfinder'. Then modify the content in a new directory named 'starfinder'. Then modify the
IDL system variable !Path including the path to the new directory. IDL system variable !Path including the path to the new directory.
...@@ -44,24 +43,22 @@ THE IDL ASTRONOMY USER'S LIBRARY (http://idlastro.gsfc.nasa.gov). ...@@ -44,24 +43,22 @@ THE IDL ASTRONOMY USER'S LIBRARY (http://idlastro.gsfc.nasa.gov).
INFO / BUGS REPORT INFO / BUGS REPORT
Please send information requests and bug reports to: Please send information requests and bug reports to:
Emiliano Diolaiti (emiliano.diolaiti@oabo.inaf.it) Laura Schreiber (laura.schreiber@inaf.it)
Laura Schreiber (laura.schreiber@oabo.inaf.it) Emiliano Diolaiti (emiliano.diolaiti@inaf.it)
COPYRIGHT COPYRIGHT
The StarFinder software is provided "as is" without express or implied warranty. The Starfinder software is provided "as is" without express or implied warranty.
It can be used freely for research and educational purposes. It can be used freely for research and educational purposes.
Please reference the authors in any publication resulting from Please reference the authors in any publication resulting from
the use of the StarFinder code. The references are: the use of the Starfinder code. The references are:
Diolaiti E., Bendinelli O., Bonaccini D., Close L.M., Currie D.G., Diolaiti E., Bendinelli O., Bonaccini D., Close L.M., Currie D.G.,
Parmeggiani G., Astronomy & Astrophysics Supplement Series, 147, Parmeggiani G., Astronomy & Astrophysics Supplement Series, 147,
335, 2000 335, 2000
Schreiber L., Diolaiti E., Bellazzini M., Ciliegi P., Foppiani I., Schreiber L., Diolaiti E., Beltramo-Martin O., Fiorentino G., Proc. SPIE 11448, Adaptive Optics Systems VII, 114480H (14 December 2020);
Greggio L., Lanzoni B., Lombini M., Second International Conference doi: 10.1117/12.2564105
on Adaptive Optics for Extremely Large Telescopes,
Online at http://ao4elt2.lesia.obspm.fr, id.P57,
Bibliographic Code 2011aoel.confP..57S, 2011
; $Id: reverse_class.pro, v 1.1 Mar 2012 e.d. $ ; $Id: reverse_class.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -22,19 +22,19 @@ ...@@ -22,19 +22,19 @@
; of all elements in the list ; of all elements in the list
; ;
; OUTPUTS: ; OUTPUTS:
; Return list where the classification of the subscripted elements; ; Return list where the classification of the subscripted elements is reversed
; is reversed
; ;
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E.D., March 2012). ; 1) Created this file (E.D., March 2012).
; 2) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
FUNCTION reverse_class, list, SUBSCRIPTS = s FUNCTION reverse_class, list, SUBSCRIPTS = s
on_error, 2 on_error, 2
if n_elements(s) eq 0 then s = lindgen(n_elements(list)) if n_elements(s) eq 0 then s = lindgen(n_elements(list.is_a_star))
l = list l = list
l[s].is_a_star = (not l[s].is_a_star) and 1B l.is_a_star[s] = (not l.is_a_star[s]) and 1B
return, l return, l
end end
; $Id: sort_list.pro, v 1.1 Mar 2012 e.d. $ ; $Id: sort_list.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -16,16 +16,15 @@ ...@@ -16,16 +16,15 @@
; INPUTS: ; INPUTS:
; List: list of stars ; List: list of stars
; ;
; KEYWORD PARAMETERS: ; OPTIONAL OUTPUTS:
; SUBSCRIPTS: subscripts of stars to be sorted. If undefined, sort ; SUBSCRIPTS: subscripts of sorted stars in the input list.
; all stars in the list
;
; OUTPUTS:
; Return sorted list of sublist, if SUBSCRIPTS is set.
; ;
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E. D., March 2012). ; 1) Created this file (E. D., March 2012).
; 2) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
; 3) Corrected comment about keyword parameter SUBSCRIPT
; (it is an optional output, not an optional input) (E.D., September 2024).
;- ;-
FUNCTION sort_list, list, SUBSCRIPTS = s FUNCTION sort_list, list, SUBSCRIPTS = s
...@@ -33,5 +32,13 @@ FUNCTION sort_list, list, SUBSCRIPTS = s ...@@ -33,5 +32,13 @@ FUNCTION sort_list, list, SUBSCRIPTS = s
on_error, 2 on_error, 2
if n_tags(list) eq 0 then return, list if n_tags(list) eq 0 then return, list
s = reverse(sort(list.f)) s = reverse(sort(list.f))
return, list[s] list.x = list.x[s]
list.sigma_x = list.sigma_x[s]
list.y = list.y[s]
list.sigma_y = list.sigma_y[s]
list.f = list.f[s]
list.sigma_f = list.sigma_f[s]
list.c = list.c[s]
list.is_a_star = list.is_a_star[s]
return, list
end end
; $Id: star_param.pro, v 1.1 Mar 2012 e.d. $ ; $Id: star_param.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E. D., March 2012). ; 1) Created this file (E. D., March 2012).
; 2) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
PRO star_param, list, SUBSCRIPTS = s, $ PRO star_param, list, SUBSCRIPTS = s, $
...@@ -45,13 +46,13 @@ PRO star_param, list, SUBSCRIPTS = s, $ ...@@ -45,13 +46,13 @@ PRO star_param, list, SUBSCRIPTS = s, $
endif endif
n = n_elements(s) n = n_elements(s)
if n eq 0 then begin if n eq 0 then begin
n = n_elements(list) & s = lindgen(n) ; extract all elements n = n_elements(list.is_a_star) & s = lindgen(n) ; extract all elements
endif endif
if s[0] lt 0 then n = 0 else begin $ if s[0] lt 0 then n = 0 else begin $
x = list[s].x & sigma_x = list[s].sigma_x x = list.x[s] & sigma_x = list.sigma_x[s]
y = list[s].y & sigma_y = list[s].sigma_y y = list.y[s] & sigma_y = list.sigma_y[s]
f = list[s].f & sigma_f = list[s].sigma_f f = list.f[s] & sigma_f = list.sigma_f[s]
c = list[s].c c = list.c[s]
endelse endelse
return return
end end
; $Id: starfinder.pro, v 1.8.2a May 2014 e.d. $ ; $Id: starfinder.pro, v 1.8.2b_dev01 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -435,6 +435,8 @@ ...@@ -435,6 +435,8 @@
; 26) Removed bug in STARFINDER_FIT module: sometimes very close sources ; 26) Removed bug in STARFINDER_FIT module: sometimes very close sources
; were swapped by call to COMPARE_LISTS (E.D., April 2012). ; were swapped by call to COMPARE_LISTS (E.D., April 2012).
; 27) Updated documentation (E. D., May 2014). ; 27) Updated documentation (E. D., May 2014).
; 28) Modified data type of variable "list_of_stars":
; from array of structures to structure of arrays (E.D., September 2024).
;- ;-
...@@ -1164,7 +1166,9 @@ PRO starfinder, $ ...@@ -1164,7 +1166,9 @@ PRO starfinder, $
; print, "STARFINDER: final re-fitting: iteration", iter + 1 ; print, "STARFINDER: final re-fitting: iteration", iter + 1
for n = 0L, n_stars - 1 do $ for n = 0L, n_stars - 1 do $
; modified March 2012 ; modified March 2012
if list_of_stars[n].is_a_star or re_fitting eq 1 then $ ;;; if list_of_stars[n].is_a_star or re_fitting eq 1 or iter eq 0 then $ ; if list_of_stars[n].is_a_star or re_fitting eq 1 then $ ;;; if list_of_stars[n].is_a_star or re_fitting eq 1 or iter eq 0 then $
; modified September 2024
if is_star(list_of_stars, n) or re_fitting eq 1 then $ ;;; if list_of_stars[n].is_a_star or re_fitting eq 1 or iter eq 0 then $
starfinder_fit, list_of_stars, n, image, siz, background, stars, $ starfinder_fit, list_of_stars, n, image, siz, background, stars, $
noise_std, sv_par, x_bad, y_bad, fit_par, fit_data, $ noise_std, sv_par, x_bad, y_bad, fit_par, fit_data, $
model_data, threshold_n, re_fitting, _EXTRA = extra, $ model_data, threshold_n, re_fitting, _EXTRA = extra, $
......
; $Id: starlist.pro, v 1.1 Mar 2012 e.d. $ ; $Id: starlist.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
; STARLIST ; STARLIST
; ;
; PURPOSE: ; PURPOSE:
; Create a new list of elements representing either ; Create a new list of elements representing true or presumed stars.
; true or presumed stars.
; ;
; CATEGORY: ; CATEGORY:
; STARFINDER auxiliary procedures. ; STARFINDER auxiliary procedures.
...@@ -18,24 +17,31 @@ ...@@ -18,24 +17,31 @@
; N: number of elements in the list ; N: number of elements in the list
; ;
; OPTIONAL INPUTS: ; OPTIONAL INPUTS:
; X, Y, F: 1D vectors with position and flux of new elements ; X, Y: 1D vectors with positions of new elements
; ;
; C: 1D vector with correlation coefficients of new elements (if available) ; F: 1D vector with fluxes of new elements (used only if X, Y are defined)
;
; C: 1D vector with correlation coefficients of new elements (used only if X, Y, F are defined)
; ;
; OUTPUTS: ; OUTPUTS:
; Return possibly initialized list of N elements ; Return initialized list of N elements
; ;
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Added optional input C in STARLIST (E.D., March 2012). ; 1) Added optional input C in STARLIST (E.D., March 2012).
; 2) Created this file (E. D., March 2012). ; 2) Created this file (E.D., March 2012).
; 3) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
FUNCTION starlist, n, x, y, f, c FUNCTION starlist, n, x, y, f, c
on_error, 2 on_error, 2
element = star() list = { $
list = replicate(element, n) x: fltarr(n), sigma_x: fltarr(n), $ ; x- coordinate and error
y: fltarr(n), sigma_y: fltarr(n), $ ; y- coordinate and error
f: fltarr(n), sigma_f: fltarr(n), $ ; flux and error
c: make_array(n, VALUE = -1.0), $ ; correlation coefficient
is_a_star: bytarr(n)} ; flag
if n_elements(x) ne 0 and n_elements(y) ne 0 then $ if n_elements(x) ne 0 and n_elements(y) ne 0 then $
update_list, list, x, y, f, c update_list, list, x, y, f, c
return, list return, list
......
; $Id: update_list.pro, v 1.1 Mar 2012 e.d. $ ; $Id: update_list.pro, v 2.0 Sep 2024 e.d. $
; ;
;+ ;+
; NAME: ; NAME:
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
; Sigma_X, Sigma_Y, Sigma_F: errors on position and flux. ; Sigma_X, Sigma_Y, Sigma_F: errors on position and flux.
; ;
; KEYWORD PARAMETERS: ; KEYWORD PARAMETERS:
; SUBSCRIPTS: 1D vector of subscripts of stars to update. If not defined, ; SUBSCRIPTS: 1D vector of subscripts of stars to be updated. If not defined,
; update all the stars in the list.; ; update all the stars in the list.
; ;
; IS_STAR: set this keyword to say that the stars to update have already ; IS_STAR: set this keyword to specify that the elements to be updated have already
; been accepted as true stars. ; been accepted as true stars.
; ;
; OUTPUTS: ; OUTPUTS:
...@@ -36,23 +36,24 @@ ...@@ -36,23 +36,24 @@
; ;
; MODIFICATION HISTORY: ; MODIFICATION HISTORY:
; Written by: Emiliano Diolaiti, June 2001. ; Written by: Emiliano Diolaiti, June 2001.
; 1) Created this file (E. D., March 2012). ; 1) Created this file (E.D., March 2012).
; 2) Modified data type: from array of structures to structure of arrays (E.D., September 2024).
;- ;-
PRO update_list, list, SUBSCRIPTS = s, x, y, f, c, $ PRO update_list, list, SUBSCRIPTS = s, x, y, f, c, $
sigma_x, sigma_y, sigma_f, IS_STAR = is_star sigma_x, sigma_y, sigma_f, IS_STAR = is_star
on_error, 2 on_error, 2
n = n_elements(s) n = n_elements(s)
if n eq 0 then s = lindgen(n_elements(x)) if n eq 0 then s = lindgen(n_elements(x))
if s[0] ge 0 then begin if s[0] ge 0 then begin
list[s].x = x & list[s].y = y list.x[s] = x & list.y[s] = y
if n_elements(f) ne 0 then list[s].f = f if n_elements(f) ne 0 then list.f[s] = f
if n_elements(c) ne 0 then list[s].c = c if n_elements(c) ne 0 then list.c[s] = c
if n_elements(sigma_x) ne 0 then list[s].sigma_x = sigma_x if n_elements(sigma_x) ne 0 then list.sigma_x[s] = sigma_x
if n_elements(sigma_y) ne 0 then list[s].sigma_y = sigma_y if n_elements(sigma_y) ne 0 then list.sigma_y[s] = sigma_y
if n_elements(sigma_f) ne 0 then list[s].sigma_f = sigma_f if n_elements(sigma_f) ne 0 then list.sigma_f[s] = sigma_f
list[s].is_a_star = keyword_set(is_star) and 1B list.is_a_star[s] = keyword_set(is_star) and 1B
endif endif
return return
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment