Blame view

LabTools/IRAP/JPB/extract_all_muse_phangs_seds.pro 1.43 KB
d6343d56   Jean-Philippe Bernard   First commit
1
2
3
4
5
6
7
8
9
10
11
PRO extract_all_muse_phangs_seds,source_name,voronoi_id,jwst_images,filters,filename=filename,indices=indices,counts=counts,use_these_indices=use_these_indices

data_dir='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/DR1/'

Nvor=max(voronoi_id)
dustem_init

file='/tmp/jwst_seds_muse_pixels.sav'
IF keyword_set(filename) THEN file=filename

message,'upon completion, extracted seds will be stored in '+file,/continue
6fd06be5   Jean-Philippe Bernard   improved
12
;stop
d6343d56   Jean-Philippe Bernard   First commit
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

all_seds=ptrarr(Nvor)
all_seds_indices=ptrarr(Nvor)
counts=lonarr(Nvor)

IF NOT keyword_set(use_these_indices) THEN BEGIN
   FOR vid=0LL,Nvor-1 DO BEGIN
      IF vid mod 10 EQ 0 THEN BEGIN
      	 message,'Extracting sed '+strtrim(vid,2)+' '+strtrim(1.*vid/Nvor*100.,2)+' %',/continue
      ENDIF
      index=where(voronoi_id EQ vid,count)
      sed=dustem_sed_extractor(jwst_images,index,filters,/total_intensity_only)
      all_seds[vid]=ptr_new(sed)
      all_seds_indices[vid]=ptr_new(index)
      counts[vid]=count
   ENDFOR
ENDIF ELSE BEGIN
   FOR vid=0LL,Nvor-1 DO BEGIN
      IF vid mod 10 EQ 0 THEN BEGIN
          message,'Extracting sed '+strtrim(vid,2)+' '+strtrim(1.*vid/Nvor*100.,2)+' %',/continue
      ENDIF
      index=*use_these_indices[vid]
      sed=dustem_sed_extractor(jwst_images,index,filters,/total_intensity_only)
      all_seds[vid]=ptr_new(sed)
      all_seds_indices[vid]=ptr_new(index)
      counts[vid]=n_elements(index)
   ENDFOR   
ENDELSE

save,all_seds,all_seds_indices,file=file
message,'Saved '+file,/info

END