Ejemplo n.º 1
0
        private void SelectTargetListBox_Click(object sender, EventArgs e)
        {
            currentTargetIndex = SelectTargetListBox.SelectedIndex;
            if (!CurveOnlyBox.Checked)
            {
                //close the current tsx image if one is open
                if (TSX_Image != null)
                {
                    VariScanFileManager.CloseImageFile(TSX_Image);
                }
                //Get the directory name that was chosen
                string targetChoice = SelectTargetListBox.SelectedItem.ToString();
                //Load the variable list entry info for that choice of targets, if none -- return
                TargetList varList = new TargetList();
                IEnumerable <TargetList.TargetXDescriptor> tgtList = varList.GetTargetList();
                TargetList.TargetXDescriptor tgtDef = tgtList.FirstOrDefault(name => name.Name == targetChoice);
                if (tgtDef == null)
                {
                    return;
                }

                FitsIsOpen           = VariScanFileManager.DialogOpenImageFile(TSX_Image, tgtDef.Name);
                OpenFileNameBox.Text = TSX_Image.Path;
                if (FitsIsOpen)
                {
                    TargetedNameBox.Text   = tgtDef.Name;
                    TargetedRABox.Text     = Utility.SexidecimalRADec(tgtDef.RA, true);
                    TargetedDecBox.Text    = Utility.SexidecimalRADec(tgtDef.Dec, false);
                    TargetedFilterBox.Text = tgtList.ElementAt(SelectTargetListBox.SelectedIndex).Filter.ToString();
                    TargetData tstar = Analyze(tgtDef.Name, tgtDef.RA, tgtDef.Dec);
                    if (tstar.IsImageLinked)
                    {
                        ManageTSXProcess.MinimizeTSX();
                        SourceRATextBox.Text  = Utility.SexidecimalRADec(tstar.SourceRA, true);
                        SourceDecTextBox.Text = Utility.SexidecimalRADec(tstar.SourceDec, false);
                        tstar = GraphMagnitudes(tstar);
                        tstar = GraphSource(tstar);
                        FillPhotometrySummary(tstar);
                        PlotPhotometryHistory(tgtDef.Name);
                        ManageTSXProcess.NormalizeTSX();
                    }
                    Show();
                    System.Windows.Forms.Application.DoEvents();
                }
            }
            else
            {
                string targetChoice = SelectTargetListBox.SelectedItem.ToString();
                PlotPhotometryHistory(targetChoice);
                Show();
                System.Windows.Forms.Application.DoEvents();
            }
        }
Ejemplo n.º 2
0
        private void SingleButton_Click(object sender, EventArgs e)
        {
            //DialogResult odr = OrphanFileDialog.ShowDialog();

            //close the current tsx image if one is open
            if (TSX_Image != null)
            {
                VariScanFileManager.CloseImageFile(TSX_Image);
            }

            TargetList.TargetXDescriptor tgtDef = new TargetList.TargetXDescriptor("Orphan", 0, 0, 0);

            FitsIsOpen           = VariScanFileManager.DialogOrphanImageFile(TSX_Image, tgtDef.Name);
            OpenFileNameBox.Text = TSX_Image.Path;
            if (FitsIsOpen)
            {
                Fits fits = new Fits(TSX_Image);
                tgtDef.Name            = fits.FitsTarget;
                tgtDef.RA              = (double)(fits.FitsRA ?? 0);
                tgtDef.Dec             = (double)(fits.FitsDec ?? 0);
                tgtDef.Filter          = 3;
                tgtDef.LastImagingDate = fits.FitsUTCDateTime;

                TargetedNameBox.Text   = tgtDef.Name;
                TargetedRABox.Text     = Utility.SexidecimalRADec(tgtDef.RA, true);
                TargetedDecBox.Text    = Utility.SexidecimalRADec(tgtDef.Dec, false);
                TargetedFilterBox.Text = fits.Filter;
                TargetData tstar = Analyze(tgtDef.Name, tgtDef.RA, tgtDef.Dec);
                if (tstar.IsImageLinked)
                {
                    ManageTSXProcess.MinimizeTSX();
                    SourceRATextBox.Text  = Utility.SexidecimalRADec(tstar.SourceRA, true);
                    SourceDecTextBox.Text = Utility.SexidecimalRADec(tstar.SourceDec, false);
                    tstar = GraphMagnitudes(tstar);
                    tstar = GraphSource(tstar);
                    FillPhotometrySummary(tstar);
                    PlotPhotometryHistory(tgtDef.Name);
                    ManageTSXProcess.NormalizeTSX();
                }
            }
            Show();
            System.Windows.Forms.Application.DoEvents();
            return;
        }
