Пример #1
0
 public frmImageRun(ref clsSharedData d, ref clsForms f)
 {
     InitializeComponent();
     sd   = d;
     form = f;
     chkArrayFileDirExists();
 }
Пример #2
0
 public frmImaging(ref clsSharedData d, ref clsTargetObject t, ref clsForms f)
 {
     InitializeComponent();
     sd   = d;
     to   = t;
     form = f;
 }
Пример #3
0
 public frmConfig(ref clsSharedData d, ref clsForms f)
 {
     InitializeComponent();
     sd   = d;
     form = f;
     //loadSharedData();
     writeConfigValuesToScreen();
 }
Пример #4
0
 public ASCOMCamera(string CamID, ref clsSharedData d, ref clsForms f)
     : base(CamID)
 {
     this.ExposureTimer.Elapsed += new ElapsedEventHandler(this.ExposureTimerTick);
     ExposureTimer.Interval      = 100;
     ExposureTimer.Enabled       = false;
     sd   = d;
     form = f;
 }
Пример #5
0
        public void displayImage(clsSharedData sharedData, clsForms form)
        {
            sharedData.F = new fitsHeader();
            Graphics g = form.ImagingForm.pictureBox1.CreateGraphics();

            if (form.ImagingForm.InvokeRequired)
            {
                form.ImagingForm.Invoke(new Action <clsSharedData, clsForms>(displayImage), new object[] { sharedData, form });
                return;
            }

            if (!sharedData.ImagingCam.ImageReady)
            {
                System.Threading.Thread.Sleep(500);
            }
            System.Threading.Thread.Sleep(500);
            try
            {
                sharedData.theImage.LastExposureDuration = sharedData.ImagingCam.LastExposureDuration;
            }
            catch
            {
                //Used to handle exception raised if there is no LastExposureDuration (ie, this is the first image)
            }

            sharedData.theImage.LastExposureStartTime = sharedData.ImagingCam.LastExposureStartTime;
            form.ImagingForm.pictureBox1.Size         = new System.Drawing.Size(sharedData.ImagingCam.ExposureWidth, sharedData.ImagingCam.ExposureHeight);


            g.DrawImage(sharedData.theImage.bmp, new Rectangle(0, 0, sharedData.ImagingCam.ExposureWidth, sharedData.ImagingCam.ExposureHeight));
            form.ImagingForm.ImageFromCam = true;


            form.ImagingForm.btnStop.Enabled       = false;
            form.ImagingForm.btnAbort.Enabled      = false;
            form.ImagingForm.btnStart.Enabled      = true;
            form.ImagingForm.chkAutoRepeat.Enabled = true;


            if (form.ImagingForm.isAutoRepeat)
            {
                form.ImagingForm.autoRepeatImageTaken = true;
            }
            sharedData.imagecomplete = true;
            clsStatics.imageComplete = true;
        }
