Esempio n. 1
0
        //SexTractor-based method for getting the ADU of the brightest star in an image
        public static double GuiderStarADUSex(double exposure, bool AOEnabled)
        {
            //Determines the ADU for the X/Y centroid of the maximum FWHM star in a subframe
            //
            //Take a full frame image on the guider using TSX guide star coordinates and trackbox size
            ccdsoftCamera tsxg = new ccdsoftCamera
            {
                Autoguider             = 1,
                Frame                  = ccdsoftImageFrame.cdLight,
                Delay                  = 0,
                Asynchronous           = 0,
                AutoSaveOn             = 1,
                AutoguiderExposureTime = exposure,
                ExposureTime           = exposure
            };
            int tstat = tsxg.TakeImage();

            if (tstat != 0)
            {
                return(0);
            }

            //Next step is to generate the collection of stars in the frame

            SexTractor sEx = new SexTractor();

            sEx.SourceExtractGuider();

            List <double> FWHMlist = sEx.GetSourceExtractionList(SexTractor.SourceExtractionType.sexFWHM);
            List <double> CenterX  = sEx.GetSourceExtractionList(SexTractor.SourceExtractionType.sexX);
            List <double> CenterY  = sEx.GetSourceExtractionList(SexTractor.SourceExtractionType.sexY);
            int           iMax     = sEx.GetListLargest(FWHMlist);

            double maxStarADU = 0;

            try
            {
                maxStarADU = sEx.GetPixelADU((int)CenterX[iMax], (int)CenterY[iMax]);
            }
            catch (Exception ex)
            {
                maxStarADU = 0;
            }
            tstat = tsxg.TakeImage();
            if (maxStarADU == 0)
            {
                maxStarADU = tsxg.MaximumPixel;
            }
            return(maxStarADU);
        }
Esempio n. 2
0
            public int GetImage()
            {
                //Takes an image asynchronously using TSX
                Asynchronous = 1;

                tsxc.AutoguiderExposureTime = tsxc.ExposureTime;

                try
                { tsxc.TakeImage(); }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return(ex.HResult);
                }

                //Wait while the image is being taken, using 1 second naps.  Check each time to see
                //  if (the user has hit abort.  if (so, close everything up.
                int expstatus = 0;

                while (expstatus == 0)
                {
                    System.Windows.Forms.Application.DoEvents();
                    System.Threading.Thread.Sleep(1000);
                    try
                    { expstatus = tsxc.IsExposureComplete; }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return(ex.HResult);
                    }
                }
                return(0);
            }
Esempio n. 3
0
        private bool TakeImage()
        {
            ccdsoftCamera tsxc = new ccdsoftCamera()
            {
                Frame        = ccdsoftImageFrame.cdLight,
                Subframe     = 0,
                Delay        = 0,
                AutoSaveOn   = 1,
                ExposureTime = (double)ExposureBox.Value,
                Asynchronous = 1 //asychronous is on
            };

            //try to set filter, if any
            if (FiltersListBox.Text != "")
            {
                tsxc.FilterIndexZeroBased = (int)Filters.LookUpFilterIndex(FiltersListBox.Text);
            }

            if (FullReductionCheckBox.Checked)
            {
                tsxc.ImageReduction = ccdsoftImageReduction.cdBiasDarkFlat;
                string    binning = "1X1";
                Reduction calLib  = new Reduction();
                calLib.SetReductionGroup(tsxc.FilterIndexZeroBased, tsxc.ExposureTime, (int)tsxc.TemperatureSetPoint, binning);
            }
            ImageAbort.BackColor = Color.LightGreen;
            try
            {
                tsxc.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Camera connect failure: " + ex.Message);
                IsImaging     = true;
                tsxc          = null;
                RepsBox.Value = 1;
                return(false);
            }
            try
            {
                tsxc.TakeImage();
            }
            catch (Exception ex)
            {
                ImageButton.BackColor = Color.Yellow;
                IsImaging             = false;
                UpdateStatusLine("Imaging Error: " + ex.Message);
                RepsBox.Value = 1;
                IsImaging     = true;
                tsxc          = null;
                return(false);
            }
            IsImaging = true;
            tsxc      = null;
            return(true);
        }