Ejemplo n.º 3
0
        private void ScanImagesButton_Click(object sender, EventArgs e)
        {
            //Redden the command button
            Utility.ButtonRed(ScanImagesButton);
            Show();
            System.Windows.Forms.Application.DoEvents();

            //Get list of targets
            TargetList vList = new TargetList();
            List <TargetList.TargetXDescriptor> targetList = vList.GetTargetList();

            for (int iTgt = 0; iTgt < targetList.Count; iTgt++)
            {
                string targetDirectoryName = targetList[iTgt].Name;
                FitsNameBox.Text = targetDirectoryName;
                Show();
                System.Windows.Forms.Application.DoEvents();

                IEnumerable <string> targetImages = VariScanFileManager.TargetImageList(targetDirectoryName);
                if (targetImages != null)
                {
                    foreach (string iFile in targetImages)
                    {
                        //Use a direct fits reader to determine if the image has already been analyized, i.e. in Starchive (TSX is too slow)
                        Starchive recs  = new Starchive();
                        FitsFile  fitMe = new FitsFile(iFile);
                        FitsNameBox.Text   = targetDirectoryName;
                        FitsDateBox.Text   = fitMe.FitsUTCDateTime.ToShortDateString();
                        FitsTimeBox.Text   = fitMe.FitsUTCDateTime.ToShortTimeString();
                        FitsFilterBox.Text = fitMe.Filter.ToString();
                        Show();
                        System.Windows.Forms.Application.DoEvents();

                        if (!recs.HasMatchingPhotometryRecord(targetDirectoryName, fitMe.Filter, fitMe.FitsUTCDateTime))
                        {
                            if (TSX_Image != null)
                            {
                                VariScanFileManager.CloseImageFile(TSX_Image);
                            }
                            FitsIsOpen = VariScanFileManager.DirectOpenFitsFile(TSX_Image, iFile);
                            if (FitsIsOpen)
                            {
                                OpenFileNameBox.Text = iFile;
                                FITImage             = new Fits(TSX_Image);
                                //if (!recs.HasMatchingPhotometryRecord(targetDirectoryName, FITImage.Filter, FITImage.FitsUTCDateTime))
                                //{
                                ManageTSXProcess.MinimizeTSX();
                                TargetedNameBox.Text   = targetList[iTgt].Name;
                                TargetedRABox.Text     = Utility.SexidecimalRADec(targetList[iTgt].RA, true);
                                TargetedDecBox.Text    = Utility.SexidecimalRADec(targetList[iTgt].Dec, false);
                                TargetedFilterBox.Text = targetList[iTgt].Filter.ToString();
                                TargetData tstar = Analyze(targetList[iTgt].Name, targetList[iTgt].RA, targetList[iTgt].Dec);
                                if (tstar.IsImageLinked)
                                {
                                    SourceRATextBox.Text  = Utility.SexidecimalRADec(tstar.SourceRA, true);
                                    SourceDecTextBox.Text = Utility.SexidecimalRADec(tstar.SourceDec, false);
                                    tstar = GraphMagnitudes(tstar);
                                    tstar = GraphSource(tstar);
                                    FillPhotometrySummary(tstar);
                                    ArchiveStar(tstar);
                                    PlotPhotometryHistory(targetList[iTgt].Name);
                                    Show();
                                    System.Windows.Forms.Application.DoEvents();
                                }
                                else
                                {
                                    //Star did not image link -- archive it as is
                                    ArchiveStar(tstar);
                                }
                                ManageTSXProcess.NormalizeTSX();
                                //}
                                Show();
                                System.Windows.Forms.Application.DoEvents();
                            }
                        }
                    }
                }
            }
            breakLoop = false;
            Utility.ButtonGreen(BreakButton);
            //Green the command button
            Utility.ButtonGreen(ScanImagesButton);
            return;
        }