Automatically through the night

Questions, tips, information and discussions about using the SharpCap Sequencer and Sequence Planner tools
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Automatically through the night

#1

Post by StarFlea »

Hi folks!

I have thought of a sequence that will allow me to record a deep sky object all night long, if possible without manual intervention, and I would like your opinion on it before I carry out the field test, because I am only partially able to simulate the sequence in advance under realistic conditions...

Idea: Start recording the object in the eastern sky (with autoguiding - PHD2), then meridian flip, followed by 3-step-refining plate solving to recenter the object properly again. The end of the recording should only be at astronomical dawn, or when the object is only 10 degrees above the horizon.

With the following sequence, you can assume that all equipment, software and guiding are already running:

Code: Select all

SEQUENCE
    LIVE STACKING START
    LIVE STACKING PAUSE
    PROMPT "Start sequence (15 s countdown)." ENABLECONTROLS True
    DELAY 15
    BEFORE SEQUENCE FINISH DO
        LIVE STACKING SAVE AllFormats
        LIVE STACKING STOP
    END DO
    RETRY ERRORS UP TO 5 TIMES
        DELAY 5
        GUIDING CONNECT ABORT True
        GUIDING START
    END RETRY ERRORS
    GUIDING WAIT
    SAVE MOUNT COORDINATES
    LIVE STACKING RESET
    SHOW NOTIFICATION "Guiding active! Live Stacking active!" COLOUR Green DURATION 10
    STOP AT 1 FROM MERIDIAN
        LOOP UNTIL AstronomicalDawn
            LIVE STACKING PAUSE
            GUIDING DITHER NOW
            DELAY 10
            LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
        END LOOP
    END STOP AT
    SHOW NOTIFICATION "Guiding & Live Stacking paused! Meridian flip!" COLOUR Green DURATION 10
    LIVE STACKING PAUSE
    DELAY 5
    BEGIN GUIDING PAUSE
        MOUNT FLIP
        DELAY 20
        SHOW NOTIFICATION "Auto-recentering: Step  1/3" COLOUR Green DURATION 5
        RETRY ERRORS UP TO 10 TIMES
            DELAY 5
            MOUNT SOLVESYNCONLY
        END RETRY ERRORS
        GOTO SAVED COORDINATES
        DELAY 15
        SHOW NOTIFICATION "Auto-recentering: Step  2/3" COLOUR Green DURATION 5
        RETRY ERRORS UP TO 10 TIMES
            DELAY 5
            MOUNT SOLVESYNCONLY
        END RETRY ERRORS
        GOTO SAVED COORDINATES
        DELAY 15
        SHOW NOTIFICATION "Auto-recentering: Step  3/3" COLOUR Green DURATION 5
        RETRY ERRORS UP TO 10 TIMES
            DELAY 5
            MOUNT SOLVESYNCONLY
        END RETRY ERRORS
        GOTO SAVED COORDINATES
        DELAY 15
        SHOW NOTIFICATION "Auto-recentering complete. Activate guiding..." COLOUR Green DURATION 5
    END GUIDING PAUSE
    DELAY 10
    SHOW NOTIFICATION "Guiding active! Live Stacking active!" COLOUR Green DURATION 10
    LIVE STACKING RESUME
    STOP AT 10 FROM HORIZON
        LOOP UNTIL AstronomicalDawn
            LIVE STACKING PAUSE
            GUIDING DITHER NOW
            DELAY 10
            LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
        END LOOP
    END STOP AT
    LIVE STACKING STOP
    GUIDING STOP
    GUIDING DISCONNECT
    CAMERA CLOSE
    MOUNT TRACKING None
    MOUNT PARK
    MOUNT DISCONNECT
    PROMPT "Stacking successful. Disconnected camera & mount." ENABLECONTROLS True
END SEQUENCE
But a few things are giving me a headache:
  • Does the guiding start automatically again after the meridian flip and plate solving / does it automatically select a guide star?
  • Are the loops in the STOP blocks set correctly, or should the STOP blocks be in the loops?
  • What happens if I use the sequence after the object has already passed the meridian (= western sky)? Would it immediately try a pointless meridian flip and plate solving, or would it remain in the first loop until dawn without taking the horizon limit into account?
Greetings!
StarFlea
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Automatically through the night

#2

Post by admin »

Hi,

overall, it looks reasonable. I think the thing that would concern me the most is the guiding pause around the meridian flip. The implementation of the pause and resume are inherent to PHD2, so I'm unsure if PHD2 will pick a new guide star on the resume or not. It may be worth putting a 'GUIDING START' after the end of the guiding pause - if PHD2 resumes and picks a new star then no harm done with the extra step - if not, then SharpCap's 'GUIDING START' step should walk PHD2 through picking a new star and guiding on it.