Esempio n. 4
0
        private bool OptimizeExposure(double maxExposure)
        {
            //Subframe size
            const int subFrameSize = 192;
            //Subframe the center in order to get rid of any brighter outliers
            const int    testExposure = 10;
            const double minExposure  = 0.1;

            ccdsoftImage tsxi = new ccdsoftImage();

            tsxi.AttachToActive();  //We should have a CLS image handy
            double xcenter = tsxi.WidthInPixels / 2;
            double ycenter = tsxi.HeightInPixels / 2;
            //Set up 64 pixel square subframe
            int subTop    = (int)ycenter - subFrameSize / 2; //Y is top down
            int subBottom = (int)ycenter + subFrameSize / 2; //Y is top down
            int subRight  = (int)xcenter + subFrameSize / 2;
            int subLeft   = (int)xcenter - subFrameSize / 2;

            Configuration cfg    = new Configuration();
            int           ADUMax = Convert.ToInt32(cfg.ADUMax);

            ccdsoftCamera tsx_cc = new ccdsoftCamera
            {
                AutoSaveOn           = 0, //Autosave Off
                FilterIndexZeroBased = freshImageFilter,
                ExposureTime         = testExposure,
                Subframe             = 1,
                SubframeTop          = subTop,
                SubframeBottom       = subBottom,
                SubframeLeft         = subLeft,
                SubframeRight        = subRight,
                Frame          = ccdsoftImageFrame.cdLight,
                ImageReduction = ccdsoftImageReduction.cdAutoDark,
                Asynchronous   = 0      //Asynchronous off for this short shot
            };

            do
            {
                tsx_cc.TakeImage();
                double maxPixel        = tsx_cc.MaximumPixel;
                double correctExposure = (ADUMax / maxPixel) * tsx_cc.ExposureTime;
                if (correctExposure > maxExposure)
                {
                    correctExposure = maxExposure;
                }
                freshImageExposure = correctExposure;
                if (maxPixel > ADUMax)
                {
                    tsx_cc.ExposureTime = freshImageExposure;
                }
            } while (tsx_cc.MaximumPixel > ADUMax && freshImageExposure > minExposure);
            return(true);
        }
Esempio n. 5
0
    /// ********************************************************************************

    private void TargetLoop()
    {
        string szPathToMapFile = "C:\\Users\\Rick\\Documents\\Software Bisque\\TheSkyX Professional Edition\\Exported Data\\map.txt";

        ///Set the exposure time for the image
        double dExposure = 1.0;

        string LineFromFile;
        double dAz;
        double dAlt;

        //Connect to TSX TheSky and Uility methods
        sky6Utils        tsx_util = new sky6Utils();
        sky6RASCOMTheSky tsx_sky  = new sky6RASCOMTheSky();
        sky6RASCOMTele   tsx_tele = new sky6RASCOMTele();
        ccdsoftCamera    tsx_cam  = new ccdsoftCamera();

        ///Open the observing list export file for targets
        StreamReader MyFile = File.OpenText(szPathToMapFile); ///Stream object for Export Data text file

        ///Get the first line -- headers
        ///Exit if the file is empty
        if (MyFile.EndOfStream == true)
        {
            return;
        }
        ;
        LineFromFile = MyFile.ReadLine();

        int iRAindex  = LineFromFile.IndexOf("RA");
        int iDecindex = LineFromFile.IndexOf("Dec");

        while (MyFile.EndOfStream == false)
        {
            LineFromFile = MyFile.ReadLine();
            MessageBox.Show("RA: " + LineFromFile.Substring(iRAindex, 13) + "  Dec: " + LineFromFile.Substring(iDecindex, 13));

            string sname = LineFromFile.Substring((LineFromFile.Length - 12), 12);
            tsx_util.ConvertStringToRA(LineFromFile.Substring(iRAindex, 13));
            dAz = tsx_util.dOut0;
            tsx_util.ConvertStringToDec(LineFromFile.Substring(iDecindex, 13));
            dAlt = tsx_util.dOut0;

            ///Slew to object
            tsx_tele.SlewToAzAlt(dAz, dAlt, sname);

            ///Set exposure time and try { for image, exit if error
            tsx_cam.ExposureTime = dExposure;
            tsx_cam.TakeImage();
            ///Add to T-point Model
            tsx_sky.AutoMap();
        }
        ;   //Loop
    }
