Best SNR

I feel like the discussion of the maximum of SNR (signal-to-noise ratio) will benefit my thesis, because my boring mathematical derivation can easily occupy some space to lengthen the number of pages.

To make things easy, I assume that the signal of the observed target can be described by a Gaussian distribution, namely,

I(\rho) = I_{0} \exp \left(-\frac{\rho^2}{2 \sigma^2} \right) ,

where I_{0} is some referenced intensity, \rho is the radius to the centre of the source, and \sigma describes its FWHM. The integrated intensity of the source within an aperture r is then calculated from

F(\rho) = \int_{0}^{\rho} 2 \pi r I(r) \mathrm{d}r.

After doing some simple algebra the result is simply

F(\rho) = 2\pi \sigma^2 I_{0} \left[1 - \exp \left(-\frac{\rho^2}{2\sigma^2} \right) \right] .

The SNR of the source is given by the following equation:

\mathrm{SNR} = \frac{F}{\sqrt{F + \pi \rho^2 f}}.

For simplicity, we assume the sky background remains constant across the targeted signal source, so f can be regarded as a combination constant value related to the sky background intensity and the readout noise of the CCD. To obtain the maximum SNR, we ought to find out when \mathrm{d~SNR} / \mathrm{d} \rho = 0 , which can be transformed to

 F' F + 2 f \pi \rho^2 F' - 2 f \pi \rho F = 0,

where F' = 2 \pi \rho I_{0} \exp \left(-\frac{\rho^2}{2 \sigma^2} \right).

With some algebra, this equation can be changed to

\left(k e^{-u} - 1 \right) \left(1 - e^{-u} \right) + 2u e^{-u} = 0 ,

where k = I_0 / f, and u = r^2 / 2\sigma^2 . Unfortunately, this is a transcendental equation so I cannot find out its solution analytically. Instead, let me use the numerical method.

Assuming the targeted source is very faint, which means that k \to 0, I obtain \rho \approx 1.6 \sigma. Conversely, if the source is extremely bright, i.e., k \to \infty, then we have \rho \approx \sqrt{2 \ln k} \sigma .

Anyway, the best-SNR radius as a function of k is plotted in the following figure. Note that I have converted the radius in FWHM by using \mathrm{FWHM} = \sqrt{2 \ln 2} \sigma \approx 2.355 \sigma .

best_snr

In conclusion, using \rho \approx 1 FWHM looks to be a good choice.

Best SNR

Observation Run at KPNO (Mar 2017)

My colleague Ariel and I went to KPNO near Tucson for our observation run just right before the spring break.

Day 1 (Mar 21)

The flight from LAX to Tucson was ~ 8 am, so I had to wake up at ~ 5:15 am, and then quickly packed up my backpack. After eating some leftover bánh trôi in the fridge, I set off to catch the 6am Flyaway At the Westwood. Within half an hour, I arrived at LAX, where I met Ariel an hour later. The flight was smooth. On board I recognizes your destination – KPNO in distance, thanks to the super obvious signature just next to KPNO,  Baboquivari Peak. Of course all the domes appeared as small what dots merely.

We took a Uber to the KPNO in downtown Tucson, on campus of University of Arizona. Since the shuttle wouldn’t leave until 11 am, Ariel and I walked around the campus very briefly, but soon we decided not to continue because the temperature was scorching. Actually I’ve visited the campus three years ago during the DPS. However, it was at night so I didn’t see things clearly. It turned out to be that Ariel and I were the only two persons going to KP, and Ariel had to drive the shuttle.

IMG_3908
The bicentennial Moon tree in UA’s campus. Last time I saw it in dark.

The drive was ~1.5 hrs. The weather atop KP was visually perfect, although the wind was pretty strong. Starving we were, we devoured quite a lot at the cafeteria. We then went to the 36″ dome, waiting for Flynn, who showed up ~2:30 pm and gave us some very brief instructions on operating the dome and the telescope. Basically we still remember every procedure because our last visit was three months ago only. Flynn mentioned that recently there have been several reports of bear and mountain lion witness around KP and asked us to be cautious.

Ariel and I were both exhausted, so we went back to the dorm and took a nap. After dinner, we met at the dome and started working. Ariel arrived earlier. When I got there, she was taking flats already. Having adjusted the focus of the telescope by taking images of θ Gem, we started observations. Our targets were all comets, SPCs and LPCs. We did plan to observe some unusual asteroids with TJ < 2, including several Damocloids, but eventually didn’t have enough time. During the early run, we unconsciously stuck the telescope because the pointing exceeded the minimum altitude limit twice. As a result, the telescope had to be manually slewed by me through a control panel upstairs. We have now been experts on this!