Пример #6
0
        /// <summary>
        /// Returns a struct with alt & az coordinates of an object given it's Ra & Dec from a specific lat & lon on a specific date (jd)
        /// </summary>
        /// <param name="Lat"></param>
        /// <param name="Lon"></param>
        /// <param name="Ra"></param>
        /// <param name="Dec"></param>
        /// <param name="Prof"></param>
        /// <param name="jd"></param>
        /// <returns></returns>
        public static structAltAz GetAltAz(double Lat, double Lon, double Ra, double Dec, clsSharedData Prof, double jd)
        {
            //Lat = Current Observing Latitude
            //Lon = Current Observing Longitude
            //Ra = Right Ascention of Object
            //Dec = Declination of object
            //jd = Julian Date
            //GSTime = GMT Sidereal Time


            structAltAz ret_value = default(structAltAz);
            double      ASCOMAlt  = 0;
            double      ASCOMAz   = 0;

            ASCOM.Astrometry.NOVASCOM.Site           Site      = default(ASCOM.Astrometry.NOVASCOM.Site);
            ASCOM.Utilities.Util                     utl       = default(ASCOM.Utilities.Util);
            ASCOM.Astrometry.NOVASCOM.Star           Obj       = default(ASCOM.Astrometry.NOVASCOM.Star);
            ASCOM.Astrometry.NOVASCOM.PositionVector PosVector = default(ASCOM.Astrometry.NOVASCOM.PositionVector);
            //ASCOM.Astrometry.SiteInfo Site = default(ASCOM.Astrometry.SiteInfo);
            //ASCOM.Astrometry.PosVector PVector = default(ASCOM.Astrometry.PosVector);
            ASCOM.Astrometry.NOVAS.NOVAS31 N         = new ASCOM.Astrometry.NOVAS.NOVAS31();
            ASCOM.Astrometry.SOFA.SOFA     S         = new ASCOM.Astrometry.SOFA.SOFA();
            ASCOM.Astrometry.OnSurface     onSurface = default(ASCOM.Astrometry.OnSurface);
            onSurface           = new ASCOM.Astrometry.OnSurface();
            onSurface.Latitude  = Lat;
            onSurface.Longitude = Lon;
            onSurface.Height    = Properties.Settings.Default.site_altitude;
            onSurface.Pressure  = Properties.Settings.Default.site_pressure;
            onSurface.Pressure  = Properties.Settings.Default.site_temperature;



            Site      = new ASCOM.Astrometry.NOVASCOM.Site();
            utl       = new ASCOM.Utilities.Util();
            Obj       = new ASCOM.Astrometry.NOVASCOM.Star();
            PosVector = new ASCOM.Astrometry.NOVASCOM.PositionVector();
            //Site = new ASCOM.Astrometry.SiteInfo();
            //PVector = new ASCOM.Astrometry.PosVector();



            //double jd = JDNow();
            double GSTime = GMSTime();

            Site.Latitude    = Lat;
            Site.Longitude   = Lon;
            Site.Height      = Properties.Settings.Default.site_altitude;
            Site.Pressure    = Properties.Settings.Default.site_pressure;
            Site.Temperature = Properties.Settings.Default.site_temperature;

            PosVector.SetFromSite(Site, GSTime);
            Obj.Set(Ra, Dec, 0.0, 0.0, 0.0, 0.0);
            PosVector = Obj.GetTopocentricPosition(jd, Site, false);

            ASCOMAlt = PosVector.Elevation;
            ASCOMAz  = PosVector.Azimuth;

            ret_value.Alt = ASCOMAlt;
            ret_value.Az  = ASCOMAz;

            return(ret_value);
        }
Пример #7
0
 public PlateSolve(string app, ref clsSharedData d)
 {
     sd     = d;
     P      = new PinPoint.Plate();
     PP_app = "PinPoint";
 }
Пример #8
0
 public phd(ref clsSharedData d)
 {
     sd = d;
 }
Пример #9
0
 public ASCOMFilterWheel(string FWID, ref clsSharedData d, ref clsForms f)
     : base(FWID)
 {
     sd   = d;
     form = f;
 }
Пример #10
0
 public clsPhd(ref clsSharedData d, frmMain Parent)
 {
     bConnected = false;
     oParent    = Parent;
 }