Esempio n. 6
0
        //Take an image via TSX.  Set the autosave path to the FreshImage path;
        //  Set exposureTime, Light Frame, AutoDark, No Autosave, Asynchronous
        //  then TakeImage
        //  Wait for completion status, then return
        //
        //  Removed subframe setting on request for cameras with long download times

        private void ShootGalaxy()
        {
            Configuration sscf   = new Configuration();
            ccdsoftImage  tsx_im = new ccdsoftImage
            {
                Path = sscf.FreshImagePath
            };
            ccdsoftCamera tsx_cc = new ccdsoftCamera
            {
                AutoSaveOn           = 0, //Autosave Off
                FilterIndexZeroBased = Convert.ToInt32(sscf.Filter),
                ExposureTime         = Convert.ToDouble(sscf.Exposure),
                //Subframe = 0,
                Frame = ccdsoftImageFrame.cdLight,
                //ImageReduction = ccdsoftImageReduction.cdAutoDark,
                Asynchronous = 1        //Asynchronous on
            };

            switch (sscf.CalibrationType)
            {
            case "None":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdNone;
                break;
            }

            case "Auto":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;
                break;
            }

            case "Full":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdBiasDarkFlat;
                break;
            }
            }
            LogEntry("Imaging target for " + sscf.Exposure + " secs");
            tsx_cc.TakeImage();
            //Wait for completion
            while (tsx_cc.State != ccdsoftCameraState.cdStateNone)
            {
                System.Threading.Thread.Sleep(1000);
                System.Windows.Forms.Application.DoEvents();
            }
            tsx_im.AttachToActiveImager();
            tsx_im.Save();
            freshImagePath = sscf.FreshImagePath;
            LogEntry("Imaging Complete");
            return;
        }
Esempio n. 7
0
        private double PlateSolve()
        {
            //runs an image link on the current location to get PA data
            //assume camera, mount etc are connected and properly configured.
            ccdsoftCamera tsxcc = new ccdsoftCamera
            {
                Autoguider   = 0,
                Frame        = ccdsoftImageFrame.cdLight,
                ExposureTime = 10,
                Delay        = 0,
                Asynchronous = 0,
                AutoSaveOn   = 1,
                Subframe     = 0
            };

            try { tsxcc.TakeImage(); }
            catch (Exception ex)
            {
                WriteLog(ex.Message);
                return(0);
            }

            ccdsoftImage tsxi  = new ccdsoftImage();
            ImageLink    tsxil = new ImageLink
            {
                pathToFITS = tsxcc.LastImageFileName,
                scale      = 1.70
            };

            try { tsxil.execute(); }
            catch (Exception ex)
            {
                return(0);
            }
            ImageLinkResults tsxir = new ImageLinkResults();
            double           iPA   = tsxir.imagePositionAngle;

            //Check for image link success, return 0 if not.
            if (tsxir.succeeded == 1)
            {
                return(iPA);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 8
0
        public void Shoot(string gName, double expTime)
        {
            //Take a fresh image at 600 seconds
            //That will be placed in the
            Configuration sscfg  = new Configuration();
            ccdsoftImage  tsx_im = new ccdsoftImage();
            ccdsoftCamera tsx_cc = new ccdsoftCamera();

            tsx_im.Path       = FollowUpPath + "\\" + gName + ".fit";
            tsx_cc.AutoSaveOn = 0;          //Autosave Off
            //No filter change
            tsx_cc.ExposureTime   = expTime;
            tsx_cc.Frame          = ccdsoftImageFrame.cdLight;
            tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;
            switch (sscfg.CalibrationType)
            {
            case "None":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdNone;
                break;
            }

            case "Auto":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;
                break;
            }

            case "Full":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdBiasDarkFlat;
                break;
            }
            }
            tsx_cc.Asynchronous = 0;        //Asynchronous on

            tsx_cc.TakeImage();
            //Wait for completion
            while (tsx_cc.State != ccdsoftCameraState.cdStateNone)
            {
                System.Threading.Thread.Sleep(1000);
                System.Windows.Forms.Application.DoEvents();
            }
            tsx_im.AttachToActiveImager();
            tsx_im.Save();
        }
