Home

IRAS – Image Reduction and Analysis Software

image

Contents

1. SIDE EFFECTS H None F RESTRICTIONS None 7 PROCEDURE Straightforward 7 EXAMPLE camerainfo decode raw header file img 7 MODIFICATION HISTORY K vers 0 S Fineschi 22 November 2008 vers 1 M Pancrazzi S Fineschi 2 March 2009 i vers 2 Tino Mastrodomenico 3 June 2009 camerainfo strarr 6 human readable camera information fi file info filename size fi size if size ne 551046 then begin camerainfo 0 Camera UVD img info camerainfo camerainfo seqnum 0 exp 1 return img_info end openr lun filename get_lun hdr bytarr 40 store the first 40 byte vector of raw image o Image name 32 byte VLD Header 8 byt readu lun hdr free_lun lun close lun FIXME which is the correct one T Decode camera information stored in the header filename string hdr 0 31 camerainfo B hdr 32 37 camera information in Bvtes lst info camera ID if camerainfo B 0 ge 128 then camerainfo 0 Camera UVD else camerainfo 0 Camera VID 2nd info aquisition mode aqmode camerainfo B 0 aqmode aqmode and 112 aqmode aqmode 16 case aqmode of 3 begin camerainfo 1 Exp 10 s exp 10 end 4 begin camerainfo 1 Exp 20 s exp 20 end 5 begin camerainfo 1 Exp 10 s dark exp 10 end 6 begin camerainfo 1 Exp 20 s da
2. Yes this happens even with device retain 2 the documentation sucks Goo end pro gui select widget widgets thumbs bak w min d x size wl bak h min ld v size h bak tvrd 0 d y size bak h bak w bak h true 1 widget control widgets thumbs draw xsize w draw ysize h tv bak 0 ld v size bak h true 1 if delta gt 0 then begin if prev siz q O then begin ystep hstart end tv get white rect widgets thumb sizet1042 ystep end if h eq 1 then begin try to deuglify the white dot 192 0xc0 is the color used for the background in IDL 7 0 on GNU Linux on my computer Yeah I know erase c0c0c0 x end gui clean all widgets gui select widget widgets main image erase gui select widget widgets profile x erase gui select widget widgets profile y erase widget control widgets img name set value for i 0 widgets camera_info gt get_len 1 do begin use a single space as value not an empty string widget control widgets camera info 5get item i set value end end pro display thumbnail widgets image seqnum n selected name gui select widget widgets thumbs thumb size widgets thumb size FIXME fix this if thumbs are not square anymore ystep thumb size 26 y n ystep x 10 close_x x thumb_size 14 if selected then begin tv widgets selected 2 get_y_from_top y 2 132 true 1 end else begin tv widge
3. hl sz 2 disp_sizel x round fl y round fl yes the f if x ge 0 amp amp FIXMI right gu Di encoding po str SEE S format G13 widget c end end return end if redirect eq 0 th len imgs ne 0 then begin file widgets imgs_get_current_image imgs ev x ev y k or a motion event s eq O amp amp imgs_get_len imgs ne 0 then begin size imgs get current image imgs widgets disp size 1 oat ev x wl disp sizel oat ev v hl disp sizel ollowing check may file e g during drag drop x le wl amp amp y ge O 8 y le hl then begin make this and other string format elsewhere illemet string byte 187 implicit Latin 1 simpler s string x format 14 ing y format 14 right_guillemet ing float imgs get current image imgs x yl no ontrol widgets info_bar set_value s reset_status wi end if uvalu n begin dgets H lp q E add inl FIXME Di return end if uvalue eq Exit widget_control return end if uvalu q menu then begin ine help then begin ev top destroy if ev value eq widget_contr return end if ev valu then begin Exit then begin ol ev top destrov Read RAW q bak path 1 file dialo name fil then begin ast path g piektfile filter img bin T raw read path last path
4. img function imgs get current short name imgs return imgs data 5get item imgs current img short name function imgs get exp imgs index return imgs data gt get_item index img_info exp function imgs get current exp imgs return imgs data gt get_item imgs current_img img_info exp imgs select image imgs n widgets if imgs current img ne 1 then begin imgs display thumbnail imgs imgs current img 0 widgets end imgs display thumbnail imgs n 1 widgets img data imgs data gt get_item n omin min v displav image widgets img data disp image img data img info camerainfo data name imgs current img n draw profile widgets imgs get current image imgs 1 1 end pro imgs delete image imgs n widgets FIXME this can be much faster but pay attention to all corner cases you change it num images imgs data gt get_len 1 delete thumbnail widgets num images imgs data gt del_item n redraw 0 if n eq imgs current img then begin redraw 1 if n eq num_images then begin imgs current img 1 end end else if n lt imgs current img then begin imgs current img 1 end for i n num images 1 do begin if i ne imgs current img then begin imgs display thumbnail imgs i O widgets end end if num images eq 0 then begin gui clean all widgets nd else if redraw then begin imgs select image imgs imgs current img widgets end else begin this is necessarv her
5. Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt No Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne NE Ne Ne Ne Ne ONG e function get_selected im bytarr 3 116 132 im 0 1 64 im 2 255 im 6 109 6 125 255 return im end 8 7 image utils pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later v
6. gt append get image t string i format I1 end window widget base title app name v version column main menu menu widget base window row file menu widget button menu VALUE File MENU desc 0 Read RAW ONRead FITS ONRead parameters LI ONSave as FITS 2 Exit dummy cw pdmenu file menu desc MBAR RETURN FULL NAME UVALUE menu calibration menu widget button menu VALUE Calibration MENU desc 0 Remove dark count FIXME add back this 0 Remove flat field S O Shutterless corrrection O Remove vignetting O Remove vignetting 2 0 Photometric calib VL O Photometric calib H O Photometric calib He 0 Multiply images O Divide images dummy cw pdmenu calibration menu desc MBAR RETURN FULL NAME UVALUE menu polarization menu widget button menu VALUE Polarization MENU desc 0 Build polarized image dummy cw_pdmenu polarization_menu desc MBAR RETURN FULL NAME UVALUE menu dummy widget button menu value Help uvalue Help dummy widget_button menu value Exit uvalue Exit main window content below the menu display widget_base window row coll widget_base display column thumbnails col2 widget_base display column main image display col3 widget_base display colum
7. n 1 power below dblarr n 1 power above 0 power below 0 z for row 1 n 2 do begin power above row power above row 1 wt above 1 power below row power below row 1 wt below 1 end v 0 wt below power belowtreverse power above u O wt above power above reverse power below d 0 1 wt above total v v N 1 f 1 d wt_above total v d d 0 0 u f v reverse v f p dblarr n n nozero p 0 0 u for row 1 n 2 do begin p 0 row v n row 1 n 2 p row row u 0 n row 1 end p 0 n 1 v ul vl i return p end r shutterless image correction pro shutless2 imagei exptime imageo image float imagei sz size image cleartime 0 272248 xp_eff exptime cleartim line_ro 1262e 6 line_clr 124e 6 fixup sc inverse sz 2 exp eff line ro line cir imageo fixup image end 8 10 raw_images pro Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne PI IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at y
8. then cd fi if e Siras dir iras pro then echo Error cannot find IRAS directory exit 1 fi relname iras 1 if e relname then echo Error directory relname exists exit 1 fi if e Srelname zip then echo Error file Srelname zip exists exit 1 fi cp a Siras dir Srelname cd Srelname f FIXME remove this when iras run pro is fixed sed i s path 1 iras pro for i in fits do rm ey done if e todo2 txt J then rm todo2 txt fil for i in do if h si 1 then rm i delete symbolic links ta done CA ag zip 9r Srelname zip Srelname echo Srelname zip 8 19 check style sh bin bash for i In pro do fix idl indentation py Si diff u Si chk txt py Si grep v line longer than 79 characters done for i in sh py do chk txt py Si done 8 20 fix idl indentation py usr bin python fix idl indentation py version 0 3 this is a bit fragile but it s often good enough import fileinput import re import sys from string import ascii letters digits WARNING it s very important to ALWAYS check for hostile code unless you receive the code from someone you completely and absolutely trust This danger is NOT purely theoretical the following commands can be used to obfuscate hostile code bad commands call function call method call procedure execut
9. widgets im xp yp x xp y yp s size im w s 1 h s 2 disp_size widgets disp_size if x eq 1 amp amp y eq 1 then begin x w 2 y h 2 end else if x lt 0 x ge disp size y lt O y ge disp size then begin return end else begin x x w 1 disp_size 1 y y 4 h 1 disp_size 1 end gui_select_widget widgets profile_x plot image 256 xtitle X pixel ytitle Counts thick 1 8 color black background white plot im y xtitle bin X ytitle DN color 0 background ffffff x plots Ix x y crange 0 y crange 1 line 0 data color 0000ff x red gui select widget widgets profile y plot im x xtitle bin Y ytitle DN color 0 background ffffff x plots ly yl y crange 0 y crange 1 line 0 data color 0000ff x red end why IDL doesn t provide this in its standard library pro gui_select_widget widget widget control widget get value id wset id end 8 4 list pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi NG Ne Ne Ne NG e A Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ei
10. widgets info_icon erase handle_gui_event ev common data_structures last_path imgs widgets help ev struct widget_control ev id get_uvalue uvalue redirect 0 if uvalue eq thumbs click then begin gui_select_widget widgets thumbs thumb_size widgets thumb_size if ev releas q 1 then begin 7 unlike the code below for selecting a new image when closing an image we act only on release of the left button to be really sure that the user meant it close x 10 4 thumb size 14 ystep thumb size 26 iprint ld v size ev x ev y if ev x ge close x amp amp ev x It close x 14 then begin Here we use d y size 1 while get y from top uses only Id y size This is necessary to use ge and It with y below otherwise gt and le would have been necessary IOW we need to consider the pixel under the mouse a square with height 1 to avoid off by one errors FIXME maybe simply use get y from top ev v 1 y ld v size 1 ev y n y ystep y mod ystep if y ge 10 y 1t 24 then begin print ev x close x y n if n lt imgs get len imgs then begin reset status widgets imgs delete image imgs n widgets end end end end if ev press eq 0 then begin 1 2 4 means press of left center and right button When selecting an image we act on click instead of release to make things feel a bit snappier IDL is Veeeeery slow FIXME is this corr
11. 666000 saaasasssssssss0ns 48 8 2 EA AAA E a E B aa a a a A pa a A B ar 49 Rev 3 Silvano Fineschi IRAS Image Reduction and Analysis Software Page 3 of 49 8 22 IMG2IDL SH Abstract IRAS Image Reduction and Analysis Software is a GUI Graphics User Interface program for an easy conversion calibration and manipulation of the images by the SCORE Sounding CORonagraph Experiment project cameras IRAS is entirely written in the IDL Interactive Data Language programming language to ease code reuse since IDL is a popular programming language for astronomy applications and is compatible with different IDL versions across multiple operating systems 1 Introduction 1 1 Background The SCORE experiment is a set of two coronagraphs designed to provide full images of the extended corona in the EUV and visible light SCORE is part of the scientific payload of the NASA HERSCHEL the Helium Resonant Scattering in the Corona and Heliosphere sounding rocket mission which is composed of SCORE and the Extreme Ultraviolet Imaging Telescope EIT Depending on the success of the first launch a second and a third launch are foreseen upon NASA approval 1 2 Objectives The main goal of the project is the development of a simple to use integrated conversion and calibration software for images acquired by the EUV and VL cameras of the SCORE project IRAS can read FITS files as well as raw images directly produced by the cameras and can d
12. get path last path short name if file eq last pat return end image raw header ge camerainfo img info d basename file strmid name strlen name then begin bak path 10 6 h workaround for an IDL bug read image file t vid header file decode raw header fil camerainfo help heade convert th errors in FIXME thi that n image long code raw header file img info camerainfo img info seqnum r e image from unsigned 16 bit to signed 32 bit to avoid later calculations e g dark removal s should really be done by each calculation routine eeds it image end T imgs_append imgs image name short_name widgets 0 img_info return v valu q Read FITS then begin bak path last path file dialog_pickfile filter fits fit read path last path get path last path name file basename file short name strmid name strlen name 11 6 if file eq then begin last_path bak_path workaround for an IDL bug return end FIXME do something with the FITS header fits_read file image hdr imgs_append imgs image name short_name widgets 1 FIXME read exposure from FITS header return end if ev valu a Read parameters then begin bak_path last_path file dialog_pickfile filter txt read path last_path get_path last_path if file eq then begin last_pa
13. very hard to get right even for simple cases without an extremely good understanding of IDL memory management and lots of tests So it s strongly suggested to hide all these details in completely encapsulated classes leaving to the rest of the code only the lesser problem of calling obj destroy for each allocated class instance A good and completely commented debugged and tested implementation of these principles is the list class in the list pro file It can be used as an example of how to handle a moderately complex and dynamic memory structure and it s also useful per se since it provides an array that can contain arbitrary IDL variables including nested lists can be empty and offers linear time amortized behaviour i e very fast O 1 independent of the number and the size of the variables contained in the list for appends and element removal at the end of the list 6 License IRAS includes code contributions from at least Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi and is copyrighted by at least the Osservatorio Astronomico di Torino Lino Mastrodomenico and Maurizio Pancrazzi IRAS is Free Software open source and is currentiv distributed under the GNU General Public License version 3 or later This license has been chosen because it encourages public diffusion of source code for scientific applications No restrictions at all are imposed on modified IRAS versions that aren t distributed to thir
14. 0 deg widgets pb2 n d begin s 4th image 135 deg widgets pb3 n d s status 1 control widgets info_bar skip eq 1 then begin dget_control widgets img_name set_value se if widgets pb_skipped eq 0 then begin dget_control widgets img_name set_value Click SKIP above to set_value pB select s e eq Build polarized image status widgets gets pb_skipped ne 1 then begin po imgs_get_image imgs widgets pb1 se begin 0 then begin gets pb_skipped ne 2 then begin imgs_get_image imgs widgets pb2 se begin 0 gets pb_skipped ne 3 then begin imgs_get_image imgs widgets pb3 se begin 0 skip eg 0 then begin imgs_get_current_image imgs se begin 0 widgets pb skipped 4 end image build _pB tmp0 tmpl tmp2 tmp3 widgets pb skipped name pB image short name pB image imgs append imgs image name short name widgets imgs get exp imgs widgets pbl return end print WARNING ev value is not vet implemented FIXME remove this end end 8 3 gui low level pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software vou can redistribute it and or modifv it under the terms of t
15. 0 0 0 0 0 0 9 4 DTO O DOO O O OO O OO 49451 505688 552645 594649 633930 672957 716449 756526 788400 814820 839726 868996 892068 908062 930176 949373 963905 978881 986860 997265 997269 995999 991099 983797 975844 965341 952416 938350 920200 906783 889596 873628 871468 867314 868724 861422 854927 844138 830819 813853 800475 780083 757880 738123 s121517 700529 689086 67 Tl 15 195 83 87 91 95 99 A A A A A A A A A A A A A A A A A A A A o 00000 00000 00000 00000 00000 00000 00000 00000 000001 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 1 000000 000000 353709 405826 464168 518300 563147 605165 642939 683868 727140 765000 795634 820784 846730 875922 895986 913424 935057 953566 967838 980847 990174 997558 997501 994890 989301 982091 973523 961988 949461 933581 916937 902611 884967 872226 870573 867391 867776 859547 852768 841118 826577 810573 795899 774516 752700 733716 716676 696322 686765 DDDD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD D DOO OO O tt oS NY AA XA MMMM mm LU Y A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A SS A SS SS APAPAP A SS o UY UY UY UY UY AN AN NY
16. 153 000000 54 000000 155 000000 56 000000 57 000000 58 000000 59 000000 60 000000 61 000000 62 000000 63 000000 AOS OA AOS OS 5 5 AA XA X UY UU UN UY AN AN UN UN LY AN AU WD 64 68 T2 16 80 84 88 92 96 100 104 108 112 116 120 124 128 1327 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 248 252 256 260 264 268 272 276 280 284 288 292 296 300 304 308 3127 316 320 324 328 332 336 340 oooooooo0ooooooooooooooooo o o DD DD DD DD 00000000000obrrorrrerrrrrpp 00000000o 110 00 SOO O OO OO O 854282 881870 899772 919184 939872 957125 972160 982331 1993251 997668 997218 993796 987542 980000 971188 958652 946219 928679 913857 898346 880359 872060 868930 868236 865953 857871 850305 838077 821828 807687 790792 768978 747696 729646 711145 26093311 NENA AA gt Pa A A A A O AP o 65 69 13 Dl 81 85 89 93 OT 105 109 113 EE 12 5 125 129 133 137 141 145 149 153 157 161 165 169 173x 177 181 185 189 193 197 201 205 209 213 Aly 221
17. 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi 4 Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt return the size of the array returned by decode raw header function get raw header info size return 6 end function get empty img info exp img info camerainfo strarr 6 seqnum 0 exp exp return img info end function decode raw header filenam NAME decode_raw_header 7 PURPOSE y Load the raw images of the UVCI visible light detector VLD CALLING SEQUENCE decode raw head filename INPUTS header header of the image image The image to be loaded OUTPUTS 40 byte long vector COMMON BLOCKS
18. 225 229 233 231 241 245 249 20 3 2511 261 265 269 2137 277 281 285 289 293 297 301 305 309 313 317 321 325 329 333 337 341 101 DO SO O O DO 00 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 DO OO O OD OO OO O C O OO O OO O O O t DOO 0 0 00000000o OSLO O DOO O4O Qu ea TU A SS 584297 624697 662343 705647 747519 780675 808910 832911 861847 887342 903576 924900 944629 960531 975924 984229 995727 997449 996840 992458 985698 977994 968382 955441 942653 924078 910431 894301 876125 872120 867804 868430 864265 856334 846992 835010 817304 804508 785473 763437 742666 725887 705552 691116 ee en 66 70 74 18 82 86 90 98 102 106 110 114 118 122 12 65 130 134 138 142 146 150 154 158 162 166 170 174 178 182 186 190 194 198 202 206 210 214 218 222 226 230 234 238 242 246 250 254 258 262 266 210 274 218 282 286 290 294 298 302 306 310 314 318 322 326 330 334 338 342 DODODDODDOOOXO DD OO 0 0 0 0 0 0 00 0 0 00 0 00 0 0 0 0 0 0 OOO DO DO DOO OO OO O O D OO DO OO O 223 AB ABA PR OVO ONO O O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 4 0 0 0 0 0 0
19. 64 304 90 0 037855 338 78 0 078864 372 66 0 126183 406 53 0 157729 440 41 0 211356 474 29 0 255521 508 17 0 268139 542 05 0 293375 575 92 0 305994 609 80 0 299685 643 68 0 287066 677 56 0 280757 x xy 0 y xyll m shift dist radius 2 xc yc m cspline x y m m where m lt 0 001 1 m where m lt 0 05 1 if 1 then begin FIXME this is an ugly hack s size image w sll h s 2 m congrid m w h end print min m max m tmp image m print min tmp max tmp min image max image return tmp return image m lt 65535 end function remove vignetting2 image radius xc0 yc0 FIXME these are completely uncalibrated values xy 0 1 000000 1 1 000000 2 1 000000 3 1 000000 4 1 000000 5 1 000000 6 1 000000 7 1 000000 8 1 000000 9 1 000000 10 1 000000 11 1 000000 12 000000 13 000000 14 000000 15 000000 16 000000 17 000000 18 000000 19 000000 20 000000 21 000000 22 000000 23 000000 24 000000 25 000000 26 000000 27 000000 28 000000 29 000000 30 000000 31 000000 32 000000 33 000000 34 000000 35 000000 36 000000 37 000000 38 000000 39 000000 40 000000 41 000000 42 000000 43 000000 44 000000 45 000000 46 000000 47 000000 48 000000 49 000000 50 000000 51 000000 52 000000
20. 67 531 image remove vignetting2 imgs get current image imgs 512 467 531 image remove vignetting2 imgs get current image imgs 512 widgets xc widgets yc name vignetting removed from imgs get current name imgs ryt short_name vignetting imgs_append imgs image name short_name widgets imgs_get_current_exp imgs return end if ev value eq Photometric calib VL then begin if not imgs_image_exists imgs then begin dummy dialog_message No image loaded error return end exp imgs_get_current_exp imgs help exp image imgs_get_current_image imgs widgets photometric_VL exp name VL calib of imgs_get_current_name imgs 4 short name VL calib imgs append imgs image name short name widgets 1 teturn end if ev value eq Photometric calib H then begin if not imgs image exists imgs then begin dummy dialog message No image loaded error return end image imgs get current image imgs widgets photometric H widgets uv exp name H calib of imgs get current name imgs short name H calib imgs append imgs image name short name widgets 1 return end if ev value eq Photometric calib He then begin if not imgs image exists imgs then begin dummv dialog message No image loaded error return end image imgs get current image imgs 4 widgets photometric He widgets uv exp name He calib of
21. AN AN NY A Y NY AN Y Y AN Y 0 7 7 0 7 Y 00 la 00 Y AN Y 92 AN NY Y AN Y AN AN NY AN Y NY A NNN N NNN 00 7 Y 7 7 A AN A A AN PS 344 0 682986 1345 0 677820 348 0 659790 1349 0 654591 352 0 642190 1353 0 639599 356 0 633849 357 0 630800 360 0 618719 361 0 615173 364 0 607379 1365 0 605230 368 0 597741 369 0 594299 372 0 582312 373 0 605346 376 0 839545 377 0 919429 380 1 000000 381 1 000000 384 1 000000 1385 1 000000 388 1 000000 389 1 000000 jie 230 yc 536 268 xc xc0 vc Yc0 x xy 0 y xvli s size image w s 1 h s 2 xc w 514 yc h 536 m shift dist w 2 h 2 xc yc if O then begin dark image xc 50 xc 4 50 ndark mean dark print ndark tmp image ndark 6122 89 print mean tmp xc 50 xc 50 end else begin tmp image end m m 0 w 1 O h 1 m cspline x y m tmp m tmp xc 50 xc 50 ye 50 yc 50 return tmp end 8 14 test_leaks pro run with A idl e test_leaks function get_mem return end pro test_leaks FIXME see also list destroy list start get mem list destroy list for i 0 1 do begin tmp list list_destroy objs list n objs gt get_len tmp memory 1 memory 2 objs gt append i 2 531e6 objs gt append 0 objs gt append 7 8 9 objs 5set item 2 4 5 6 print get mem start o
22. Giordano Lino Mastrodomenico Silvano Fineschi f Maurizio Pancrazzi This program is free software vou can redistribute it and or modifv it under the terms of the GNU General Public License as published bv the Free Software Foundation either version 3 of the License or at vour option anv later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details Xou should have received a copv of the GNU General Public License along with this program If not see lt http www gnu org licenses gt Moore Penrose pseudoinverse of a matrix function pinv m Why in the hell IDL doesn t provide this out of the box FIXME check that this is correct return invert transpose m m transpose m end build polarized brightness image function build pB a b c d image to skip if image to skip eq O then begin print pB with 4 images FIXME delete this line Value of a 1 p first 0 0 0 0 7 p11 p12 p13 p14 267 246 233 252 7 p21 p22 p23 p24 0 516 0 02 0 48 0 01 p3l p32 p33 p34 0 063 0 495 0 04 0 51 q a p21 u a p3l else begin print pB LS st 4 end format row second row third row intensity 627 785 534 055 current
23. IRAS Image Reduction and Analysis Software Technical Report IRAS Image Reduction and Analysis Software Prepared by Lino Mastrodomenico December 2008 Version 1 0 Rev 3 Silvano Fineschi IRAS Image Reduction and Analysis Software Page 1 of 49 IRAS Image Reduction and Analysis Software Version management Project manager S Fineschi Rev 3 Silvano Fineschi IRAS Image Reduction and Analysis Software Page 2 of 49 IRAS Image Reduction and Analysis Software Contents 1 INTRODUCTION 3D SG NERD svsesccess eveosseusecees 5 Ls BACKGROUND A A A AN DA Ga 5 A O 5 2 ARCHITECTURE OVERVIEW scccssscscoccascessiecsscsscvscoadessvoscescesosesssscoscesccsosssesssonsecsesosesgsscousesessess 6 3 THE CHOICE OF THE PROGRAMMING LANGUAGE cccsssssscsssssssccscccccsssssscsscecescess 7 3 1 COMPATIBILITY AND QUIRKS distantes 8 4 USER MANUAL GN BINAN O O 9 VASGUEOVERVIE A nia ta ga AN ED BORA NN NTN TAN ng NINI UNAT a 9 4 2 STANDARD CALIBRATION SEQUENCES 200005000000000 00Na 10 4 3 DEPENDENCIES 2231601324842 a BANA NGA NAA NN OB hea BARAN 10 AA RUNNING RA Site tubu Tan kania aid cit e fob KISS Mua Ga LAGA NA Nd 10 4 5 MENO SA a i a Ja dd AA 10 MST Ke MENU AA AN AA arta TP A ATTI g atti id 11 ASD CAMDIQUOM MA A 11 4 5 3 Polarization Menu ar rr nono rn non narran nnn rr nn zz EISE 11 5 LESSONS LEARNED AAA NN 11 3 IL IHEIDE MEMORY MODEL i vs ig ob BULA ance LS na aa Gd ania maa shia 12 5 2 BEST P
24. RACTICES IN IDL OOP AND MEMORY ALLOCATION u 111100 12 A AA AA E 13 TACONGEUSIONS 3 aan A BED TANGKA Ian eE osi eobot eses 14 8 APPENDIX A SOURCE CODE sssennnnennenoeonnnnnnnneoeeoonnnneseseeoooonnnnneseseeooonnaneneseooeoonennnnn nee 14 Soh DEFAULT CONFTXT ei a Nain Ta a dada PA NANA EN ae 14 8 2 IRASSGULPRO Sueiro aah babag banana ti ibdel cs 14 8 3 GULLOW LEVELPRO A L 25 SAT IST PRO ted rt ete E EET OE chide Mit tut dag a Ral a eta tas tas ta AT SOB as 28 8 5 DECODE_RAW_HEADER PRO cccoccccccnnnnnnnnnonononononononononononononononononono nono no nono nono no nono no no n nn nn nanna 30 9 0 GET lt SELBCTEDPRO ti A A A A i ea i A ma e A sence 33 AO PNE ERD Y DESA A LO EEEE i a tee 33 SUS IRAS RUN PRO A ta E EES REES EA A eh A E N 36 AO IV EERE U TILSEPROL wit io an A E E E tt E AOA 37 5 10 e JMAGES PRO EEA A A E AEAEE AEE 39 8 11 3READ CONF PRO 224222323 0803 00 sang BI ale deeds NAN ANS BILAN AN BANG 40 Sv Z0RESOURCES BRO tiers s2080 e ied E EE Abg NN baa SA RES UN Abala ana Ga kab EE 41 8 13 VIGNETTING PRO 1 22 anan ian nan pn di Tat e La a pa ab So bocado ari o allan 41 8 14 TEST LEAKS PRO si GAPAN Galen oe Pace Tr NI LAG RAT ANAL 44 SAN TEST LIST PRO A tE 45 SiG TRAS SH AN A A AA AE AG 45 Sl BUILD DY A A 46 8 18 MAKE RELEASE SH tirita PB nG Dandan Gb ahas bra an bagon 47 8 19 CHECK STYLE SH i i Sri a A A A 47 8 20 FIX IDL INDENTATION PY 00000000200000064 600000 6000006065 4044406606 664540 4424 SNS E NSSSSS
25. begin assert equal objs gt get_item i i 123 1 end for i 0 9 do begin assert equal objs gt get_item i 1O y0 A 123 52 end for i 1 9 do begin assert equal objs gt get_item 1 i 123 3 objs 5del item 1 end assert equal objs gt get_item 0 123 4 objs 5del item 1 assert equal objs gt get_len 0 5 objs gt append objs gt append objs gt append objs gt append objs gt del_item 0 objs gt append 5 assert equal objs gt get_item 1 5 6 Ss WN H tmp list objs gt append tmp list destroy objs assert equal tmp gt get_len 0 6 end 8 16 iras sh bin bash exec idl e iras run 8 17 build py usr bin python f FIXME this shouldn t be hardcoded program_name IRAS Image Reduction and Analysis Software vere program_version Version 5s LAHI copyright and stuff Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi A Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful
26. bjs gt append 1 2 3 objs 5del item 2 obis 7 debug dump objs gt append list OA A A AOS Ss 5 AA XxX 346 350 354 358 362 366 370 374 378 382 386 PIO OO Ouse OG OO 671943 649727 637885 626816 612178 603236 590232 655810 972983 000000 000000 ye lt 0 76 50 yc 50 yc 50 osservatorio iras memory_leaks txt AOS OA OA OA OS A So gt 347 351 355 359 363 367 Sly SES 3197 383 387 RPPOOOOOOOO 665469 645708 636110 622625 609577 600965 586175 733639 000000 000000 000000 SS A AOS AA AY Xx nano mm LY objs gt get_item 1 gt append list objs gt get_item 1 gt append abc def 123 list_destroy objs gt get_item 1 gt get_item 0 list_destroy objs gt get_item 1 objs gt del_item 1 7 0bjs 75 debug dump print get mem start objs gt append abc def list destroy objs print get mem start end the following list should print lt NullPointer gt print ptr valid end 8 15 test list pro this does a number of basic tests on list it doesn t test for memory leaks run with idl e test_list pro assert_equal a b s if a ne b then begin print Error s end end pro test_list objs list use 10 items to be sure to trigger a list resize for i 0 9 do begin objs gt append i 123 end for i 0 9 do
27. but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt LELES default_blurb program_name copyright_and_stuff tmp prefix version for line in open iras gui pro rb line line strip if line startswith tmp prefix FIXME use a regex for all this stuff line line len tmp prefix version line line index break print repr version prefix run f open iras pro wb f write program name program version version copyright and stuff for line in open iras run pro rb if line startswith prefix line line len prefix strip s open line pro rb read FIXME the removal of the blurb maybe should be more flexible assert s startswith default blurb line s s len default blurb f write file s pro n n line f write s f write n f write pro iras iras gui end TABO f close 8 18 make release sh bin bash WARNING call build py immediately before a new release usage make release sh VERSION NUMBER iras dir iras FIXME shouldn t be hardcoded if it s the current dir if e iras pro a e Siras dir iras pro
28. bute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version if This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt FIXME this path should really be configured in the preferences path expand path 4 home lino osservatorio idl solarsoft all path WARNING the order of the following statements is important import H first the dependencies and then the code that uses then run read conf run list run get selected run get close small run get skip run get tO run get tl run get t2 run get t3 run get t4 run get warning run resources run decode raw header run misc utils run gui low level run raw images run vignetting run image utils run iras gui iras gui 8 9 misc utils pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio
29. can contain arbitrary objects and associative arrays as a matter of fact one of the more useful long term results of the IRAS development is probably the implementation of a fast resizeable list that can contain any IDL data type the IDL memory model including its latest OOP additions is abysmally awful absolutely insufficient for the development of complex GUI programs and barely above the functionality offered by the standard C libraries it s probably not a coincidence that IDL is one of the very few languages that don t have an integrated development environment written in the language itself the standard IDL IDE is written in Java see the chapter Lessons learned for more details on this subject IDL dumps all functions and classes including the ones from the standard library any loaded third party library and the program itself in a single global namespace making name collisions relatively frequent and very dangerous especially in medium to large programs and making forward compatibility to new IDL versions which can include new functions more a wishful hope than anything that can be counted on by default IDL uses only 16 bits for integers and what s worse the overflows are ignored and silently return the wrong result even for simple calculations where the need for more than 16 bits can be detected at compile time the IDL GUI libraries while in theory cross platform have different quirks and small incom
30. d parties 7 Conclusions In this short report the main features of the IRAS system have been presented In particular it has been shown how its architecture gives high flexibility to the software allowing to load and keep in memory an arbitrary number of images and intermediate results making it relatively easy to use and resulting in a fast work flow even for complex scientific calibration sequences IRAS can also be used on different operating systems and IDL versions These result has been obtained by using a number of programming techniques as illustrated in previous chapters of this report 8 Appendix A Source code 8 1 default conf txt UV ph ph ph XC VC IRAS configuration parameters default values exp 40 UV images exposure time in seconds photometric calibration Units ph cm 2 s sr DN s bin otometric VL 1 8e 11 09 04 02 data otometric H 5e 9 f estimated from component level measurements otometric He 7 9e 48 09 04 02 data Conversion Digital Number DN bin gt ph cm 2 s sr E g DN photometric He uv exp occulter center position 0 0 is the lower left corner 230 268 8 2 iras gui pro No Ne Ne Ne Ne Ne Ne Ne A Ne Ne Ne e NG Se Ne So Se IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyrigh
31. de OPEN BRACKET MODE next extra indent line index 4 1 elif line count gt line count mode OPEN_BRACKET_MODE next extra indent line index elif line count gt line count mode OPEN BRACKET MODE next extra indent line index 4 1 elif in line and line endswith and all c in valid name chars for c in line line index or line startswith common start mode IN COMMAND MODE next extra indent indent siz else for s in dedent start if line s or line startswith s indent indent siz current indent indent for s in indent start if line startswith s indent indent siz for s in indent end if line endswith s indent indent siz elif mode OPEN BRACKET MODE if line count x line count or line count lt line count or line count lt line count mode NORMAL MODE next extra indent 0 elif mode IN COMMAND MODE if not line endswith mode NORMAL MODE next extra indent 0 if not orig line print else print 4x current indent extra indent orig line extra indent next extra indent 8 21 img2idl py usr bin python import sys import Image for filename in sys argv 1 FIXME do proper arg parsing assert in filename prefix filename
32. de images applies the corresponding operation to every pixel of two selected images 4 5 3 Polarization Menu The Polarization menu contains only a single command Build polarized image creates a pB image requires three or four images with different polarizations If only three images are supplied the angle corresponding to the missing one must be signaled by pressing the red skip icon 5 Lessons learned Apart from the small IDL graphic limitation and quirks perhaps the most important detail to pay attention to when building any non trivial IDL program is the memory allocation This is due to the very limited IDL memory management capabilities is especially true for most IDL GUI applications and any program that must load variable amount of data or need a flexible work flow Common symptoms of these problems is IDL programs that are limited to a fixed number of data sets loaded in memory at the same time e g earlier IRAS versions where limited to a maximum number of 5 images in memory making them impractical to use in a real world scenario or heavily leak memory due to hard to find bugs often requiring the end user to regularly close and reopen the IDL development environment to free the excess memory used Details about the IDL limitations that cause these problems and suggested workarounds and best practices are documented in the following sections 5 1 The IDL memory model IDL has two different memor
33. dgets prev_image imgs current_img widgets prev_name imgs get current name imgs gui select widget widgets info icon tv imgs warning true 1 return end if ev valu q Remove dark count then begin reset status widgets if not ia image exists images 0 then begin if O then begin FIXME dummy dialog message Image not loaded error return end if not ia image exists images 1 then begin if O then begin FIXME dummv dialog message Dark not loaded error return end image imgs get image imgs 0 imgs get image imgs 1 image imgs get image imgs widgets prev image imgs get current image imgs name dark imgs get current name imgs removed from widgets prev name 4 short name dark removed imgs append imgs image name short name widgets imgs get exp imgs widgets prev image return end if ev value eq Multiply images amp amp widgets status eq 0 then begin if imgs get len imgs eq 0 then begin dummv dialog message No image loaded error return end widgets status 6 widget control widgets info_bar set value Select multiplier widgets prev image imgs current img widgets prev name imgs get current name imgs gui select widget widgets info icon tv imgs warning true 1 return end if ev value eq Multiply images then begin reset status widgets if not ia image exists ima
34. e the following regex catches obfuscated code like string 142b 4 string 165b 4 string 147b bad regex re compile r string s s you should never use the following commands unless you know exactly what you are doing dangerous commands spawn call external indent start function pro case indent end begin dedent start end endif endcase endfor endelse endwhile endrep endswitch IDL sucks common start common valid name chars ascii letters digits indent size 4 def warning s sys stderr write WARNING s An T NORMAL_MODE OPEN_BRACKET_MODE IN_COMMAND_MODE range 3 indent extra_indent next_extra_indent 0 mode NORMAL_MODE for line in fileinput input assert t not in line do an expand first orig line line strip line orig line lower for bad command in bad commands if bad command in line warning this line may contain malicious code r orig line if bad regex search line is not None warning this line may contain obfuscated code r orig line for dangerous command in dangerous commands if dangerous command in line warning this line may contain dangerous code r orig line if ty An lane line orig line orig line index strip current indent indent if mode NORMAL MODE if line count 5 line count mo
35. e because redrawing a nearbv thumbnail mav overwrite a part of the highlight for the current image imgs display thumbnail imgs imgs current img 1 widgets end remove space for one more thumbnail gui resize thumbnails area widgets imgs data gt get_len 1 1 end pro imgs append imgs image name short name widgets exp img info if n elements img info eq 0 then begin img info get empty img info exp end disp image fix image for display image widgets disp size thumb size get thumb size widgets thumbnail imgs create thumbnail imgs disp image img info thumb size img data image image disp image disp image thumbnail thumbnail img info img info name name short name short name imgs data gt append img data add space for one more thumbnail gui resize thumbnails area widgets imgs data gt get_len 1 1 imgs select image imgs imgs data gt get_len 1 widgets 7 scroll to the end of the thumbnails if necessary FIXME should be in gui low level pro widget control widgets thumbs set draw view 0 0 end 8 8 iras run pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi H Maurizio Pancrazzi This program is free software you can redistri
36. e doesn t affect memory 5 allocation and can be ignored F 2 there s a ptr new in init each time a list is created and a bi corresponding ptr free in cleanup cleanup also has a ptr free bi for any remaining item in the list A 3 _resize is roughly equivalent to creating a new list and deleting A the old one so it has both ptr_new and ptr_free 4 each time an item is added to the list there s a ptr_new and each A time an item is removed there s a ptr_free A 5 set item is equivalent to a removal followed by an insertion so it has both ptr new and ptr free gt 6 never use heap_fr pro list_ define dummy list len 0 items ptr_new end function list init yes this double pointer madness is necessary to make this work in IDL self items ptr new ptrarr 1 return 1 7 success end pro list cleanup Both the following statements are required the first frees any remaining items in the list including null pointers and dangling pointers in the overallocated area at the end of self items but apparently IDL doesn t mind the second frees self items itself the ptrarr ptr free self items ptr free self items end function list get len return self len end function list decode index index if index lt self len or index ge self len then begin FIXME this should raise an exception or something maybe simply call is exit FIXME make th rror mes
37. ecode any information included by the camera in the headers of the raw images The software is also able to do basic image calibration dark removal shutterless correction devignetting photometric calibration and includes a few utility functions like multiplication and division of two arbitrary images and can build a pB polarized brightness from three or four polarized images Each step should be performed in a specific and documented order to obtain significant calibrated data but IRAS also offers the flexibility to test each calculation or any subset of them on its own This capability is often useful for quick tests before the full calibration parameters for the whole work flow are available IRAS can save the final calibrated data as well as any intermediate result as a FITS file It has integrated default values for many calibration parameters of the SCORE cameras but 1t can also read them at runtime at any time from external text files with a simple syntax The released source code includes an example parameters file with values identical to the internal defaults Moreover IRAS offers the possibility of opening an arbitrary number of images limited only by available virtual memory on the system and keeps in memory by default all intermediate results of calculations This allows quick tests with intermediate results without restarting a calibration sequence from the beginning when an error is made Any loaded image or calculation
38. ect return end FIXME the code for calculating q 0 seems seriously brain damaged nimages D y_size thumb size126 id INDGEN nimages ypositions D y size thumb size426 idt1 q WHERE ypositions lt ev y AND ypositionstthumb size gt ev y cnt if cnt ne O then begin n q 0 if n lt imgs_get_len imgs then begin imgs_select_image imgs n widgets if widgets status eq 1 then begin redirect 1 uvalue menu v value Remove dark count end else if widgets status ge 2 widgets status le 5 then begin pb skip 0 redirect 1 uvalue menu ev value Build polarized image end else if widgets status eq 6 then begin redirect 1 uvalue menu ev value Multiply images end else if widgets status eq 7 then begin redirect 1 uvalue menu ev value Divide images end end end if redirect eq 0 then begin return end end Il ct Il ct if uvalue eq info icon then begin if ev release eq 1 amp amp widgets status ge 2 amp amp widgets status le 5 amp amp widgets pb_skipped eq 0 then begin pb skip 1 redirect 1 uvalue menu ev value Build polarized image end else begin return end end if uvalue eq main image click then begin if ev releas q 1 then begin if ev press eq 1 then begin see the description above about ev press if imgs get draw pro end end jothis iSsra elie if widgets statu sz wl sz 1
39. elected skip return get skip tO return get t0 ti return get t1 t2 return get t2 t3 return get t3 ta return get t4 warning return get warning end end 8 13 vignetting pro No Ne Ne Ne Ne Ne Ne Ne A Ne Ne SNe e IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt function remove_vignetting image radius xc vc FIXME these are preliminary values xy 0 00 0 000000 33 56 0 000000 67 76 0 000000 101 63 0 000000 135 51 0 000000 169 39 0 000000 203 27 0 000000 237 15 0 000000 271 02 0 0094
40. ersion This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt this file contains misc image and data bookkeeping utils function imgs create thumbnail imgs image orig img info thumb size image congrid image orig thumb size thumb size FIXME keep aspect ratio seqnum imgs digits gt get_item img_info seqnum thumbnail image image seqnum seqnum return thumbnail end pro imgs display thumbnail imgs n selected widgets img data imgs data gt get_item n display thumbnail widgets img data thumbnail image img data thumbnail seqnum n selected img data short name end function fix image for display image orig disp size normalize the image for display size image orig s 1 FIXME maybe swap w and h S 2 f w ne disp size or h ne disp size then begin FIXME maybe should keep the aspect ratio image b congrid image orig disp size disp size make a copv to avoid changing the original image end else begin image b image orig s w h ak end The following two lines are necessary otherwise histogram below freaks out
41. f items NG Ne Ne Se self items ptr_new new_items no copy end self len new_len end pro list _debug_dump print allocated n_elements self items print len self len for i 0 self len 1 do begin print i self items i end end function list get item index return self items self 5 decode index index end pro list set item index value si self 5 decode index index ptr free self items i self items i ptr new value end pro list del_item index 1 self gt _decode_index index ptr free self items i if i lt self len 1 then begin self items i self len 2 self items i l self len 1 end self 5 resize 1 end pro list append value self o resize 1 don t use self 5set item 1 value since set item assumes that the previous value is valid and must be deallocated and this mav introduce Very nasty bugs in rare situations e g if resize 1 leaves in items self len a copy of items self len 1 self items self len 1 ptr new value end FIXME move the following comment at the top of the module this must be called by the user failing to do so results in a memory leak pro list destroy self obj destroy self end function list return obj new list end 8 5 decode raw header pro IRAS Image Reduction and Analysis Software Copyright C 2007
42. filename rfind FIXME do something smart out get_ prefix pro assert out filename f open out wb f write function get prefix n im Image open filename f write return byte w h im size for y in range h L 1 ING LEY KCh Ts f write 3 there should be one more space her f write for x in range w a str im getpixel x y b if xxw 1 else f write a replace replace replace b IDL 6 3 has problem f write n f write n f write endin f close if y gt 0 else s with very long lines E so split every row 8 22 img2idl sh bin bash cd data for filename in close small png t 0 4 png warning png do echo Sfilename img2idl py filename mv get S basename Sfilename png pro done
43. ges 0 then begin if O then begin FIXME dummy dialog message Image not loaded error return end if not ia image exists images 1 then begin if O then begin FIXME dummv dialog message Dark not loaded error return end image imgs get image imgs 0 imgs get image imgs 1 image float imgs get image imgs widgets prev image imgs get current image imgs name multiply imgs get current name imgs by widgets prev name 4 short name multipiv imgs append imgs image name short name widgets imgs get exp imgs widgets prev image end return if ev value eq Divide images amp amp widgets status eq 0 then begin end if imgs get len imgs eq 0 then begin dummv dialog message No image loaded error return end widgets status 7 widget control widgets info bar set value Select divisor widgets prev image imgs current img widgets prev name imgs get current name imgs gui select widget widgets info icon tv imgs warning true 1 return if ev value eq Divide images then begin reset status widgets if not ia image exists images 0 then begin if O then begin FIXME dummy dialog message Image not loaded error return end if not ia image exists images 1 then begin if 0 then begin FIXME dummy dialog message Dark not loaded error return end j
44. he GNU General Public License as published bv the Free Software Foundation either version 3 of the License or at vour option anv later version his program is distributed in the hope that it will be useful ut WITHOUT ANY WARRANTY without even the implied warranty of ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the U General Public License for more details ORGY You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt function get white rect w h return make array w h value 255 byte end function get y from top y height return ld v size y height end function get thumb size widgets return widgets thumb size end pro gui resize thumbnails area widgets prev size delta FIXME prev size can be calculated from d y size but first do a 9 gui_select_widget widgets thumbs ystep widgets thumb_size 26 hstart 10 if prev_size delta eq 0 then begin w 1 IDL doesn t like zero sizes h 1 end else begin w widgets thumb_size 10 2 h ystep prev_size delta hstart end Backup the contents of thumbs and restore them after resize because th IDL GUI libraries from ITT VIS are nothing more than a big pile of rotting waste and they sometimes corrupt the widget contents during the resize e g IDL 7 0 6 on Linux when a part of the window is hidden
45. ico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt No Ne Ne Ne Ne Ne Ne Ne Ne IP NG e pro read_default_conf widgets widgets uv_exp 40 widgets photometric_VL 1 8e 11 widgets photometric_H 5e 9 widgets photometric_He 7 9e 8 widgets xc 230 widgets yc 268 end pro read_conf filename widgets FIXME a better way to do this line bytarr 1000 line 64 line string line openr lun filename get_lun for i 1 file lines filename do begin FIXME test with missing last newline readf lun line n strpos line if n ne 1 then begin line strmid line 0 n end line strtrim line if line eq then begin continue end tmp strsplit line extract name strtrim
46. image imgs_get_image imgs 0 imgs_get_image imgs 1 image float imgs_get_image imgs widgets prev image imgs_get_current_image imgs name divide imgs_get_current_name imgs by widgets prev name 4 short name divide imgs append imgs image name short name widgets imgs get exp imgs widgets prev image end if 467 531 531 LG return v valu q Remove vignetting then begin FIXME ask the operator the center if imgs get len imgs eq 0 then begin dummv dialog message No image loaded error return end if not imgs image exists imgs then begin dummv dialog message No image loaded error l return end image remove vignetting ia get image images current image 512 image remove vignetting imgs get current image imgs 512 467 name vignetting removed from imgs get current name imgs short name vignetting imgs append imgs image name short name widgets imgs get current exp imgs end return if ev valu q Remove vignetting 2 then begin FIXME ask the operator the center if imgs get len imgs eq O then begin dummy dialog message No image loaded error return end if not imgs_image_exists imgs then begin is dummy dialog message No image loaded error i return end image remove_vignetting2 ia_get_image images current image 512 4
47. img Bx1ot 6x10 B saot 2x10 o 100 260 300 4006 500 600 in a 100 200 300 400 500 600 in Cameras VLD Exp 20 s dark Image no 4 pB seq no 3 LCVR temp 29 0 C CCD temp s 0 0 C The main window in the IRAS GUI is composed by 1 the menu near the top of the window 2 the thumbnail column along the left side of the window 3 the currently selected image at the center of the window 4 the details panel on the right hand side of the window An unlimited number of images can be loaded at the same time the current one can be selected by clicking on the corresponding thumbnail 4 2 Standard calibration sequences Calibrated image Calibrated image 4 3 Dependencies IRAS requires a working IDL environment mostrly tested with ITT IDL 7 06 but IDL 6 3 and 7 1 are also know to work and a subset of the SolarSoft libraries They can be installed by unpacking the file solarsoft iras 1 zip provided alongside IRAS in a new directory under the subdirectory lib of the IDL installation e g C Programmi ITT IDL70 under Windows Alternatively they can be installed in any directory as long their current location is added to the IPATH directories in the IDL preferences 4 4 Running IRAS Unpack the file iras x vz zip in a new directory On Microsoft Windows start the IDL development environment open the file iras pro and start IRAS with the command iras or by click
48. imgs get current name imgs short name He calib imgs append imgs image name short name widgets 1 return end if ev value eq Build polarized image amp amp widgets status eq 0 then begin if imgs_get_len imgs eq 0 then begin dummy dialog_message No image loaded return error 0 deg ignore t end widget widget deg widget_ widget_ his angle gui_se tv im return end if ev valu s status 2 s pb_skipped 0 string byte 176 control implicit Latin 1 encoding widgets info bar set value pB select lst image control widgets img name set value Click SKIP above to lect widget gs skip widgets info icon true 1 e eq Build polarized image amp amp widgets status ge 2 amp amp widgets status le 4 then begin ignore t deg if pb n end el n wi gu tv end case w 23 en 3 en 4 en end widget widget_ if pb wi end el wi angle end return end his if ev valu reset if wid tm end el tmp0 end if wid tmpl end el tmpl end if wid tmp2 end el tmp2 end if pb tmp3 end el tmp3 string byte 176 a skip eq 0 then begin imgs current img se begin 1 dgets pb_skipped implicit Latin 1 encoding widgets status 1 i select widget widgets info icon imgs warning true 1 idgets status of begin s 2nd image 45 deg widgets pbl n d begin s 3rd image 9
49. ly unused q 075 35569 0393 21246 u 6487 361 72306 1779 tb p22 tca 4 p23 td p24 tb p32 G4 p33 td psa with 3 images E degrees skip string image_to_skip 1 FIXME delete this line 45 angles for i 0 angles end case image_ 1 begi angles im0 iml im2 end 2 begi ang im0 iml im2 end 3 begi ang im0 iml im2 end 4 begi ang im0 iml im2 end end p 1 tl ti Print ip pinv p Printy P p q u CO CO CO imo p imo p end pB sqrt u 2 return pB end function sc_inverse UB 450425 3 do begin i dtor 89 68 13652 FIXME to_skip of n there has to be a better way to do this b angles 1 angles 2 angles 3 aa n les angles 0 angles 2 angles 3 a c d n les angles 0 angles 1 angles 3 ao n les angles 0 angles 1 angles 2 a b c s 2 angles 0 s 2 angles 1 s 2 angles 2 sin 2 sin 2 sin 2 angles 0 x angles 1 x angles 2 NAM Ur r r os SN invert p invert p 0 0 1 2 iml pll ami PEL im2 p 2 im2 p 2 q 2 n diag below above IF above EQ 0 THEN above 1 0d 200 wt above doubl wt below doubl above diag below diag wt above l wt above 1 wt below l wt below 1 power above dblarr
50. mage main image info bar info bar info icon info icon img name img name S profile x profile x profile y profile y S close icon get image close small selected get image selected not selected get white rect 116 132 uv exp 0 0 photometric VL 0 0 photometric H 0 0 photometric He 0 0 xc 0 0 yc 0 0 for i 1 get raw header info size do begin WARNING value must be a single space not an empty string otherwise the widget will disappear changing the vertical space it uses which seems undesiderabl widgets camera_info gt append widget label col3 value dynamic_resize align_left end pro end pro end widget_control window realize try to deuglify the white dot gui_resize_thumbnails_area widgets 1 1 this is necessary on Windows otherwise the widget_draws are black gui_clean_all widgets gui_select_widget widgets info_icon erase jread conf default conf txt widgets read default conf widgets FIXME use the cleanup parameter for xmanager to register a procedure that frees all the memory mostly lists maybe also things in common to be friendlier for users that use IRAS from IDLDE without IDL restarts between IRAS restarts xmanager iras_gui window event_handler handle_gui_event no_block reset_status widgets widgets status 0 widget_control widgets info_bar set_value gui_select_widget
51. n misc infos thumbnails thumbs widget draw coll button_events uvalue thumbs_click H xsize thumb size 10 2 ysize thumbs total height 7 x scroll size thumb size 10 2 idl_quirkl 3 v scroll size disp size idl quirk2 thumbs widget draw coll button events uvalue thumbs click xsize 1 ysize 1 x scroll size thumb size 10 2 idl quirki y scroll size disp size idl quirk2 main image area at the center of the window main image widget draw col2 button events motion events uvalue main image click xsize disp size vsize disp size rightmost column contains misc infos info widget base col3 row info icon widget draw info button events uvalue info icon xsize 16 ysize 16 case version os family of FIXME test this shit on win linux macos see usr share fonts X11 misc fonts alias for a list of GNU fonts unix font 9x15 else font 15 end info bar widget_label info value dynamic_resize font font img name widget label col3 value dynamic_resize align left print WIDGET INFO info bar FONTNAME profile x widget draw col3 xsize 296 ysize 180 profile y widget draw col3 xsize 296 ysize 180 widgets camera info list status 0 disp size disp size thumb size thumb size thumbs thumbs prev image 1 prev name pbl 1 pb2 1 pb3 1 pb4 1 pb skipped 0 main i
52. n IDL OOP Ever This advice is very non obvious since the official IDL documentation and well respected sources in books and on line articles suggest its use to be sure to free all memory used by an instance even allocated deep in a complex object tree On first sight the alternative ptr free seems to be more prone to errors since the programmer must carefully call it in the correct order for every manually allocated object in a class instance But heap free is nonetheless not an option for a very basic design flaw it completely ignores object boundaries and happily free the memory of all nested even if it belongs to instances of a different class that may not have been properly deallocated yet and or objects that are still used elsewhere in the program remember class instances are the only variables in IDL that can have multiple references to the same object This means that heap free completely violates three principles of object oriented programming abstraction encapsulation and decoupling It s very important to understand that this is not only an abstract purity problem but it has practical consequences e g a change in a program that seems to work perfectly fine can cause unexpected and very hard to debug problems in a completely unrelated part of the code because heap free has prematurely an inner object that other parts of the program are still using And a somewhat even worse consequence is that when the cause of the bug is f
53. on the run green icon On other operating systems its also possible to simply double click on the file iras sh 4 5 Menus The menu is composed by three submenus File Calibration and Polarization and a Exit button that causes to application to exit immediately 4 5 1 File Menu The File menu contains the following commands Read RAW read raw files img produced by the SCORE cameras LCVR sequence numbers associated with images produced by the VL detector are automatically recognized and displayed as a small number from 1 to 4 near the image thumbnail Read FITS read an image from a FITS file Read parameters read new calibration parameters from a text file see the file default_conf txt for an example of the correct file format Save as FITS saves the currently selected image as a FITS file Exit exits the program immediately 4 5 2 Calibration Menu The Calibration menu contains the following commands Remove dark count subtracts the selected image dark from the current one the data frame Shutterless correction apply a shutterless correction for images acquired with the SCORE UV detector to the current image Remove vignetting two different algorithms that apply a devignetting filter to the current image Photometric calib three different calibrations for H He and VL images Multiply divi
54. ound the most obvious way to fix it is often postponing the call to heap free or removing it altogether Again this results in a program that apparently works but that leaks memory a bug that is usually very hard to find and fix properly Even when used correctly heap free is a bug waiting to happen during future program maintenance Experience with many IDL programs suggests that the end result is that the burden of dealing with memory leaks often shifts on the end user that faces programs that use an increasing amount of system memory when it s restarted multiple times without closing the IDL development environment or even over the course of a single run of the program End users are often trained to consider this inevitable and to close and reopen IDL each time a program is launched The right way to face this problem short of switching to a high level programming language is a careful use of ptr free As a basic rule each command that allocate memory e g object that are pointed to by a ptr new but not the ptr new object itself unless it s in turn referenced by another pointer needs a corresponding ptr free and each command that allocates a new object obj new needs a corresponding obj destroy and the class is then responsible for defining a proper cleanup method that in turn usually calls one or more times ptr free This is very low level memory management similar to the one required by C or similar languages and it s
55. our option any later version his program is distributed in the hope that it will be useful ut WITHOUT ANY WARRANTY without even the implied warranty of ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the U General Public License for more details axon You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt function raw read image filename fi file info filename size fi size if size eq 9245031 then begin image read binary filename data dims 2150 2150 data start 31 data type 12 endian big end if size eq 551046 then begin image read binary filename data dims 536 514 data start 36 data type 12 ndian little image transpose 65535 image end if size eq 32 1088 1024 2 then begin IDL sucks really hard if size eq 2228256 then begin image read binary filename data dims 1088 1024 data_start 32 data_type 12 endian big end return image end function get_vld_header filenam fi file info filename size fi size if size eq 551046 then begin openr lun filename get_lun header bytarr 40 readu lun header free_lun lun return header 35 pB sequence number end return 0 end 8 11 read_conf pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomen
56. patibilities between operating systems moreover the ITT VIS implementation on GNU Linux uses an obsolete and quite ugly graphic toolkit see Compatibility and quirks below for more details Overall the experience with this project suggests that for future development of new programs other languages should be carefully considered A language that seems to be increasingly popular in astronomy is Python coupled with the SciPy library Tools exist to convert IDL programs to Python and the Harvard University and the Space Telescope Science Institute offer on line reference guides with equivalent Python constructs for IDL users 3 1 Compatibility and quirks There are a number of incompatibilities small quirks and outright bugs in the ITT VIS IDL implementation on different operating systems A common example is inconsistent functionality in the graphics widgets on different operating systems There are a number of workarounds for them in IRAS they are well documented with comments and can be found grepping the source for quirk and workaround An important and often overlooked limitation of IDL 6 3 is a very small maximum line length for source code If there are lines that go over about 100 characters they should be carefully tested in IDL 6 3 4 User manual 4 1 GUI overview IRAS Image Reduction and Analysis Software Y 115 LI File Calibration Polarization Exit pos 454 131 5 51480 00 20020101 001331 VIS 04
57. rams this usually means that end users have to manually change the current directory to the one containing the source files from within the IDL development environment possibly recompile them if one has been changed and run an helper script each time the program must be run This is clearly suboptimal because it puts an heavy burden on end users for something that ideally should be as simple as clicking a program icon The overall root of the problem is that apparently there s no way for an IDL program to automatically determine its source file location on the file system and hence the location of the other program modules and any data file required e g icons or configuration defaults IRAS solves this problem by keeping its source code neatly split over multiple files to ease maintenance but it also includes a small utility build py that merges all files required to run IRAS in a single stand alone IDL file iras pro This file includes all the IRAS source an helper function also called iras and also all the program icons which usually reside in the data directory converted to IDL functions that return 2D for grayscale images or 3D for color icons matrices identical to the corresponding images as read by IDL The end result is a single file iras pro that the end user can start from the command line with the command idl e iras or open from the IDL integrated development environment and run right away without the need for changing
58. result can be deleted at any time and its corresponding allocated memory is immediately freed independent of the on which the images where loaded or generated this is not trivial to accomplish in IDL see the chapter Lessons learned for details about how this has been accomplished IRAS also automatically promotes internally the data from 16 bits integers to 32 bits or to floating points as required to keep it accurate based on the exact sequence of operations executed by the end users 2 Architecture overview IRAS is written entirely in IDL and the source distribution includes a few utility programs used for its development written in Python or as bash scripts These utilities are not required by end users running IRAS but they are useful for its development Their necessity steams from the requirements that IRAS should be easily usable and be able to run and being modified on IDL implementations by ITT Visual Information Solutions including installations using trial personal use only licenses Unfortunately these are somewhat conflicting goals since IRAS is a medium sized project the IDL source code alone is near 80 kiB spread over a few thousand lines of code it s highly desirable that its code should be split over several source files to ease code development and maintenance But trial IDL versions from ITT VIS don t offer the possibility of packing multiple source files together for easy distribution For other IDL prog
59. rk exp 20 end end 3rd info No of images after start comand nima camerainfo B 0 and 15 if nima lt 10 then begin FIXME camerainf0o 2 Image no tstring nima format I1 end else begin camerainf0o 2 Image no tstring nima format I2 end 4th info LCVR Temperature msb camerainfo_B 1 most significant Byte lsb camerainfo_B 2 least significant Byte if msb gt 128 then begin msb msb and 127 msb 1 msb end temp float msb 256 float 1sb 10 deg string byte 176 implicit Latin 1 encoding camerainfo 4 LCVR temp string temp format F5 1 deg GA 5th info pB sequence no seqnum camerainfo B 3 camerainfo 3 pB seq no string seqnum format I1 6th info CCD temperature msb camerainfo_B 4 most significant Byte lsb camerainfo_B 5 least significant Byte if msb gt 128 then begin msb msb and 127 msb 1 msb end temp float msb 256 float 1sb 10 camerainfo 5 CCD temp string temp format F5 1 deg Ln print Image name string hdr 0 31 iprint Camera header camerainfo 0 5 img_info camerainfo camerainfo seqnum seqnum exp exp return img_info end 8 6 get_selected pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi
60. sage more user friendly print IndexError list index out of range index self len n elements self items end i index don t change the original value if i lt 0 then begin i self len end return d end pro list resize delta len this gives constant time amortized speed for append algorithm stolen from the CPvthon list implementation but their code is bug free new len self len 4 delta len allocated n elements self items if allocated lt new len or new len lt allocated 2 then begin mild over allocation not exactly identical to CPython since we start from 1 not from 0 and this code is less sophisticated FIXME this formula doesn t do well when doing del item and len lt 10 new allocated new len new len 8 4 if new len eq O then begin new allocated 1 IDL sucks end new items ptrarr new allocated min len min new len self len print min len n elements self items n elements new items if min len ne O then begin FIXME the next line is probably wildly inefficient maybe use 2 codepaths for shrink and enlarge new items 0 min len 1 self items 0 min len 1 end WARNING without the following ptr fr IDL leaks memory but at the same time this shouldn t be a heap fr because otherwise IDL will free all the objects e g another list that are contained within this list ptr_free sel
61. t C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi Maurizio Pancrazzi This program is free software vou can redistribute it and or modifv it under the terms of the GNU General Public License as published bv the Free Software Foundation either version 3 of the License or at vour option anv later version his program is distributed in the hope that it will be useful ut WITHOUT ANY WARRANTY without even the implied warranty of ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the U General Public License for more details ORGY You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt IRAS a k a SDDAS SCORE DDAS SCORE Data Display and Analysis Software Aug 23 2007 version 0 0 Nov 6 2008 version 0 1 Nov 27 2008 version 0 2 No Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne Ne NG NG Dec 11 2008 version 0 3 Jan 20 2009 version 0 4 Jan 29 2009 version 0 5 Feb 13 2009 version 0 6 Feb 23 2009 version 0 7 Mar 6 2009 version 0 8 Mar 18 2009 version 0 9 Mar 23 2009 version 0 10 Mar 23 2009 version 0 11 Mar 23 2009 version 0 12 Apr 17 2009 version 0 13 May 8 2009 version 0 14 Jun 1 2009 version 0 50 Jun 5 2009 version 0 51 Jun 9 2009 version 0 52 Jun 10 2009 version 0 53 Jun 12 2009 version 0 54 Jun 12 2009 version 0 55 J
62. th bak_path workaround for an IDL bug return end read_conf file widgets return end if ev valu q Save as FITS then begin end if not ia_image_exists images current image then begin if imgs_get_len imgs eq 0 then begin dummy dialog_message No image loaded error return end image ia_get_image images current image image imgs_get_current_image imgs bak_path last_path file dialog pickfile filter l t fits fit write path last_path get_path last_path if file eq then begin last path bak path workaround for an IDL bug return end fits_write file imag return if ev value eq Shutterless corrrection then begin if not ia_image_exists images current image then begin if imgs get len imgs eq O then begin dummy dialog message No image loaded error return end image ia get image images current image image imgs get current image imgs exptime 4 0 shutless2 image exptime imageout name shutterless of imgs get current name imgs short name shutterless imgs append imgs imageout name short name widgets imgs get current exp imgs end return if ev valu a Remove dark count widgets status eg 0 then begin if imgs_get_len imgs eq 0 then begin dummy dialog_message No image loaded error return end widgets status 1 widget_control widgets info_bar set_value Select dark wi
63. the current directory or recompiling the project IRAS is used by users running multiple ITT VIS IDL versions including at least IDL 6 3 7 0 and 7 1 on different operating system GNU Linux Mac OS X and Microsoft Windows It should be able to run on any combination of these platforms see the chapter Compatibility below for further details on this subject 3 The choice of the programming language IDL has been chosen as the programming language for IRAS for a number of reasons it s the only programming language know by all members of the SCORE project that contributed code or that are expected to be able to read it and potentially change it in the future it s the language used by previous programs in SCORE and related projects it s a quite popular language in the astronomy community while this seems to be increasingly less true there s still an huge body of useful astronomy related functions and libraries available on line often usable under free software open source licenses Unfortunately there are a few drawbacks IDL was created in 1977 and the core languages has not evolved much since then this implies a very verbose syntax that often allows sloppy programming styles efforts have been made to keep a clean and consistent programming style over IRAS with correct indentation IDL lacks any high level data types even basic ones offered by all modern programming languages like resizeable lists lists that
64. ther version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt IDL_List version 0 3 Variable sized dynamic array that can contain values of any type and can have size zero heavily ispired by the Pyhon list class Each time you put a value in a list a copy of the value is created and only the copy itself is stored in the list the only exception are object variables i e class instances since IDL never makes copies of objects FIXME maybe support the temporary function to avoid copies of arguments passed to apppend and set_item by changing set_item to something like H copy value A self items 1 ptr new copy no copy FIXME document that copies of lists are never created Poro a A a list A b a H simply creates two references aliases to the same list This is ji guaranteed as part of the list public interface r IMPORTANT basic rules of thumb for memory management in this implementation A 0 never use heap_fr A 1 ptr_new without arguments in list defin
65. tmp 0 value float tmp 1 help name value case name of uv exp widgets uv exp valu photometric VL widgets photometric VL value photometric H widgets photometric H value photometric He widgets photometric He valu xc widgets xc valu yc widgets yc valu end end free_lun lun end 8 12 resources pro IRAS Image Reduction and Analysis Software Copyright C 2007 2008 2009 Osservatorio Astronomico di Torino Copyright C 2009 Lino Mastrodomenico Copyright C 2009 Maurizio Pancrazzi Authors Silvio Giordano Lino Mastrodomenico Silvano Fineschi 5 Maurizio Pancrazzi This program is free software you can redistribute it and or modify it under the terms of the GNU General Public License as published by the Free Software Foundation either version 3 of the License or at your option any later version This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details You should have received a copy of the GNU General Public License along with this program If not see lt http www gnu org licenses gt function get_image nam FIXME is this ok return read png data name png Case name of close small return get close small selected return get s
66. ts not_selected 2 get_y_from_top y 2 132 end tvscl image x get_y_from_top y 26 thumb_size ofs_num 2 tv seqnum x ofs_num get_y_from_top y 10 16 tv widgets close_icon close_x get_y_from_top y 10 14 true 1 xt x ofs num 4 16 FIXME 16 is the width of seqnum yt y 10 wt close_x xt ht 16 add a bit of spacing xt 4 wt 6 itv get white rect wt ht 0 75 xt get_y_from_top yt ht FIXME remove this clip xt get_y_from_top yt ht 1 1 xt wt 1 get y from top vt 1 idl quirk baseline offset 4 color 0000ff x FIXME remove this xyouts xt get_y_from_top yt 4 ht name device clip clip noclip 0 color 0 end pro delete_thumbnail widgets n gui select widget widgets thumbs thumb size widgets thumb size ystep thumb size 26 y n ystep tv widgets not_selected 2 get_y_from_top y 2 132 end pro display_image widgets image camerainfo name gui_select_widget widgets main_image tvscl image widget_control widgets img_name set_value nam for i 0 widgets camera_info gt get_len 1 do begin s camerainfo i if s eq then begin with an empty string the widget will disappear changing the vertical space it uses which seems undesiderable so use a single space LI LI DM re xe Na end widget_control widgets camera_info gt get_item i set_value s end end pro draw_profile
67. un 12 2009 version 0 56 Jun 17 2009 version 0 57 Jun 19 2009 version 0 58 Jun 19 2009 version 0 59 Jun 25 2009 version 0 60 Jun 29 2009 version 0 61 Jul 7 2009 version 0 62 Jul 8 2009 version 0 63 Jul 10 2009 version 0 64 Jul 10 2009 version 0 65 Jul 10 2009 version 0 66 Jul 20 2009 version 0 67 Jul 22 2009 version 0 68 Oct 1 2009 version 1 0 Oct 9 2009 version 1 1 Oct 9 2009 version 1 2 Nov 6 2009 version 1 3 Nov 19 2009 version 1 4 Nov 20 2009 version 1 5 pro iras_gui common data_structures last_path imgs widgets version 1 5 keep this updated app_name IRAS Image Reduction and Analysis Software workaround for an IDL 7 0 bug on X Linux see http www dfanning com misc tips window retain html device retain 2 device decomposed 1 force 24 bit colors Ip background ffffff x white p color 0 apparently this doesn t do anything disp size 520 main image size in pixels thumb size 100 thumbnails image size jmax images 0 max number of images loaded at the same time thumbs total height thumb size 26 max images 10 thumbs total height 1 last path workarounds for an IDL GUI bugs quirks idl quirkl 2 case lversion os family of unix idl quirk2 29 else idl quirk2 0 end imgs data list digits list warning get image warning skip get image skip current img 1 7 1 means no image for i 0 4 do begin imgs digits
68. with Array has too many elements for images with high dynamic range 7 e g after photometric calibration Did I mention that IDL sucks for scientific calculations image b min image b image b 1000 0 max image b nans where finite image b nan if size nans 0 ne O then begin in IDL 7 0 histogram below craps out on NaN yes even with nan image b nans 0 end hist histogram image b 16 disp size 16 16 disp size 16 omax max v cut black disp size 32 2 0 1000 cut white disp size 32 2 0 999 1000 start v min v end v max V FIXME this looks slow a 0 for j 01 n elements hist 1 do begin c hist if c ge cut black then begin start v min_v j break end end c 0 for j 01 n_elements hist 1 do begin c hist if c ge cut white then begin end v min_v j break end end image_b where image_b le start v start v image b where image b g nd_v end v return image b end function imgs get len imgs return imgs data gt get_len end function imgs image exists imgs return imgs data gt get_len ne 0 end function imgs get image imgs index return imgs data gt get_item index image end function imgs get current image imgs return imgs data gt get_item imgs current_img image end function imgs get current name imgs return imgs data gt get_item imgs current_img name end end end end pro
69. y management modes one for OOP class instances and one for everything else pretty much basic IDL data types They are detailed in the IDL manual but what s interesting to note is that what they both have in common is that IDL doesn t keep automatically track and frees memory when there s the possibility of more than one reference at the same time to the same physical memory block This can be the result of the influence of implementation limitations on the language design Proper memory management with correct reference counting and or automatic garbage collection is very hard and despite the official IDL documentation mentioning reference counting apparently IDL only keeps a single free used status bit on all automatically freed variables and leaves to the programmer the burden to free class instances or objects referenced by pointers This leads to a number of undesirable results all assignments always create a copy of an object which can be suboptimal if the object is e g several megabytes in size assignments to a slice don t modify the original array there the possibility of memory leaks or null pointer dereferences if the programmer is not extremely careful when using classes and pointers which unfortunately are strictly required to overcome the aforementioned limitations of the basic types in non trivial programs 5 2 Best practices in IDL OOP and memory allocation Never under any circumstance use the command heap free i

Download Pdf Manuals

image

Related Search

Related Contents

A seismic streamer heading sensor for only $799. Yes, $799. (No  Z-Noise User Manual  全ページ [PDFファイル/6.72MB]    Espectrofotómetros SPECTRONIC GENESYSTM  to view this document  Samsung AR09JSFNCWKN - AR5000  M319 Manual castellano.cdr  Manual de instruções WEIGHTRAC 31  2015-2016 Residence Hall Handbook - Illinois Institute of Technology  

Copyright © All rights reserved.
Failed to retrieve file