This file is indexed.

/usr/share/saods9/src/examine.tcl is in saods9-data 7.3.2+repack-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#  Copyright (C) 1999-2014
#  Smithsonian Astrophysical Observatory, Cambridge, MA, USA
#  For conditions of distribution and use, see copyright notice in "copyright"

package provide DS9 1.0

proc ExamineDef {} {
    global pexamine

    # prefs only
    set pexamine(mode) new
    set pexamine(zoom) 4
}

proc ButtonExamine {which x y} {
    if {![$which has fits]} {
	return
    }

    switch -- [$which get type] {
	base {ButtonExamineBase $which $x $y}
	rgb {ButtonExamineRGB $which $x $y}
	3d {ButtonExamine3D $which $x $y}
    }
}

proc ButtonExamineBase {which x y} {
    global current
    global ds9
    global pexamine

    # this code will not handle mosaics.

    # current coord
    set coord [$which get coordinates $x $y physical]

    # find filename/slice
    set fn [$which get fits file name full canvas $x $y]
    for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	set slice($ii) [$which get fits slice $ii]
    }

    # so the new frame will have all of the parent frame when created
    set ds9(next) $which
    GotoFrame

    # create frame if needed
    switch -- $pexamine(mode) {
	new {CreateFrame}
	one {
	    if {[info exists pexamine(one)]} {
		if {$which == $pexamine(one)} {
		    # do nothing, we clicked in the examine frame
		    return
		}
		DeleteSingleFrame $pexamine(one)
		CreateFrame
		set pexamine(one) $current(frame)
	    } else {
		CreateFrame
		set pexamine(one) $current(frame)
	    }
	}
    }

    # go to tile mode in case
    set current(display) tile
    DisplayMode

    # load data
    LoadFitsFile $fn {} {}

    RealizeDS9

    # set slice
    for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	$current(frame) update fits slice $ii $slice($ii)
    }

    # zoom to about
    if {[$current(frame) has fits bin]} {
	set bf "[$current(frame) get bin factor]"
	set bx [expr [lindex $bf 0]/$pexamine(zoom)]
	set by [expr [lindex $bf 1]/$pexamine(zoom)]
	$current(frame) bin factor to $bx $by about \
	    [lindex $coord 0] [lindex $coord 1]
    } else {
	$current(frame) zoom $pexamine(zoom) $pexamine(zoom) \
	    about physical [lindex $coord 0] [lindex $coord 1]
    }

    # back to original frame
    set ds9(next) $which
    GotoFrame

    # update any dialogs
    UpdateDS9
}

proc ButtonExamineRGB {which x y} {
    global current
    global ds9
    global pexamine

    # this code is far from perfect. It assumes data is loaded into the red
    # and it is the keychannel. Furthermore, it assumes either images or bin
    # tables are loaded into each channel, but not both.
    # this code will not handle mosaics.

    # save current channel
    set channel [$which get rgb channel]

    # current coord
    $which rgb channel red
    set coord [$which get coordinates $x $y physical]

    # find filename/slice
    foreach cc {red green blue} {
	$which rgb channel $cc
	set fn($cc) [$which get fits file name full canvas $x $y]

	for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	    set slice($cc,$ii) [$which get fits slice $ii]
	}
    }

    # so the new frame will have all of the parent frame when created
    set ds9(next) $which
    GotoFrame

    # create frame if needed
    switch -- $pexamine(mode) {
	new {CreateRGBFrame}
	one {
	    if {[info exists pexamine(one)]} {
		if {$which == $pexamine(one)} {
		    # do nothing, we clicked in the examine frame
		    return
		}
		DeleteSingleFrame $pexamine(one)
		CreateRGBFrame
		set pexamine(one) $current(frame)
	    } else {
		CreateRGBFrame
		set pexamine(one) $current(frame)
	    }
	}
    }

    # go to tile mode in case
    set current(display) tile
    DisplayMode

    # load data
    foreach cc {red green blue} {
	$current(frame) rgb channel $cc

	if {$fn($cc) != {}} {
	    LoadFitsFile $fn($cc) {} {}
	}
    }

    RealizeDS9

    # set slice
    foreach cc {red green blue} {
	$current(frame) rgb channel $cc
	for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	    $current(frame) update fits slice $ii $slice($cc,$ii)
	}
    }

    # zoom to about
    $current(frame) rgb channel red
    if {[$current(frame) has fits bin]} {
	foreach cc {red green blue} {
	    $which rgb channel $cc
	    $current(frame) rgb channel $cc

	    set bf "[$current(frame) get bin factor]"
	    set bx [expr [lindex $bf 0]/$pexamine(zoom)]
	    set by [expr [lindex $bf 1]/$pexamine(zoom)]
	    $current(frame) bin factor to $bx $by about \
		[lindex $coord 0] [lindex $coord 1]
	}
    } else {
	$current(frame) zoom $pexamine(zoom) $pexamine(zoom) \
	    about image [lindex $coord 0] [lindex $coord 1]
    }

    # set channel
    $current(frame) rgb channel $channel

    # back to original frame
    set ds9(next) $which
    GotoFrame
    $current(frame) rgb channel $channel

    # update any dialogs
    UpdateDS9
}