I'd rig this up to test on something that was maybe 10-15 minutes away from the meridian at the first test (since the flip is the challenging part). If anything goes wrong then you will see the results quickly and can tweak the sequence to try to deal with the problem (and re-test on another target that's about the right distance from the meridian)

cheers,

Robin
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Re: Automatically through the night

#3

Post by StarFlea »

OK, thanks for the tips! That sounds good!

I've now rewritten the sequence to take the horizon into account. Can there be problems with multiple nested STOP blocks?

Code: Select all

SEQUENCE
    LIVE STACKING START
    LIVE STACKING PAUSE
    PROMPT "Start sequence (15 s countdown)." ENABLECONTROLS True
    DELAY 15
    BEFORE SEQUENCE FINISH DO
        LIVE STACKING SAVE AllFormats
        LIVE STACKING STOP
    END DO
    RETRY ERRORS UP TO 5 TIMES
        DELAY 5
        GUIDING CONNECT ABORT True
        GUIDING START
    END RETRY ERRORS
    GUIDING WAIT
    SAVE MOUNT COORDINATES
    LIVE STACKING RESET
    SHOW NOTIFICATION "Guiding active! Live Stacking active!" COLOUR Green DURATION 10
    
    STOP AT 10 FROM HORIZON
        STOP AT 1 FROM MERIDIAN
            LOOP UNTIL AstronomicalDawn
                LIVE STACKING PAUSE
                GUIDING DITHER NOW
                DELAY 10
                LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
            END LOOP
        END STOP AT
        
        STOP AT AstronomicalDawn
            SHOW NOTIFICATION "Guiding & Live Stacking paused! Meridian flip!" COLOUR Green DURATION 10
            LIVE STACKING PAUSE
            DELAY 5
            BEGIN GUIDING PAUSE
                MOUNT FLIP
                DELAY 20
                SHOW NOTIFICATION "Auto-recentering: Step  1/3" COLOUR Green DURATION 5
                RETRY ERRORS UP TO 10 TIMES
                    DELAY 5
                    MOUNT SOLVESYNCONLY
                END RETRY ERRORS
                GOTO SAVED COORDINATES
                DELAY 15
                SHOW NOTIFICATION "Auto-recentering: Step  2/3" COLOUR Green DURATION 5
                RETRY ERRORS UP TO 10 TIMES
                    DELAY 5
                    MOUNT SOLVESYNCONLY
                END RETRY ERRORS
                GOTO SAVED COORDINATES
                DELAY 15
                SHOW NOTIFICATION "Auto-recentering: Step  3/3" COLOUR Green DURATION 5
                RETRY ERRORS UP TO 10 TIMES
                    DELAY 5
                    MOUNT SOLVESYNCONLY
                END RETRY ERRORS
                GOTO SAVED COORDINATES
                DELAY 15
                SHOW NOTIFICATION "Auto-recentering complete. Activate guiding..." COLOUR Green DURATION 5
            END GUIDING PAUSE
            GUIDING START
            DELAY 10
            SHOW NOTIFICATION "Guiding active! Live Stacking active!" COLOUR Green DURATION 10
            LIVE STACKING RESUME
        END STOP AT
        
        LOOP UNTIL AstronomicalDawn
            LIVE STACKING PAUSE
            GUIDING DITHER NOW
            DELAY 10
            LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
        END LOOP
    END STOP AT
    
    LIVE STACKING STOP
    GUIDING STOP
    GUIDING DISCONNECT
    CAMERA CLOSE
    MOUNT TRACKING None
    MOUNT PARK
    MOUNT DISCONNECT
    PROMPT "Stacking successful. Disconnected camera & mount." ENABLECONTROLS True
END SEQUENCE
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Automatically through the night

#4

Post by admin »

Hi,

multiple stop blocks should be fine - the cancellation signal from either of them should be sufficient to interrupt the currently executing part of the sequence if the end condition is satisfied.

cheers,

Robin
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Re: Automatically through the night

#5

Post by StarFlea »

So, a "little" feedback:

The meridian flip works wonderfully and guiding also seems to continue after flip. However, plate solving (and thus automatic recentering) fails after the meridian flip. It seems that the plate solver try to solve with the last frame before the flip, which is still shown on the display.
My plan: Before the flip, I pause live stacking and guiding, carry out the flip, carry out recentering (using plate solving) and start guiding and live stacking again.
Is it possible that I have to explicitly set a "LIVE MODE" again before the recentering and/or a "MOUNT SOLVESYNCONLY" before the flip?