Esempio n. 9
0
    /// Windows C# Sample Console Application: Filter
    ///
    /// ------------------------------------------------------------------------
    ///               Vaguely adapted from Filter.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2009?)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates how to connect, change and disconnect a filter.  Along the way, most o
    ///  Along the way, most of the basic camera operating methods are also demonstrated.
    ///


    public void FilterSample()
    {
        ///Global Parameters
        double dExposure = 10.0; ///seconds
        int    ifilter   = 3;    ///4nd filter slot, probably clear/lumenscent      ///Create camera object and connect

        ccdsoftCamera tsx_cc = new ccdsoftCamera();

        tsx_cc.Connect();

        ///Set exposure length
        tsx_cc.ExposureTime = dExposure;

        ///Set frame type to Light frame
        tsx_cc.Frame = ccdsoftImageFrame.cdLight;

        ///Set filter
        tsx_cc.FilterIndexZeroBased = ifilter;

        ///Set preexposure delay
        tsx_cc.Delay = 5;  ///Possible filter change = 5 sec delay

        ///Set method type to Asynchronous (so we can demo the wait process)
        tsx_cc.Asynchronous = 0;

        ///Set for autodark
        tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;

        ///Take image
        tsx_cc.TakeImage();

        ///Wait for completion (unnecessary if Asynchronous is set to "False"
        while (tsx_cc.State == ccdsoftCameraState.cdStateTakePicture)
        {
            System.Threading.Thread.Sleep(1000);
        }
        ;

        ///Clean up
        tsx_cc.Disconnect();
        return;
    }
Esempio n. 10
0
    /// Windows C# Sample Console Application: Cam
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from Cam.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2013)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates the key elements of how to take images using the primary camera.

    public void CameraSample()
    {
        int iCamStatus;

        ///Create a TSX camera object
        ccdsoftCamera tsx_cam = new ccdsoftCamera();

        ///Connect TSX to the camera
        try {
            tsx_cam.Connect();
        }
        catch {
            MessageBox.Show("Camera Error");
            return;
        };


        ///Set the exposure time
        tsx_cam.ExposureTime = 15.0;
        ///SEt an exposure delay
        tsx_cam.Delay = 5.0;
        ///Set a frame type
        tsx_cam.Frame = ccdsoftImageFrame.cdLight;
        ///Set for autodark
        tsx_cam.ImageReduction = ccdsoftImageReduction.cdAutoDark;
        ///Set for synchronous imaging (this app will wait until done or error)
        tsx_cam.Asynchronous = 0;
        ///Take image
        iCamStatus = tsx_cam.TakeImage();
        if (iCamStatus != 0)
        {
            MessageBox.Show("Camera Error: " + iCamStatus.ToString());
        }
        ;

        ///Disconnect Camera
        tsx_cam.Disconnect();
    }