We observed a PCCP object YF982D7 through BVRI filters. I quickly calibrated all the images, and measured astrometry. No cometary feature can be seen from our coadded images. It finally was designated as 2017 EF12 by the MPC on Day 3, so the cometary feature wasn’t confirmed at all. I’m wondering if some observer has been fooled by bad seeing. Otherwise it’d be quite interesting and exciting, were it a comet; it has a low-eccentricity orbit, and the semimajor axis is small too.

Before daybreak, we attempted to observe several newly discovered comets, such as C/2017 E4 (Lovejoy), only to realise that the influence from the Moon was awfully serious, so had to give up. The observing run ended at ~5:40 am, when the twilight became too strong.

After taking a shower, I went to bed and felt asleep soon.

Day 2 (Mar 22)

I woke up several times around noon, and forced me to sleep. Finally I got up at 4 pm and went to have dinner (breakfast in reality). The weather had been overcast, but the cloud dispersed and revealed a crystal clear sky before sunset. I went to the dome and met Ariel there. Again she was taking flats.

IMG_3918
The scene around Baboquivari in the south viewed from the dome.

As the twilight faded, we began the observing run with the synoptic observation about a variable star in the region of M42, which happened to be the only observed target tonight. As soon as we finished taking BVRI images of it, we saw the instruction of shutting down the dome, due to the strong wind and rising humidity. So we did. The humidity went up quickly and reached ~100% later. Ariel left the dome around 2 am, and I left around 4 am.

On the way back I felt the ambience a bit horrible. The smog was pretty strong; I could hardly see things beyond ~5 m even with a torchlight. The gust kept producing weird noise. Anyway, I successfully made my way to the cafeteria, and ate some hot soups there.

IMG_3920
The spicy chicken soup.

Before I went to bed, it started raining. What a night!

Day 3 (Mar 23)

Again I woke up several times before the time I planned to get up. This is equivalent to suffering from jet-lag. Before I went to have my dinner, there were considerable amounts of clouds in the sky. But fortunate enough, they dispersed towards dusk. The temperature was also much colder.

We still had plenty of time after having finished taking flats. To kill the time I was busy calibrating images from Day 1 and performing astrometry. Of course I couldn’t finish the all before the sky got dark enough. So we adjusted the focus. I should point out that seeing was extremely awful. However we changed the focus, images of field stars looked fat. Anyway we began the observing run with 128P, which somehow appeared fainter than expected, perhaps due to the fact that the twilight was still there a bit.

Around 9:30 pm, a staff (I forgot his name) brought some visitors into our dome, showing them “what astronomers are doing”. It didn’t last for long, and they left within ~15 min. We then concentrate back on imaging comets. During the run we did attempt to observe Damocloid 2015 RK245, but we couldn’t spot it in individual images.

Before the end, we observed comet C/2017 E4 (Lovejoy), which appeared super bright. Judging from the morphology, it’s a gassy one. It moved pretty fast too. We obtained 10-ish images, which did give us enough SNR of it. We finally challenged the telescope a bit by observing another bright comet C/2017 E1 (Borisov) — then the twilight had been quite strong already. We did get it, but way less impressive than C/2017 E4, maybe because of the bright sky background. The session ended at ~5:45 am. The slender crescent moon looked amazing in the eastern sky.

Day 4 (Mar 24)

Maybe I’m really aging; I again woke up first at 12pm, and then woke up every hour. I dreamed a lot, probably due to which I didn’t sleep well. Anyway, the weather for this observing run appeared to be the best since we arrived at KP; the humidity was low enough, <~ 40%, basically windless, and the temperature was pretty steady, ~9 ℃. As a result, seeing was way better than on Day 3.

We began the observing run from comet C/2010 U3 (Boattini), in Perseus, followed by the synoptic observation of the M42 field. Comet C/2017 C1 (NEOWISE) was observed successfully. Originally we expected it to be faint, since no one had observed it since Feb, but it turned out to be a good one. It was readily visible in individual images, moving fast. The synoptic observation also required us to observe a field containing ρ Oph, so we wasted some time on this.

IMG_3929
My night lunch for Day 4. The highlight is that spoon. Because I couldn’t find a spoon, I had to make one from foil. It looked fancy, even like from the antiquity, but actually functioned awfully…

The session was ended with C/2017 E1 (Borisov). Compared to Day 3, we were able to get two more images before the twilight was too bright.

Day 5 (Mar 25)