Here is the sequence:

Code: Select all

SEQUENCE
    LIVE STACKING START
    LIVE STACKING PAUSE
    PROMPT "Start... (15 s Countdown)" ENABLECONTROLS True
    COUNTDOWN FOR 15 SHOWING "wait..."
    BEFORE SEQUENCE FINISH DO
        LIVE STACKING SAVE AllFormats
        LIVE STACKING STOP
    END DO
    RETRY ERRORS UP TO 10 TIMES
        DELAY 5
        GUIDING CONNECT ABORT True
        GUIDING START
    END RETRY ERRORS
    GUIDING WAIT
    SAVE MOUNT COORDINATES
    LIVE STACKING RESET
    SHOW NOTIFICATION "Guiding active" COLOUR Green DURATION 10
    STOP AT 5 FROM HORIZON
        STOP AT 0.1 FROM MERIDIAN
            LOOP UNTIL NauticalDawn
                LIVE STACKING PAUSE
                GUIDING DITHER NOW
                DELAY 5
                LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
            END LOOP
        END STOP AT
        STOP AT NauticalDawn
            SHOW NOTIFICATION "Guiding paused. Meridian flip..." COLOUR Amber DURATION 10
            LIVE STACKING PAUSE
            DELAY 5
            BEGIN GUIDING PAUSE
                MOUNT FLIP
                DELAY 15
                PRESERVE CAMERA SETTINGS
                    SHOW NOTIFICATION "Meridian flip complete" COLOUR Green DURATION 5
                    LOAD PROFILE "PlateSolving 2s 4000 (veTEC 2x2)"
                    SHOW NOTIFICATION "Auto recentering: Step  1/3" COLOUR Amber DURATION 5
                    RETRY ERRORS UP TO 50 TIMES
                        DELAY 5
                        MOUNT SOLVESYNCONLY
                    END RETRY ERRORS
                    GOTO SAVED COORDINATES
                    DELAY 15
                    SHOW NOTIFICATION "Auto recentering: Step  2/3" COLOUR Amber DURATION 5
                    RETRY ERRORS UP TO 50 TIMES
                        DELAY 5
                        MOUNT SOLVESYNCONLY
                    END RETRY ERRORS
                    GOTO SAVED COORDINATES
                    DELAY 15
                    SHOW NOTIFICATION "Auto recentering: Step  3/3" COLOUR Amber DURATION 5
                    RETRY ERRORS UP TO 50 TIMES
                        DELAY 5
                        MOUNT SOLVESYNCONLY
                    END RETRY ERRORS
                    GOTO SAVED COORDINATES
                    DELAY 10
                    SHOW NOTIFICATION "Auto recentering complete" COLOUR Green DURATION 5
                END PRESERVE
                SHOW NOTIFICATION "Reactivate guiding ..." COLOUR Amber DURATION 5
            END GUIDING PAUSE
            RETRY ERRORS UP TO 50 TIMES
                DELAY 5
                GUIDING START
            END RETRY ERRORS
            DELAY 10
            SHOW NOTIFICATION "Guiding active" COLOUR Green DURATION 10
            LIVE STACKING RESUME
        END STOP AT
        LOOP UNTIL NauticalDawn
            LIVE STACKING PAUSE
            GUIDING DITHER NOW
            DELAY 5
            LIVE STACK FOR 2 MORE FRAMES THEN PAUSE
        END LOOP
    END STOP AT
    LIVE STACKING STOP
    GUIDING STOP
    GUIDING DISCONNECT
    CAMERA CLOSE
    MOUNT TRACKING None
    MOUNT PARK
    MOUNT DISCONNECT
    PROMPT "OK" ENABLECONTROLS True
END SEQUENCE
And another question:

After the flip, the new recorded frames are rotated in comparison to the previous ones. Can this cause problems with plate solving and live stacking or do I have to intervene here myself?

StarFlea
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Automatically through the night

#6

Post by admin »

Hi,

I think what you are hitting here is some code that will use the last frame displayed if it seems that nothing has been changed in terms of the camera settings since the last frame was captured. In most cases this speeds up the plate solve process by avoiding the wait for yet another frame to come from the camera, but in your case it sounds like it is picking up a frame from before the flip.