Esempio n. 11
0
        static double PlateSolve()
        {
            //runs an image link on the current location to get PA data
            //assume camera, mount etc are connected and properly configured.
            ccdsoftCamera tsxcc = new ccdsoftCamera
            {
                Autoguider   = 0,
                Frame        = ccdsoftImageFrame.cdLight,
                ExposureTime = 10,
                Delay        = 0,
                Asynchronous = 0,
                AutoSaveOn   = 1
            };

            tsxcc.TakeImage();

            ccdsoftImage tsxi  = new ccdsoftImage();
            ImageLink    tsxil = new ImageLink
            {
                scale      = TSXLink.FOVI.GetFOVScale(), //set Scale
                pathToFITS = tsxcc.LastImageFileName
            };

            tsxil.execute();
            ImageLinkResults tsxir = new ImageLinkResults();
            double           iPA   = tsxir.imagePositionAngle;

            //Check for image link success, return 0 if not.
            if (tsxir.succeeded == 1)
            {
                return(iPA);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 12
0
    /// Windows C# Sample Console Application: ImageAnalysis
    ///
    /// ------------------------------------------------------------------------
    ///
    ///               Author: R.McAlister (2017)
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This application demonstrates some of the functionality of the ccdsoftCamera and Image classes
    ///
    /// The example takes a 60 second exposure then produces a recommendation window to display computed
    ///   optimal exposure length and duration for a one hour shoot, based on average background noise.
    ///
    /// The algorithms are based on work by ...
    ///   John Smith: http://www.hiddenloft.com/notes/SubExposures.pdf
    ///   Charles Anstey: http://www.cloudynights.com/item.php?item_id=1622
    ///   Steve Cannistra: http://www.starrywonders.com/snr.html
    ///
    /// Note:  Where the required parameters like "gain" are not supplied through TSX, they are arbitrarily set for
    ///   an SBIG STF8300
    ///
    public void ImageAnalysisSample()
    {
        ///Open camera control and connect it to hardware
        ccdsoftCamera tsx_cc = new ccdsoftCamera();

        try {
            tsx_cc.Connect();
        }
        catch {
            MessageBox.Show("Camera Connect Error");
        };

        ///turn on autosave
        tsx_cc.AutoSaveOn = 1;
        ///Set for 60 second exposure, light frame with autodark
        tsx_cc.ExposureTime         = 60;
        tsx_cc.Frame                = ccdsoftImageFrame.cdLight;
        tsx_cc.ImageReduction       = ccdsoftImageReduction.cdAutoDark;
        tsx_cc.FilterIndexZeroBased = 3;  ///Assumed Lumescent, but change accordingly
        tsx_cc.Delay                = 5;  ///Possible filter change = 5 sec delay
        tsx_cc.Asynchronous         = 1;  ///Going to do a wait loop
        tsx_cc.TakeImage();
        while (tsx_cc.State == ccdsoftCameraState.cdStateTakePicture)
        {
            System.Threading.Thread.Sleep(1000);
        }
        ;

        ///Create image object
        ccdsoftImage tsx_im = new ccdsoftImage();
        int          imgerr = 0;

        ///Open the active image, if any
        try {
            imgerr = tsx_im.AttachToActive();
        }
        catch {
            MessageBox.Show("No Image Available:  " + imgerr.ToString());
            return;
        };

        const int totalexp = 60; ///Minutes for total exposure sequence

        double dGain     = 0.37; ///electrons per ADU for SBIG STF8000M as spec///d
        int    iPedestal = 0;    ///base pedestal
        double dRnoise   = 9.3;  ///read out noise in electrons
        double dNoiseFac = 0.05; ///maximum tolerable contribution of readout noise
        double dExpFac   = 1;    ///Exposure reduction factor
        double dSLambda  = 15;   ///Faint target ADU minimum
        double dSNRMax   = 0.9;  ///fraction of maximum achievable signal to noise ratio (Cannistra)

        ///Presumably an Image Link has already been performed
        ///Check on this is TBD

        int iPX    = tsx_im.FITSKeyword("NAXIS1");
        int iPY    = tsx_im.FITSKeyword("NAXIS2");
        int iPXBin = tsx_im.FITSKeyword("XBINNING");
        int iPYBin = tsx_im.FITSKeyword("YBINNING");
        ///Dim igain as integer = tsx_im.FITSKeyword("EGAIN");         ///TSX doesn///t pick this up, yet
        double dExpTime = tsx_im.FITSKeyword("EXPTIME");

        iPX = iPX - 1;
        iPY = iPY - 1;

        double dAvgABU = tsx_im.averagePixelValue();
        double dEsky   = ((dAvgABU - iPedestal) * dGain) / dExpTime;
        double dTorn   = (System.Math.Pow(dRnoise, 2) / (((System.Math.Pow((1 + dNoiseFac), 2) - 1) * dEsky)));

        ///Smith algorithm
        int iExp1  = (int)(dTorn / 2);
        int iReps1 = (int)((((totalexp * 60) / dTorn) - 1) * 2);
        ///Anstey algorithm
        int iExp2  = (int)((dSLambda * System.Math.Sqrt(totalexp * 60)) / (2 * System.Math.Sqrt(dAvgABU / dExpTime)));
        int iReps2 = (int)((totalexp * 60) / iExp2);
        ///Cannestr algorithm
        int iExp3  = (int)((System.Math.Pow(dSNRMax, 2) * System.Math.Pow(dRnoise, 2)) / ((dEsky) * (1 - System.Math.Pow(dSNRMax, 2))));
        int iReps3 = (int)((totalexp * 60) / iExp3);

        ///Display Results
        MessageBox.Show("Smith Model (at tolerable noise factor = 0.05):" + "\r\n" +
                        "     " + iExp1.ToString() + " second exposure with" + "\r\n" +
                        "     " + iReps1.ToString() + " repetitions per hour." + "\r\n" + "\r\n" +
                        "Anstey Model (at faint target minimum = 15):" + "\r\n" +
                        "     " + iExp2.ToString() + " second exposure with" + "\r\n" +
                        "     " + iReps2.ToString() + " repetitions per hour." + "\r\n" + "\r\n" +
                        "Cannestra Model (at SNR = 90% of maximum):" + "\r\n" +
                        "     " + iExp3.ToString() + " second exposure with" + "\r\n" +
                        "     " + iReps3.ToString() + " repetitions per hour.");

        return;
    }
Esempio n. 13
0
    /// Windows C# Sample Console Application: ListSearch
    ///
    /// ------------------------------------------------------------------------
    ///               Vaguely adapted from ErrorHandling.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2013)
    ///
    ///				Converted 2015, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates how to run the telescope through a list of targets as defined
    ///   by a list of names.
    ///
    ///  Note:  The gist of the orginal VBS script was entitled "ErrorHandling.vbs".  However, that
    ///  script, however labeled, performed the functions as adapted to VB herein.
    ///


    public void ListSearchSample()
    {
        ///Set the exposure time for the image
        double dExposure = 1.0;

        ///Target List
        string[] targetlist = new string[] {
            "NGC1348",
            "NGC1491",
            "NGC1708",
            "NGC179",
            "NGC1798",
            "NGC2165",
            "NGC2334",
            "NGC2436",
            "NGC2519",
            "NGC2605",
            "NGC2689",
            "NGC2666",
            "NGC4381",
            "NGC5785",
            "NGC5804",
            "NGC6895",
            "NGC6991",
            "NGC7011",
            "NGC7058",
            "M39",
            "NGC7071",
            "NGC7150",
            "NGC7295",
            "NGC7394",
            "NGC7686",
            "NGC7801"
        };

        ///Create objects

        sky6StarChart         objChrt = new sky6StarChart();
        sky6RASCOMTele        objTele = new sky6RASCOMTele();
        ccdsoftCamera         objCam  = new ccdsoftCamera();
        sky6Utils             objUtil = new sky6Utils();
        sky6ObjectInformation objInfo = new sky6ObjectInformation();

        ///Connect Objects
        objTele.Connect();
        objCam.Connect();

        ///Run loop over array of target names
        double dAlt;
        double dAz;
        bool   iError;

        foreach (string target in targetlist)
        {
            objChrt.Find(target);
            objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT);
            dAlt = objInfo.ObjInfoPropOut;
            objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_AZM);
            dAz = objInfo.ObjInfoPropOut;

            try
            {
                objTele.SlewToAzAlt(dAz, dAlt, target);
            }
            catch
            {
                MessageBox.Show("An error has occurred running slew");
                return;
            };

            ///Set exposure time and try for image, exit if error
            objCam.ExposureTime = dExposure;
            try
            {
                objCam.TakeImage();
            }
            catch
            {
                MessageBox.Show("An error has occurred running image");
            };
        }

        ///Disconnect telescope and camera
        objTele.Disconnect();
        objCam.Disconnect();
        return;
    }