Пример #11
0
        public void saveImageToFits(string path, clsSharedData sd)
        {
            var          imageData = (Array)ArrayFuncs.Flatten(sd.imgArray);
            const double bZero     = 0;
            const double bScale    = 1.0;

            if (sd.theImage.MaxADU <= 65535)
            {
                //bZero = 32768;
                //imageData = (ushort[])ArrayFuncs.ConvertArray(imageData, typeof(ushort));
            }
            int[] dims = ArrayFuncs.GetDimensions(sd.imgArray);
            //Array image = ArrayFuncs.Curl(imageData, dims);

            // put the image data in a basic HDU of the fits
            BasicHDU imageHdu = FitsFactory.HDUFactory(ArrayFuncs.Curl(imageData, dims));

            // put the other data in the HDU
            imageHdu.AddValue("BZERO", bZero, "");
            imageHdu.AddValue("BSCALE", bScale, "");
            imageHdu.AddValue("DATAMIN", 0.0, "");      // should this reflect the actual data values
            imageHdu.AddValue("DATAMAX", sd.theImage.MaxADU, "pixel values above this level are considered saturated.");
            imageHdu.AddValue("INSTRUME", sd.theImage.Description, "");
            imageHdu.AddValue("EXPTIME", sd.theImage.LastExposureDuration, "duration of exposure in seconds.");
            imageHdu.AddValue("DATE-OBS", sd.theImage.LastExposureStartTime, "");
            imageHdu.AddValue("XPIXSZ", sd.theImage.PixelSizeX * sd.theImage.BinX, "physical X dimension of the sensor's pixels in microns"); //  (present only if the information is provided by the camera driver). Includes binning.
            imageHdu.AddValue("YPIXSZ", sd.theImage.PixelSizeY * sd.theImage.BinY, "physical Y dimension of the sensor's pixels in microns"); //  (present only if the information is provided by the camera driver). Includes binning.
            imageHdu.AddValue("XBINNING", sd.theImage.BinX, "");
            imageHdu.AddValue("YBINNING", sd.theImage.BinY, "");
            imageHdu.AddValue("XORGSUBF", sd.theImage.StartX, "subframe origin on X axis in binned pixels");
            imageHdu.AddValue("YORGSUBF", sd.theImage.StartY, "subframe origin on Y axis in binned pixels");
            imageHdu.AddValue("CBLACK", (double)sd.theImage.Min, "");
            imageHdu.AddValue("CWHITE", (double)sd.theImage.Max, "");
            imageHdu.AddValue("SWCREATE", "Nite Ops", "string indicating the software used to create the file");
            imageHdu.AddValue("OBJCTRA", sd.theImage.RA, "Approximate Right Ascension of image centre");
            imageHdu.AddValue("OBJCTDEC", sd.theImage.Dec, "Approximate Declination of image centre");
            imageHdu.AddValue("OBJCTALT", sd.theImage.Alt, "Approximate Altitude of image centre");
            imageHdu.AddValue("OBJCTAZ", sd.theImage.Az, "Approximate Azimuth of image centre");


            // extensions as specified by SBIG
            try
            {
                imageHdu.AddValue("CCD_TEMP", sd.theImage.CCDTemperature, "sensor temperature in degrees C");      // TODO sate this at the start of exposure . Absent if temperature is not available.
            }
            catch (Exception)
            {
                imageHdu.Info();
            }
            if (sd.theImage.CanSetCCDTemperature)
            {
                imageHdu.AddValue("SET-TEMP", sd.theImage.SetCCDTemperature, "CCD temperature setpoint in degrees C");
            }
            if (sd.theImage.objectName != "")
            {
                imageHdu.AddValue("OBJECT", sd.theImage.objectName, "The name of the object");
            }
            else
            {
                imageHdu.AddValue("OBJECT", "Unknown", "The name of the object");
            }
            imageHdu.AddValue("TELESCOP", Properties.Settings.Default.imaging_telescope, "Telescope used to acquire this image"); // user-entered information about the telescope used.
            imageHdu.AddValue("OBSERVER", Properties.Settings.Default.your_name, "Name of the observer");                         // user-entered information; the observer’s name.

            //DARKTIME – dark current integration time, if recorded. May be longer than exposure time.
            imageHdu.AddValue("IMAGETYP", sd.theImage.frameType + " Frame", "Type of image");
            //ISOSPEED – ISO camera setting, if camera uses ISO speeds.
            //JD_GEO – records the geocentric Julian Day of the start of exposure.
            //JD_HELIO – records the Heliocentric Julian Date at the exposure midpoint.
            //NOTES – user-entered information; free-form notes.
            //READOUTM – records the selected Readout Mode (if any) for the camera.

            //imageHdu.AddValue("SBSTDVER", "SBFITSEXT Version 1.0", "version of the SBIG FITS extensions supported");

            // save it
            var fitsImage = new Fits();

            fitsImage.AddHDU(imageHdu); //Adds the actual image data (the header info already exists in imageHDU)
            FileStream fs = null;

            try
            {
                fs = new FileStream(path, FileMode.Create);
                using (var bds = new BufferedDataStream(fs))
                {
                    fs = null;
                    fitsImage.Write(bds);
                }
            }
            finally
            {
                if (fs != null)
                {
                    fs.Dispose();
                }
            }
        }
Пример #12
0
 public frmGuiding(ref clsSharedData d, ref clsForms f)
 {
     InitializeComponent();
     sd   = d;
     form = f;
 }
Пример #13
0
 public Telescope(string ScopeID, ref clsSharedData d)
     : base(ScopeID)
 {
     sd = d;
 }