Fortunately there is a 'WAIT FOR FRAME' step that can be used in the sequencer - it just waits until the next frame arrives in live view, so it should help you sidestep the problem. Not quite sure if you will need just one of these, or if two might be required. Another way to solve this would be to change the exposure to (say) 1s and then back again (with a bit of a delay to make sure the camera actually runs a 1s frame). That change in settings means that the previous frame will not be used for plate solving.

Plate solving and live stacking should be OK after the 180 degree rotation - there is nothing in the live stacking code that worries about the rotation being 'small' in any way, so it should just find the ~180 degree solution and use it.

cheers,

Robin
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Re: Automatically through the night

#7

Post by StarFlea »

Hi Robin,

I've now tested it again with the "WAIT FOR FRAME" step, but unfortunately that didn't work. When testing with the star Altair (near position 19:50:47.1 / +08:52:17), everything is carried out correctly before the meridian flip and the plate solving also causes correct centering.

After the flip, the mount is actually in the position 19:47:35.7 / +08:17:41. I know this because the RAW frames are stored in the capture folder.
The plate solver still recognizes the old position at 19:50:47.1 / +08:52:17 and therefore makes no or very few corrections. Of course, live stacking / alignment is no longer possible from this point onwards because the mount is in the wrong place.

I can only conclude that after the flip the plate solver continues to work with an image that must be in the image buffer. Waiting for a current frame doesn't help either. RAW frames are still produced correctly!
According to the log at 22:37:02.490335 there is a single warning: "ASCOM camera is no longer exposing (Idle) and has not signaled image ready, assuming frame lost"
I cannot understand why this is the case, but it could be a clue to the cause! Does plate solving work correctly while live stacking is paused ("LIVE STACKING PAUSE")?

Best regards!
StarFlea
Attachments
Log_2024-08-27T22_21_34-16680.log
(450.49 KiB) Downloaded 83 times
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Automatically through the night

#8

Post by admin »

Hi,

OK, that makes sense now - I had forgotten the impact of live stacking on the mix...

If live stacking is active, then the assumption for plate solving is that it is happening to annotate the image, so it solves the live stacked frame, not the raw one from the camera. Without this, annotating a live stacked image would be off by any drift since the stack started.

There is a 'recenter' feature in live stacking that is designed to put the camera back in place when the drift grows too much, which covers the need to sometimes recenter if not guiding, but this won't work in your case, as it is triggered by the gradual increase in offset measured by the live stacking.

The best best is to close live stacking, plate solve/recenter, re-open and resume stacking - that should be possible in the sequencer, but there is a setting that needs to be set manually in the liver stacking settings to tell it *not* to auto-reset the stack when reactivated.

cheers,

Robin
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Re: Automatically through the night

#9

Post by StarFlea »

Hello!

Thanks for the explanation, now I'm slowly starting to understand... :)

On the other hand, I have various initialization sequences that plate solve perfectly without live stacking being active.

I don't know yet whether I'll be happy with closing the stack, but I've thought of the following partial sequence for plate solving:
...
LIVE STACKING PAUSE
...
LIVE STACKING RESUME
WAIT FOR FRAME
LIVE STACKING PAUSE
MOUNT SOLVESYNCONLY

...
GOTO SAVED COORDINATES
...

So I only activate live stacking briefly to catch a single frame and then pause again straight away. It should then solve immediately with this frame...

That should work, right!?

If there was then another step to remove exactly the last frame from the live stack (unstack), then the stack would not be affected by these few intermediate steps.

StarFlea
StarFlea
Posts: 159
Joined: Wed Dec 21, 2022 12:22 pm

Re: Automatically through the night

#10

Post by StarFlea »

OK, I've tried my idea (and a few others), but I haven't had a real breakthrough with any of them yet...

The sequence
LIVE STACKING RESUME
WAIT FOR FRAME
LIVE STACKING PAUSE
MOUNT SOLVESYNCONLY

makes no difference to before... (which is actually logical, since the plate solving should take place before the pause, but due to paused guiding, this is also irrelevant! - see below...)

I also tried to stop the live stacking and start it again after the flip with LIVE STACKING STOP, but the whole sequence breaks off. The cause is probably the partial sequence
BEFORE SEQUENCE FINISH DO
LIVE STACKING SAVE AllFormats
LIVE STACKING STOP
END DO


I also tried to implement the plate solving like this:
RETRY ERRORS UP TO 50 TIMES
DELAY 5
LIVE STACK FOR 1 MORE FRAMES THEN PAUSE
MOUNT SOLVESYNCONLY
END RETRY ERRORS
GOTO SAVED COORDINATES

However, with this variant the live stack is not continued because the guiding is paused.

So far no satisfactory result that gives me a stable sequence...
Post Reply