summaryrefslogtreecommitdiffstats
path: root/ds9/library/nvss.tcl
blob: a2352e321ef182c769c7e90c0d5d2e567be20a00 (plain)
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
#  Copyright (C) 1999-2018
#  Smithsonian Astrophysical Observatory, Cambridge, MA, USA
#  For conditions of distribution and use, see copyright notice in "copyright"

package provide DS9 1.0

proc NVSSDef {} {
    global nvss
    global invss

    set invss(top) .nvss
    set invss(mb) .nvssmb

    set nvss(sky) fk5
    set nvss(rformat) arcmin
    set nvss(width) 15
    set nvss(height) 15
    set nvss(mode) new
    set nvss(save) 0
}

proc NVSSDialog {} {
    global nvss
    global invss
    global wcs

    if {[winfo exists $invss(top)]} {
	raise $invss(top)
	return
    }

    set varname dnvss
    upvar #0 $varname var
    global $varname

    set var(top) $invss(top)
    set var(mb) $invss(mb)
    set var(sky) $nvss(sky)
    set var(skyformat) $wcs(skyformat)
    set var(rformat) $nvss(rformat)
    set var(width) $nvss(width)
    set var(height) $nvss(height)
    set var(mode) $nvss(mode)
    set var(save) $nvss(save)

    set w $var(top)
    IMGSVRInit $varname "NVSS [msgcat::mc {Server}]" \
	NVSSExec NVSSAck ARDone ARError

    IMGSVRUpdate $varname
}

proc NVSSExec {varname} {
    upvar #0 $varname var
    global $varname

    if {$var(save)} {
	set var(fn) [SaveFileDialog savefitsfbox]
	if {$var(fn) == {}} {
	    ARDone $varname
	    return
	}
    } else {
	set var(fn) [tmpnam {.fits}]
    }

    # skyformat
    switch -- $var(skyformat) {
	degrees {
	    set xx [uformat d h: $var(x)]
	    set yy [uformat d d: $var(y)]
	}
	sexagesimal {
	    set xx $var(x)
	    set yy $var(y)
	}
    }
    regsub -all {:} $xx { } xx
    regsub -all {:} $yy { } yy

    # size - degrees
    switch -- $var(rformat) {
	degrees {
	    set ww [expr $var(width)]
	    set hh [expr $var(height)]
	}
	arcmin {
	    set ww [expr $var(width)/60.]
	    set hh [expr $var(height)/60.]
	}
	arcsec {
	    set ww [expr $var(width)/60./60.]
	    set hh [expr $var(height)/60./60.]
	}
    }

    set var(query) [http::formatQuery submit Submit! Equinox J2000 PolType I RA $xx Dec $yy Size "$ww $hh" Cells "15.0 15.0" MAPROJ SIN Type image/x-fits rotate "0.0"]

#    set var(query) [http::formatQuery .submit "Extract the Cutout" RA "$xx $yy" Equinox J2000 ImageSize $rr MaxInt 10 .cgifields ImageType ImageType "FITS Image"]
    set url "http://www.cv.nrao.edu/cgi-bin/postage.pl"
    IMGSVRGetURL $varname $url
}

proc NVSSAck {varname} {
    upvar #0 $varname var
    global $varname

    set msg {Acknowledgments for the NRAO VLA Sky Survey

This major undertaking has received the generous technical and
scientific support of many individuals. The NRAO staff has provided
extremely valuable assistance in many aspects of the observations
themselves and in the area of software support; in particular, we are
grateful to Rick Perley, Ken Sowinski, Barry Clark, and Bill Cotton in
this regard. The support of the NRAO Director, Paul van den Bout, and
the yeoman service provided by Frazer Owen as Chair of the Survey
Oversight Committee are also greatly appreciated. We also thank the
members of the Oversight Committee (Ken Chambers, Eric Feigelson,
Jackie Hewitt, Gillian Knapp, and Rogier Windhorst) for their time and
wise counsel in this enterprise.

Acknowledgment is also due our colleagues who are involved in the
ongoing NVSS effort, including Richard McMahon and Isobel Hook. This
work is supported in part under the auspices of the Department of
Energy by Lawrence Livermore National Laboratory under contract
No. W-7405-ENG-48 and the Institute for Geophysics and Planetary
Physics, whose director Charles Alcock has been particularly
supportive. We also acknowledge a generous planning grant from the
CalSpace Institute; support from the STScI archive group, STScI
director Bob Williams, and the STScI Director's Discretionary Research
Fund; computing resources from Columbia University; a grant from the
National Science Foundation; a gift of computing equipment from Sun
Microsystems; a NATO travel grant to support our collaboration with
Richard McMahon; and an award from the National Geographic Society
which, in the spirit of their support 40 years ago for the Palomar
Observatory Sky Survey, will be providing funds to continue our
charting of the Universe.
    }

    SimpleTextDialog ${varname}ack [msgcat::mc {Acknowledgment}] \
	80 40 insert top $msg
}

# Process Cmds

proc ProcessNVSSCmd {varname iname} {
    upvar $varname var
    upvar $iname i

    NVSSDialog

    nvss::YY_FLUSH_BUFFER
    nvss::yy_scan_string [lrange $var $i end]
    nvss::yyparse
    incr i [expr $nvss::yycnt-1]
}

proc ProcessSendNVSSCmd {proc id param {sock {}} {fn {}}} {
    global parse
    set parse(proc) $proc
    set parse(id) $id

    NVSSDialog

    nvsssend::YY_FLUSH_BUFFER
    nvsssend::yy_scan_string $param
    nvsssend::yyparse
}