Esempio n. 14
0
/// Windows C# Sample Console Application: AutoGuide
///
/// ------------------------------------------------------------------------
///
///               Author: R.McAlister (2017)
///
/// ------------------------------------------------------------------------
///
/// This application performs the following steps:
///   Finds a target, M39 in this case
///   Turns off Autoguiding (if on)
///   Performs a Closed Loop Slew to the target
///   Takes an image with the Autoguide camera
///   Turns on Autoguiding
///
///

    public void AutoGuideSample()
    {
        ///Set connection to star chart and perform a find on M39 -- this will set the target for a CLS
        sky6StarChart tsx_sc = new sky6StarChart();

        tsx_sc.Find("M39");

        ///Create connection to autoguide camera and connect
        ccdsoftCamera tsx_ag = new ccdsoftCamera();

        ///Attach this object to the guider camera
        tsx_ag.Autoguider = 1;
        ///Find out with the guide camera is up to.  Abort if autoguiding or calibrating
        if (tsx_ag.Connect() == 0)
        {
            if ((tsx_ag.State == ccdsoftCameraState.cdStateAutoGuide) | (tsx_ag.State == ccdsoftCameraState.cdStateCalibrate))
            {
                tsx_ag.Abort();
            }
            ;
        }
        ;

        ///Create closed loop slew object
        ClosedLoopSlew tsx_cls = new ClosedLoopSlew();

        ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- backlash
        /// should be picked up in the mount driver
        ccdsoftCamera tsx_cc = new ccdsoftCamera();

        tsx_cc.ImageReduction       = ccdsoftImageReduction.cdAutoDark;
        tsx_cc.FilterIndexZeroBased = 3; ///Luminance
        tsx_cc.ExposureTime         = 10;
        tsx_cc.Delay = 0;

        ///run CLS synchronously
        ///tsx_cls.Asynchronous = False  ///-- this setting doesn///t appear to work (member not found) as of DB8458

        ///Execute
        try
        {
            int clsstat = tsx_cls.exec();
        }
        catch
        {    ///Just close up: TSX will spawn error window
            MessageBox.Show("Closed Loop Slew error");
            return;
            ///Let it go for demo purposes
        };

        ///Connect AutoGuide camera in case it isn///t
        try
        {
            tsx_ag.Connect();
        }
        catch
        {
            MessageBox.Show("Guide camera connect error");
            return;
        };
        ///Take an image to use for Autoguiding, run the function synchronously
        tsx_ag.ExposureTime = 2;
        tsx_ag.Asynchronous = 0;
        tsx_ag.Subframe     = 0;
        var tstat = tsx_ag.TakeImage(); ///Just assume it works

        ///Turn asynchronous back on to get out of this
        tsx_ag.Asynchronous = 1;
        ///Fire off Autoguiding
        tsx_ag.Autoguide();
        return;
    }
