The “JOIN” family of operators Select

advertisement
The “JOIN” family of
operators
Select
From
Where
A1, A2,......AN
comma = cross
R1, R2,.......RN
product
condition
Remember that queries return relations (or tables)
Q2
Q1
Cross product (or comma) of two tables literally glues
the tables together
cross product
star
objID
star.objID
propermotion
objID
propermotion.objID
The “JOIN” family of
operators
Select
From
Where
A1, A2,......AN Can also do
R1, R2,.......RN explicit join of
tables
condition
The “JOIN” family of
operators
default operator in SQL
-Inner Join on condition
-Natural Join
-Inner Join using (attrbs)
-Outer join (left and right)
The “JOIN” family of
operators
default operator in SQL
-Inner Join on condition
-Natural Join
-Inner Join using (attrbs)
-Outer join (left and right)
- enforces equality on
all columns w/ same
name
-eliminates one copy
of duplicate column
The “JOIN” family of
operators
Select distinct s.ra, s.dec, s.r, s.i
From star as s, propermotion as pm
Where s.objID=pm.objID
Select distinct s.ra, s.dec, s.r, s.i
From star as s inner join propermotion as pm
on s.objID=pm.objID
The “JOIN” family of
operators: natural join
Select distinct s.ra, s.dec, s.r, s.i
From star as s inner join propermotion as pm
on s.objID=pm.objID
Select distinct ra, dec, r, i
From star natural join propermotion
The “JOIN” family of
operators: natural join
Select *
From star natural join propermotion
Will remove duplicate columns
(objID) from the result. Don’t have
to worry about ambiguity.
The “JOIN” family of
operators: natural join
Select distinct s.ra, s.dec, s.r, s.i
From star as s inner join propermotion as pm
on s.objID=pm.objID
where s.ra between 220.0 and 22.5 and s.dec
between -1.0 and 0.0
Select distinct ra, dec, r, i
From star as s natural join propermotion as pm
where s.ra between 220.0 and 22.5 and s.dec
between -1.0 and 0.0
The “JOIN” family of
operators: better practice
Select distinct ra, dec, r, i
From star as s join propermotion as pm using (objID)
where s.ra between 220.0 and 22.5 and s.dec between -1.0 and
0.0
Select distinct s.ra, s.dec, s.r, s.i
From star as s inner join propermotion as pm
on s.objID=pm.objID
where s.ra between 220.0 and 22.5 and s.dec
between -1.0 and 0.0
The “JOIN” family of
operators: better practice
Select distinct ra, dec, r, i
From star as s join propermotion as pm using (objID)
where s.ra between 220.0 and 22.5 and s.dec between -1.0 and
0.0
Better practice because there
may be 40-50 columns in a
table, and the optimizer is going
to implicitly equate any two that
are equal, so best to specify.
The “JOIN” family of
operators: better practice
Select distinct ra, dec, r, i
From star as s join propermotion as pm using (objID)
where s.ra between 220.0 and 22.5 and s.dec between -1.0 and
0.0
Better practice because there
may be 40-50 columns in a
table, and the optimizer is going
to implicitly equate any two that
are equal, so best to specify.
Note that you cannot
use a “using” clause
and an “on” clause.
That will give you an
error.
The “JOIN” family of
operators: outer join
Select distinct ra, dec, r, i
From star left outer join propermotion using (objID)
Takes row from left of the
join (star) and if it doesn’t
have a matching value in
what’s on the right, you get
NULL.
The “JOIN” family of
operators: rewrite of outer
join without using outer
join
Select star.ra, star.dec, star.r, star.i
From star, propermotion
where star.objID = propermotion.objID
union
select ra, dec
from star
where objID not in (select objID from propermotion)
A more visual approach to databases
http://www.glueviz.org/en/latest/index.html
The Great Observatories
The first element of the
program -- and arguably the
best known -- is the Hubble
Space Telescope (HST).
The Hubble telescope was
deployed by a NASA Space
Shuttle in 1990. A
subsequent Shuttle mission
in 1993 serviced HST and
recovered its full capability.
A second successful
servicing mission took place
in 1997. Subsequent
servicing missions have
added additional capabilities
to HST, which observes the
Universe at ultraviolet,
visual, and near-infrared
wavelengths.
Hubble orbits the Earth at an altitude of about 353
miles (569 kilometers). It takes about 97 minutes to
complete one orbit around the Earth. Hubble
passes into the shadow of the Earth for 28 to 36
minutes in each orbit. The orbit inclines at a 28.5degree angle.
This photo shows a team of
astronauts removing a Fine
Guidance Sensor from its
protective enclosure in the
shuttle during a servicing
mission. The Fine Guidance
Sensors were built by Hughes
Danbury Optical Systems in
Danbury, Conn.
Before Hubble can make an
observations, it must find a
pair of guide stars located
alongside the target.
Hubble has three Fine
Guidance Sensors. Two are
normally used in observations
to locate and lock onto a
target star while observations
are made with a science
instrument.
The Compton Gamma Ray Observatory (CGRO)
was the second of NASA's Great Observatories.
Compton, at 17 tons, was the heaviest astrophysical
payload ever flown at the time of its launch on April 5,
1991, aboard the space shuttle Atlantis. This mission
collected data on some of the most violent physical
processes in the Universe, characterized by their
extremely high energies.
Compton had four instruments that covered an
unprecedented six decades of the electromagnetic
spectrum, from 30 keV to 30 GeV. In order of increasing
spectral energy coverage, these instruments were the
Burst And Transient Source Experiment (BATSE), the
Oriented Scintillation Spectrometer Experiment (OSSE),
the Imaging Compton Telescope (COMPTEL), and the
Energetic Gamma Ray Experiment Telescope (EGRET).
For each of the instruments, an improvement in
sensitivity of better than a factor of ten was realized over
previous missions. Compton was safely deorbited and reentered the Earth's atmosphere on June 4, 2000.
The third member of the Great
Observatory family, the Chandra
X-Ray Observatory (CXO), was
deployed from a Space Shuttle
and boosted into a high-Earth orbit
in July 1999. This observatory is
observing such objects as black
holes, quasars, and hightemperature gases throughout the
x-ray portion of the EM spectrum.
The mirrors on Chandra are the
largest, most precisely shaped and
aligned, and smoothest mirrors ever
constructed. If the surface of Earth
was as smooth as the Chandra
mirrors, the highest mountain would
be less than six feet tall! The
images Chandra makes are twentyfive times sharper than the best
previous X-ray telescope. This
focusing power is equivalent to the
ability to read a newspaper at a
distance of half a mile. Chandra's
improved sensitivity is making
possible more detailed studies of
black holes, supernovas, and dark
matter.
The Spitzer Space Telescope
represents the fourth and final
element in NASA's Great Observatory
program. Spitzer fills in an important
gap in wavelength coverage not
available from the ground -- the
thermal infrared.
Launched into space by a
Delta rocket on August 25,
2003, Spitzer obtains images
and spectra in the infrared
between wavelengths of 3 and
180 microns.
Consisting of a 0.85-meter telescope and three cryogenically-cooled science
instruments, Spitzer is the largest infrared telescope ever launched into space.
Infrared allows us to penetrate into clouds of gas and dust, allowing us to peer into
regions of star formation, the centers of galaxies, and into newly forming planetary
systems. Infrared also brings us information about the cooler objects in space, such as
smaller stars which are too dim to be detected by their visible light, extrasolar planets,
and giant molecular clouds. Also, many molecules in space, including organic
molecules, have their unique signatures in the infrared.
The James Webb Space Telescope will also observe primarily in the infrared.
But all objects, including telescopes, also emit infrared light. To avoid swamping
the very faint astronomical signals with radiation from the telescope, the telescope
and its instruments must be very cold. Therefore, Webb has a large shield that
blocks the light from the Sun, Earth, and Moon, which otherwise would heat up the
telescope, and interfere with the observations. To have this work, Webb must be in
an orbit where all three of these objects are in about the same direction. The
answer is to put Webb in an orbit around the L2 point.
The L2 orbit is an elliptical orbit about the semi-stable second Lagrange point . It is
one of the five solutions to the three-body problem. An object placed at any one of
these 5 points will stay in place relative to the other two.
In the case of Webb, the 3 bodies involved are the Sun, the Earth and the Webb.
The gravitational forces of the Sun and the Earth can nearly hold a spacecraft at
this point, so that it takes relatively little rocket thrust to keep the spacecraft in orbit
around L2.
JWST versus Hubble
http://www.stsci.edu/hst/wfc3/tools/etcs/
Show an example on UVIS ETC page
Estimating exposure times: Spicam
Estimating exposure times: Spicam
•
18 mag ~ 595 DN/s * gain e-/ADU ~ 1988 e-/s
Error Propagation
What is the magnitude error for a star with V = 20 with S/N = 20
The S/N is the fractional error on the measure flux.
Need to convert flux error into magnitude error.
Recall that magnitude is defined as m = -2.5 log10(flux):
m
N
2.5log10 (1 + )
S
2.5
=
2.3
N
S
1 N 2
( ) + ...
2 S
1.086
=
S/N
For S/N = 10, this is a 10% error on the measured flux.
The error in magnitude for this star is V = 20 ± 0.11 mag.
<-- Taylor expand
Space Telescope
Observation Planning
•
The Astronomer's Proposal Tool (APT) is used to write,
validate and submit proposals for the Hubble Space
Telescope. (It will also be used eventually for James Webb
Space Telescope proposals.)
•
APT is a tool that consists of editors (for filling out proposal
information --Phase I), an Orbit Planner (for determining
feasibility in Phase II), a Visit Planner (for determining
schedulability, and other diagnostics), a Bright Object Tool
(for performing bright object checks), and an integrated tool
based on Aladin for viewing exposure specifications overlaid
on FITS images and querying the HST Archive.
•
There are similar tools for e.g., Spitzer Space Telescope
observations.
Show intro to APT, and Aladin videos,
create a new Phase 2 file
Download