I slept a bit better today, at least my first wakeup was close to 1pm. I could clearly remember what I dreamed during the sleep — my family, and my calligraphy teacher 張老師, and his master pieces. He suffered from a stroke last Sept, resulting in weak disability of his right arm. Since then I had had quite a lot of dreams, in which he had convalesced and could write things as before. But a good thing is that I’ve heard that he’s getting better and better.

KP_pano
Pano pic of KP, taken by my phone.

The late afternoon witnessed a considerable amount of clouds. But thanks to them, I enjoyed a spectacular sunset. The clouds were like burnt, against a violet background of the sky. As time evolved they changed their shapes. I was simply standing outside and looking at the sky, doing nothing else. As one of my favourite things in my childhood which I did a lot was looking at the sky during sunsets, the scene certainly brought me back, just like yesterday once more. I thought I were only a little kid at a moment.

IMG_4010
The awesome sunset view, taken by my phone.

I went back into the dome after the show faded. The clouds were great decorations during the sunset, but form a bad thing for our observing run. The dome was shut down because of them. We had to wait till ~11 pm until the sky turned clear. Our first target was 315P, which displayed a fan-shaped broad tail. A super bright comet we observed was C/2015 ER61 (PANSTARRS), which was initially discovered as an asteroid by Pan-STARRS, but later a cometary feature was found.

This day’s observing run ended again by observing C/2017 E1. Earlier, our advisor Dave emailed us asking whether we’d observed it; it might be a potentially disintegrating candidate due to the rotational instability. Frankly I didn’t think about this point, but just thought that we shall observe it to improve the orbit; the current solution was still pretty nasty, because we saw a significant discrepancy between the observed and predicted positions. Anyway, this time we put more efforts to this comet, and we were able to obtain seven R-band images on it.

Before going back to the dorm, we saw the very elegantly thin crescent Moon rising in the east.

Day 6 (Mar 26)

I finally managed to adapt to the timezone for astronomers, which is good. But unfortunately it was the last day of our observing trip, which is bad.

We planned to end the whole KP observing run by observing C/2017 E1 again. However, for some reason an attempt image showed that the image quality couldn’t be even more nasty, and thus we decided to observe C/2013 C2 (Tenagra), which was predicted to be bright enough, provided that the prediction didn’t go wrong. It hadn’t been observed for almost a year, based on the MPC. So we did. But we couldn’t see anything obvious, so at least it wasn’t that bright. I haven’t yet reduced the data. Maybe something will show up, hopefully.

It’d been pretty bright at the time we shut down the dome. I knew that Venus should be visible, so on the way back we searched for it for awhile. Indeed we managed to spot it by naked eye! It just passed the inferior conjunction with the Sun a day ago! This definitely becomes my record of seeing Venus closest to the Sun during non-transits by naked eye. Alas my camera was left in my office, a bit pity.

IMG_3973
Before I left the dome, I drew a super ugly graffiti of a man’s head. It used to be a maze but then I thought it was kinda boring. Some observers might feel asleep during observing runs, so putting something on like this horrible may help them stay awake. I’m considerate, ain’t I?

I got up at noon the next day. Before we left the mountain I grabbed something for lunch. After checking out, Ariel and I drove back to downtown Tucson at 2 pm, and then took a Uber to the airport. Our flight was ~5:15 pm and landed in LAX an hour later. So the whole trip came to an end, but I still have to reduce and measure all the images from Day 6.

Observation Run at KPNO (Mar 2017)

Memo for WCSTools

Recently I have been more dissatisfied with astrometry.net, because no matter how I tweak the parameters, some portions in an image can never have catalogue stars’ positions overlaid with the corresponding actual stars. I also have learnt that astrometry.net only provides crude solutions to plate constants of images, and therefore, if one needs high-quality astrometry, WCS by astrometry.net is not accurate enough yet, and other better astrometric software should be used. This is the reason why I need to use WCSTools.

The following is simply a memo to record my steps to install the software. My reference is basically from this webpage.

(1) Download the latest version of WCSTools (3.9.4).

(2) Go to the directory where the file is downloaded, and type in the following commands to install it:

$ tar xvfz wcstools-3.9.4.tar.gz
$ cd wcstools-3.9.4
$ make all

(3) Now the environment needs to be set:

$ sudo cp wcstools /usr/local/bin/
$ sudo cp ./bin/* /usr/local/bin/
$ sudo cp libwcs/*.h /usr/local/include/
$ sudo cp libwcs/libwcs.a /usr/local/lib/

(4) Test the installation:

$ wcstools

(5) You should see a very lengthy message including the version of the software, as well as a number of programme names. The following is what I can get (truncated):

WCSTools 3.9.4 Programs
http://tdc-www.harvard.edu/software/wcstools/

addpix:    Add a constant value(s) to specified pixel(s)
bincat:    Bin a catalog into a FITS image in flux or number
char2sp:   Replace this character with spaces in output (default=_)
conpix:    Operate on all of the pixels of an image
cphead:    Copy keyword values between FITS or IRAF images
crlf:      Change CR's to newlines in text file (for imwcs, imstar logs)
delhead:   Delete specified keywords from FITS or IRAF image file headers
...

Since I am using an online servers to visit star catalogues, the environment variables such as the following ones have been set:

setenv UB1_PATH http://tdc-www.harvard.edu/cgi-bin/scat
setenv SAO_PATH http://tdc-www.harvard.edu/cgi-bin/scat
setenv UCAC3_PATH http://tdc-www.harvard.edu/cgi-bin/scat

Note that I haven’t yet figured out how to connect to catalogue UCAC4. Apparently WCSTools cannot cope with the newly released Gaia either.

As still being in a process of learning the software, I may update this post infrequently in the future.

Memo for WCSTools

SOHO-3165

Today saw my first success of establishing an orbital linkage for a SOHO comet, SOHO-3165 , with observations from three consecutive apparitions. I have never done this work on my own — all the previous similar works I’ve done were either verifying Rainer’s solutions, or simply lucky because of lacking influential nongravs. SOHO-3165 doesn’t seem to be an easy one, as neither Bill nor Karl managed to get a solution. Bill managed to get a linkage with the first two apparitions, and third one was left unsuccessful with huge residuals. Therefore I was curious if I could solve this problem.

I haven’t done this job for long, perhaps over three years. As a result it took me a while before I could get onto the right track. A few tweaks of starting conditions enabled Aldo’s Exorb to get a decent orbit for the first apparition. In this step, a parabolic orbit had to be assumed. I then forced the program to solve an orbit for semimajor axis a = 3.05~\mathrm{AU}. With observations from the second apparitions the orbital solution was quickly refined. The trick was to fit for the first observation from the second apparition initially. Once the RMS decreased, more subsequent data could be fed in.

If there were no nongravs, the third apparition could be linked without much difficulty. However, this is not the case this time, which exactly complicated the computation work. In fact there is a huge offset in positions in the first observation of the third apparition (which was the only observation from the third apparition at this step). So there must be a nonzero transverse nongrav parameter. I tried A_2 = 10^{-8} \mathrm{AU ~ day}^{-2}, no success, and even worsened the solution to the previous two apparitions. Yet the program turned the optimised A_2 into a negative number, from which I immediately realised that the third apparition was postponed. Then -10^{-10}~ \mathrm{AU~day}^{-2}. Success! The program quickly shrunk the RMS of the fit. My last step was adding all the remaining observations and let the program find the best-fit solution.

soho3165

Yet seems like there is something wrong with the code about completing iterations. The code somehow continuously looked for but never succeeds in yielding a final convergence. I therefore manually paused the program. Luckily because the code was generally looping around small RMS. Although the above solution may well not have the smallest RMS, it has one close to already.

The motivation of this writing is simply to provide me as a reminder in the future about how I can obtain an orbital linkage when nonzero nongravs are presented.

SOHO-3165

Install OrbFit on My Mac

So far I have not yet fully successful with the software. But the problem may well be intrinsic in the codes, rather than mistakes during my installation. I have reported a bug to the OrbFit consortium. But anyway I think I need to record my steps of installing it, which may benefit me in the future if I want to reinstall the software.

Step 1: Download the software from the website and unzip it.

Step 2: Change the terminal to tcsh.

Step 3: Type config -O gfortran, Since I’m using gfortran. Other modes will flag -static which leads to errors of ld: library not found for -lcrt0.o.

Step 4: Type make. It should take seconds to finish.

Step 5: Download ASCII formatted of JPL DExxx to directory src/jpleph. I downloaded DE431. Edit makefile if necessary.

Step 6: Type make ephemerides. It is then converting the DExxx from ASCII to binary, which takes about 20 sec on my computer. After it completes a file called jpleph will appear.

Step 7: Copy that file to lib under the main directory of OrbFit, or goto that directory by cd ../../lib, and then type ln -s ../src/jpleph/jpleph jpleph to create an alias.

Step 8: Goto the main directory and test the installation:
make tests
where I am confronted with errors about segmentation, with the latest version OrbFit5.0.

Install OrbFit on My Mac