Esempio n. 15
0
        private bool ShootTarget(TargetList.TargetXDescriptor currentTarget)
        {
            Configuration cfg         = new Configuration();
            int           repetitions = Convert.ToInt32(cfg.ImagesPerSample);
            ccdsoftCamera tsx_cc      = new ccdsoftCamera
            {
                AutoSaveOn           = 0, //Autosave Off
                FilterIndexZeroBased = freshImageFilter,
                ExposureTime         = freshImageExposure,
                Subframe             = 0,
                Frame        = ccdsoftImageFrame.cdLight,
                Asynchronous = 1        //Asynchronous on
            };

            //Set up for noise reduction, if any
            switch (cfg.CalibrationType)
            {
            case "None":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdNone;
                LogEntry("No image calibration.");
                break;
            }

            case "Auto":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;
                LogEntry("Auto Dark image calibration set");
                break;
            }

            case "Full":
            {
                tsx_cc.ImageReduction = ccdsoftImageReduction.cdBiasDarkFlat;
                Reduction calLib  = new Reduction();
                string    binning = "1X1";
                int       camTemp = (int)tsx_cc.TemperatureSetPoint;
                if (!calLib.SetReductionGroup(freshImageFilter, freshImageExposure, camTemp, binning))
                {
                    LogEntry("No calibration library found: " + "B_" + binning + "T_" + camTemp + "E_" + freshImageFilter.ToString("0") + "F_" + freshImageFilter.ToString("0"));
                    return(false);

                    break;
                }
                LogEntry("Full image calibration set: " + calLib.ReductionGroupName);
                break;
            }
            }
            //Loop on repetitions of image
            do
            {
                SetNextImagePath(cfg.ImageBankFolder + "\\" + freshImageName);
                ccdsoftImage tsx_im = new ccdsoftImage
                {
                    Path = freshImagePath
                };

                LogEntry("Imaging " + currentTarget.Name + " at RA: " + Utility.SexidecimalRADec(freshImageRA, true) +
                         " / Dec: " + Utility.SexidecimalRADec(freshImageDec, false));
                LogEntry("Filter set to " + freshImageFilter.ToString("0"));
                LogEntry("Imaging target for " + freshImageExposure.ToString("0.0") + " secs");
                tsx_cc.TakeImage();
                //Wait for completion
                while (tsx_cc.State != ccdsoftCameraState.cdStateNone)
                {
                    System.Threading.Thread.Sleep(1000);
                    System.Windows.Forms.Application.DoEvents();
                }
                tsx_im.AttachToActiveImager();
                tsx_im.setFITSKeyword("OBJECT", freshImageName);
                tsx_im.Save();
                repetitions--;
            } while (repetitions > 0);
            LogEntry("Imaging target Complete");
            return(true);
        }