Sunday, July 5, 2020

Automating Startup and Shutdown

When we start imaging, we have to:
  1. Turn on the Power Supply (and the mount, though we normally don't turn it off)
  2. Check if the mount is still up, and if not, start it through the MGBox v2 pulse (this only sends a pulse that will turn on the mount if it's off and turn it off if it's on, that's why we have to check first).
  3. Start the Planewave Heater Control Program (PWI3)
  4. Make sure that Dimension4 is running (to keep computer time exact)
  5. Check if the clocksync program is running, and if not, start it (to keep mount time synchronized to the exact computer time)
And at the end, do the opposite:
  1. Close clocksync
  2. Close PWI3
  3. Shutdown mount
  4. Turn off power supply
I found a couple of useful utilities/libraries:
  • dlipower - a python library to interact with the power web switch
  • MountCMD - a Java library to interact with the mount
With these, could whip up some Python code to automate both:

startup.py
import dlipower
import time
import subprocess
import socket

POWER_SWITCH_IP = "192.168.254.22"
POWER_SWITCH_USERNAME = "<username>"
POWER_SWTICH_PASSWORD = "<password>"
MOUNT_POWER_PORT_NO = 1
POWER_SUPPLY_PORT_NO = 2

MOUNT_IP_ADDRESS = '192.168.254.21'
MOUNT_PORT = 3490

MGBOX_PATH = "C:\\Program Files (x86)\\MGBox V2\\MGBox.exe"
MGBOX_COM_PORT = "COM5"

PWI_PATH = "C:\\Program Files (x86)\\PlaneWave Instruments\\PWI3\\PWI3.exe";

DIMENSION4_EXE = "D4.exe"
DIMENSION4_PATH = "C:\\Program Files (x86)\\D4\\D4.exe"

CLOCKSYNC_EXE = "clocksync_w.exe"
CLOCKSYNC_PATH = "C:\\Program Files (x86)\\10micron\\ClockSyncW\\clocksync_w.exe"

def process_exists(process_name):
    call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
    # use buildin check_output right away
    output = subprocess.check_output(call).decode()
    # check in last line for process name
    last_line = output.strip().split('\r\n')[-1]
    # because Fail message could be translated
    return last_line.lower().startswith(process_name.lower())

# --------- Turn on Mount and Power Supply ---------

# Connection parameters to web UI of power switch
switch = dlipower.PowerSwitch(hostname=POWER_SWITCH_IP, userid=POWER_SWITCH_USERNAME, password=POWER_SWTICH_PASSWORD)

print("Turning on Mount (it should not have been off, but just in case)")
switch.on(MOUNT_POWER_PORT_NO)

print("Turning on the Power Supply for all equipment")
switch.on(POWER_SUPPLY_PORT_NO)

print("Wait a little to make sure...")
time.sleep(5)


# --------- Starting Mount ----------

# We can only send an on/off pulse, i.e. we first have to check if the mount is already powered on

print("Checking if mount is started by pinging IP address")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mount_is_running = sock.connect_ex((MOUNT_IP_ADDRESS, MOUNT_PORT))
if mount_is_running != 0:
   print("Starting mount")
   subprocess.call([MGBOX_PATH, "-P", MGBOX_COM_PORT, "-T", "1500"])
   print("Wait quite a while ...")
   time.sleep(30)
else:
   print("Mount is already started!")


# --------- Starting Planewave Heater control app ---------

# The planewave app is reentrnt, i.e. we don't have to check if it's already running
print("Starting Planewave Heater Control app")
subprocess.Popen([PWI_PATH])


# --------- Making sure that Dimension4 is up and running ---
print("Check if Dimension4 is running")
if not process_exists(DIMENSION4_EXE):
   print("Start Dimension4")
   subprocess.Popen(DIMENSION4_PATH)
   print("Wait a little time to make sure ...")
   time.sleep(5)
else:
   print("Dimension4 already running. moving along ...")


# --------- Starting mount time sync -------------------------

# First, check if it's already running
print("Check if time sync program is already running")
if not process_exists(CLOCKSYNC_EXE):
   print("Starting time sync program")
   subprocess.Popen([CLOCKSYNC_PATH])
   print("Wait a little to make sure ...")
   time.sleep(5)
else:
   print("Time Sync program is already started")

print("Done")

shutdown.py
import dlipower
import time
import subprocess
import socket

POWER_SWITCH_IP = "192.168.254.22"
POWER_SWITCH_USERNAME = "<username>"
POWER_SWTICH_PASSWORD = "<password>"
MOUNT_POWER_PORT_NO = 1
POWER_SUPPLY_PORT_NO = 2

MOUNT_IP_ADDRESS = '192.168.254.21'
MOUNT_PORT = 3490

MGBOX_PATH = "C:\\Program Files (x86)\\MGBox V2\\MGBox.exe"
MGBOX_COM_PORT = "COM5"

PWI_EXE = "PWI3.exe"
PWI_PATH = "C:\\Program Files (x86)\\PlaneWave Instruments\\PWI3\\PWI3.exe";

DIMENSION4_EXE = "D4.exe"
DIMENSION4_PATH = "C:\\Program Files (x86)\\D4\\D4.exe"

CLOCKSYNC_EXE = "clocksync_w.exe"
CLOCKSYNC_PATH = "C:\\Program Files (x86)\\10micron\\ClockSyncW\\clocksync_w.exe"

def process_exists(process_name):
    call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
    # use buildin check_output right away
    output = subprocess.check_output(call).decode()
    # check in last line for process name
    last_line = output.strip().split('\r\n')[-1]
    # because Fail message could be translated
    return last_line.lower().startswith(process_name.lower())

# --------- Stopping mount time sync -------------------------

# First, check if it's running
print("Check if time sync program is running")
if process_exists(CLOCKSYNC_EXE):
   print("Stopping time sync program")
   subprocess.call(["taskkill", "/im", CLOCKSYNC_EXE])
else:
   print("Time Sync program isn't running ...  moving on ...")


# --------- Stopping Planewave Heater control app ---------

#First, check if it's running
print("Check if Planewave Heater Control app is running")
if process_exists(PWI_EXE):
   print("Stopping Planewave Heater Control app")
   subprocess.call(["taskkill", "/im", PWI_EXE])
else:
   print("Planewave Heater Control app isn't running ...  moving on ...")

# --------- Shutdown Mount -------------------------
print("Shutdown mount")
subprocess.Popen("C:\\Users\\namid\\bin\\MountCMD\\MountCMD-shutdown.bat") 
print("Wait to make sure that the mount is really turned off")
time.sleep(30)

# --------- Turn off Power Supply ---------------------

# Connection parameters to web UI of power switch
switch = dlipower.PowerSwitch(hostname=POWER_SWITCH_IP, userid=POWER_SWITCH_USERNAME, password=POWER_SWTICH_PASSWORD)

print("Turning off the Power Supply for all equipment")
switch.off(POWER_SUPPLY_PORT_NO)

print("Done")

Works like c charm! That was a fun activity!!!

Wednesday, July 1, 2020

The ML50100

The FLI ML50100 is an amazing camera. With a pixel size of 6 microns and 8176 x 6132 pixels!!!

But, boy, is it tricky to calibrate the images. There are several challenges:
  • Because of the large pixel size, the shutter is also very large - and hence slow. Flats need to be at least 8-10 seconds - otherwise the shutter will show up.
  • Being front illuminated, the chip has RBI.
  • The chip is so big, that it actually has two readouts - one for each half. And each readout has slightly different characteristics (bias, gain)
  • Richard thinks that there could be bias drift depending on Ambient temperature
Here is a (stretched) 10 min dark master frame:

And a bias master frame:


The seams are clearly visible. 

First, calibrate light frames using the master dark:

Pre-dark calibration:
If you look closely, you can see the seam in the middle ...

Post-dark calibration:

Looks pretty clean. But if I now stack my (40) luminance frames (without alignment - I just want to check if the seam is gone):


The seam is clearly still there, i.e. the individual frames weren't completely cleared up. And this was even more complicated with the flat frames. Because our flat panel broke, we had to use sky flats, i.e. the exposure time is different for each. And because of the two different halves, we can't scale our darks, i.e. we have to take darks at the same duration as the flats ...

We have three theories where this could come from:
  1. The RBI issue - though Richard said at 10 minute exposure and -15C we should see much if any
  2. The bias is dependent on the ambient temperature
  3. Our darks aren't clean (we had some darks with clear light in them - maybe they all suffer from minor light leaks ...)
I ran two experiments to check this:

1. Darks with roof closed vs. open
I took several 10 min dark frames with the roof close and the roof open (with some moonlight):
OverallLeftRight
Roof OpenRoof ClosedRoof OpenRoof ClosedRoof OpenRoof Closed
101710161011101010211019

The levels are just so slightly higher when the roof was open...

2. Bias at different ambient temperatures
I took a stack of 20 bias frames at various ambient temperatures:

Ambient Temp [C]Level - OverallLevel - LeftLevel Right
20.91,0121,0071,016
23.51,0121,0071,016
26.31,0121,0071,015
281,0101,0051,013

Not much difference - except the first step from 28 to 26.3 degrees. The difference here was that the 28 degree bias were taken with the roof close, the other when it was open...

This seems to indicate that we have some light leaks, but not so much that ambient temperature plays a role.

If this is indeed the case, then there isn't much that we can do about it now... But in a month, I'll be at the site again (for some leftover work). At that time I could take better darks by either covering the scope (in particular the front) or taking the camera off completely and take darks with the front fully covered.

Tuesday, June 23, 2020

Namid - Still lots of stuff...

After we traveled home, we decided to image M51 first. Easy, bright target, fits into our FOW. But during the next nights, quite a lot of stuff came up:
  • Turns our out polar alignment isn't great. It's 1'30" off. Nothing we can do about it now. At least our model will compensate for it. Need to improve next time somebody is at the scope.
  • 30 min exposures had slightly elongated stars. Tried to guide but that made it WAY worse. If I had to guess, I'd say it's differential flexure in some direction. Which means we can't guide right now - need to fix next time somebody is at the scope.
  • Port forward to ACP web interface and the power switch didn't work.
  • Delta-T app constantly segfaults.
    • Tried to update the firmware. But that failed.
    • Contacted Planewave support - never go a reply :-(
    • Talked to Tolga. He checked it and reduced the temperature difference of the main mirror from 2 to 1 degrees. That made it much more stable - though still fails once a night or so. He suspects that the power supply can't deliver enough power if the heaters are fully powered and other devices (camera, focuser...) are working at the same time.
      Will install second power supply plus direct power connection next time somebody is at the scope.
So, there are some things that still need to get done - planning on going early August for a week or so.

Other things we did:
  • Configure FocusMax
  • Configure Focusing with SGPro
  • Setting up filter wheel and filters in SGPro, TSX and ACP
  • In SGPro, we have to use "Mount Offset" for "Sync Behavior" - otherwise the mount does not improve pointing
  • Setup ACP for sky flats
  • Started taking bias, dark, flat and light frames ...

Sunday, June 14, 2020

Namid Observatory - Day 8

Figure out the default temperature of the camera:
  • The ML50100 can cool 45 C below ambient
  • At night, it's maximum 20 C here (most nights it's 15 C or below)
  • So, we'll use -20 C as our operating temperature
We noticed that the shroud was still tending to slip into the tube. Rich had the idea to screw in some bolts to the front of the scope to prevent this:


Mounted the flat panel box:

And finally, we mounted the little webcam that Rich brought:

And are streaming live to YouTube :-)


Cleaned everything up.

And we are done!!!

... well we still have to polar align tonight...

Luckily at midnight it cleared up and the wind calmed down. So, we could finally do our polar alignment.

I talked to Tolga about this and he recommended to do the polar alignment on a star straight south and very low. Do the Azimuth alignment first. Lock down the Azimuth lock screws. Because the scope points straight south, the only movement that should happen when tightening the Azimuth screws is in Altitude (the mount will be front- or back-heavy). Then adjust Altitude and lock down the Altitude screws (these shouldn't affect the alignment of the mount).

We still had the model from 3 nights ago in the mount and used that to polar align. By now, Rich was a pro and he centered the star (Antares would have been perfect, but it was behind clouds. So, we used Zuben Al Genubi instead).

We then ran another model to measure the remaining polar alignment.

First, we noticed that most plate solves failed. Which was puzzling as ASTAP was so reliable a few nights ago. When we checked everything we noticed two things:

  • The clock in the mount was 1 hour behind(!!!) We had no idea how that happened as we set the clock exact. We corrected this, but were uneasy if this will happen again.
  • Then we noticed that the mount was not tracking anymore. I had this issue with my 10Micron mounts too - I suspect TSX to sometimes do that ... We enabled tracking again.
Now, we ran the model and all platesolves worked!!! While the model was built, I installed the TimeSync tool from 10Micron that will sync the mount time from the PC time.

But the polar alignment error was still 1'30" !!!

With all the issues, we resigned ourselves that our alignment wasn't correct and that we'd have to do it again. But when we wanted to do a polar alignment, the mount pointed exactly at the target stars (tried several). It seems as if we couldn't trust the model building and/or polar alignment routine.

We decided to use the drift measurement/alignment from PHD2 - it doesn't rely on location or time but just checks how a star drifts.

We first measured near Deneb and got a VERY small polar alignment error (0.1"). We then measured deep south where the star movement would be fastest and got the same result. Seems as if our polar alignment was correct after all. We called it a night - but need to figure out what went wrong with the model...

Next: Day 9

Namid Observatory - Day 9

This day was supposed to be just for travelling.

But when I went one last time to the observatory, I noticed that the mount wasn't parked properly - I thought that I did that last night, but maybe forgot. So, I moved it manually to the parking position. But when I moved it, I noticed that the DEC balance was quite off - it was very heavy in the front ...

... turns out that the screws that Richard put in the front to prevent the shroud from slipping inside added some weight. I removed one of the three little counterweights and could balance the whole scope by moving the guidescope slightly forward.

... and while I was doing all this, I could hear a very faint clicking sound from the filter wheel. It could be that some of the filters are not fully fixed. But it got too late and I had to leave ...

Friday, June 12, 2020

Namid Observatory - Day 7

Drove all the way to Thatcher, AZ to get a TV mount for the flat box. Just after I drove back, I got an email from Al that our network cables might be faulty. Turned around and bought Ethernet cables (and a VGA-HDMI adapter and an RJ10 cable).

When I came back, I could connect our NUC to one of the VGA monitors and finally set it to automatically reboot on power on (in the BIOS).

Then I setup and configured SGPro. Ultimately, we want to use ACP. But it will take a while to get all those script written (power up/down mount, start Delta-T...) In the meantime we will use SGPro to get going.

We then built the mount for the flat panel and did all the cabling - tomorrow we'll install that. And that's the last piece!!!

... and then night was windy and overcast again. No polar alignment. This means that we will only have one shot left for doing that ...

Next: Day 8

Thursday, June 11, 2020

Namid Observatory - Day 6

Not much left at this point:
  • Changed the internal IP addresses (made a mistake before)
  • Changed the Web Power Switch port forwarding to port 80 - somehow https didn't work
  • Downloaded and installed the MGBox Ascom driver, so that we can use the MGBox as an Environment device on our imaging software
  • Checked where we got focus on the main scope: the focuser was 30% out!!! We could replace the 0.5" spacer with a 0.25" spacer to move the focus to 55%. But decided that this is good enough. If it gets colder, the scope will contract (though not a lot) and we will need to move the focuser further out. So, we shouldn't have a problem.
  • Covered all the remaining lights
  • Labeled all cables and ports
  • Downloaded Dimension4 to have correct time on the NUC
  • Configured the MGBox such that it sends Meteo (but NOT GPS) data to the mount
  • Set output of the MGPBox (in the MGBox software) to Ascom
Night was windy and overcast again. Couldn't finish polar alignment

Next: Day 7