proc ButtonExamine3D {which x y} {
    global current
    global ds9
    global pexamine

    # this code will not handle mosaics.

    # current coord
    set coord [$which get coordinates $x $y physical]

    # find filename/slice
    set fn [$which get fits file name full canvas $x $y]
    for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	set slice($ii) [$which get fits slice $ii]
    }

    # and 3d info
    set rr [$current(frame) get 3d view]
    set az [lindex $rr 0]
    set el [lindex $rr 1]
    set method [$current(frame) get 3d method]

    # so the new frame will have all of the parent frame when created
    set ds9(next) $which
    GotoFrame

    # create frame if needed
    switch -- $pexamine(mode) {
	new {Create3DFrame}
	one {
	    if {[info exists pexamine(one)]} {
		if {$which == $pexamine(one)} {
		    # do nothing, we clicked in the examine frame
		    return
		}
		DeleteSingleFrame $pexamine(one)
		Create3DFrame
		set pexamine(one) $current(frame)
	    } else {
		Create3DFrame
		set pexamine(one) $current(frame)
	    }
	}
    }

    # go to tile mode in case
    set current(display) tile
    DisplayMode

    # load data
    LoadFitsFile $fn {} {}

    RealizeDS9

    # set slice
    for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} {
	$current(frame) update fits slice $ii $slice($ii)
    }

    # zoom to about
    if {[$current(frame) has fits bin]} {
	set bf "[$current(frame) get bin factor]"
	set bx [expr [lindex $bf 0]/$pexamine(zoom)]
	set by [expr [lindex $bf 1]/$pexamine(zoom)]
	$current(frame) bin factor to $bx $by about \
	    [lindex $coord 0] [lindex $coord 1]
    } else {
	$current(frame) zoom $pexamine(zoom) $pexamine(zoom) \
	    about physical [lindex $coord 0] [lindex $coord 1]
    }

    # set 3d
    $current(frame) 3d view $az $el
    $current(frame) 3d method $method

    # back to original frame
    set ds9(next) $which
    GotoFrame

    # update any dialogs
    UpdateDS9
}

# Prefs

proc PrefsDialogExamine {} {
    global dprefs

    set w $dprefs(tab)

    $dprefs(list) insert end [msgcat::mc {Examine}]
    lappend dprefs(tabs) [ttk::frame $w.examine]

    # Examine
    set f [ttk::labelframe $w.examine.mode -text [msgcat::mc {Mode}]]

    ttk::radiobutton $f.new -text [msgcat::mc {New Frame each Time}] \
	-variable pexamine(mode) -value new
    ttk::radiobutton $f.one -text [msgcat::mc {Examine Frame}] \
	-variable pexamine(mode) -value one

    grid $f.new -padx 2 -pady 2 -sticky w
    grid $f.one -padx 2 -pady 2 -sticky w

    set f [ttk::labelframe $w.examine.mag -text [msgcat::mc {Magnification}]]

    ttk::radiobutton $f.x1 -text {1x} -variable pexamine(zoom) -value 1
    ttk::radiobutton $f.x2 -text {2x} -variable pexamine(zoom) -value 2
    ttk::radiobutton $f.x4 -text {4x} -variable pexamine(zoom) -value 4
    ttk::radiobutton $f.x8 -text {8x} -variable pexamine(zoom) -value 8
    ttk::radiobutton $f.x16 -text {16x} -variable pexamine(zoom) -value 16

    grid $f.x1 $f.x2 $f.x4 $f.x8 $f.x16 -padx 2 -pady 2 -sticky w

    pack $w.examine.mode $w.examine.mag -side top -fill both -expand true
}