Ejemplo n.º 1
0
        public StokesMapper(MagnetizedSurface magSrf,
                            Stokes_T_F_B_Theta_Lambda stokes_func,
                            StokesCurve[] curves)
        {
            this.magSrf      = magSrf;
            this.stokes_func = stokes_func;
            this.curves      = curves;
            this.curvesRes   = new StokesCurve[curves.Length];

            for (int q = 0; q < this.curvesRes.Length; q++)
            {
                this.curvesRes[q]        = new StokesCurve();
                this.curvesRes[q].filter = curves[q].filter;
                this.curvesRes[q].phases = curves[q].phases;
                this.curvesRes[q].type   = curves[q].type;
            }

            this.magSrfRes = new MagnetizedSurface(
                magSrf.InclinationOfRotationAxis,
                magSrf.LatitudeDipolOffset,
                magSrf.LongitudeDipolOffset,
                magSrf.PolesMagneticField,
                magSrf.NLat,
                magSrf.NLong, 1);
        }
Ejemplo n.º 2
0
 public StokesModeller(Stokes_B_Theta_Lambda stokesI_b_theta_lambda,
     Stokes_B_Theta_Lambda stokesV_b_theta_lambda,
     Stokes_B_Theta_Lambda stokesQ_b_theta_lambda,
     Stokes_B_Theta_Lambda stokesU_b_theta_lambda,
     MagnetizedSurface magSrf)
 {
     this.stokesI_b_theta_lambda = stokesI_b_theta_lambda;
     this.stokesV_b_theta_lambda = stokesV_b_theta_lambda;
     this.stokesQ_b_theta_lambda = stokesQ_b_theta_lambda;
     this.stokesU_b_theta_lambda = stokesU_b_theta_lambda;
     this.magSrf = magSrf;
 }
Ejemplo n.º 3
0
        private void btnISM_StartMapping_Click(object sender, EventArgs e)
        {
            double polesMagStr;
            double polesLong;
            double polesCoLat;
            double inc;
            double regPar;
            double logL;
            int    n, m;

            try
            {
                polesMagStr = double.Parse(txtISM_PolesMagStr.Text.Replace(".", ",")) * 1e6;
                polesLong   = double.Parse(txtISM_PolesLongitude.Text.Replace(".", ",")) * Math.PI / 180;
                polesCoLat  = double.Parse(txtISM_PolesColatitude.Text.Replace(".", ",")) * Math.PI / 180;
                inc         = double.Parse(txtISM_Inclination.Text.Replace(".", ",")) * Math.PI / 180;
                regPar      = double.Parse(txtISM_RegulParameter.Text.Replace(".", ","));
                n           = int.Parse(txtISM_LatBeltsNumber.Text);
                m           = int.Parse(txtISM_LongBeltsNumber.Text);
                logL        = double.Parse(txtLogL.Text.Replace(".", ","));
            }
            catch
            {
                MessageBox.Show("Wrong format of input data...", "Error...");
                return;
            }

            //StokesImaging.WM85Interpolator wm85 = new Maper.StokesImaging.WM85Interpolator();


            spp_ism = new Maper.StokesImaging.StokesParsProvider(
                txtISM_IPath.Text,
                txtISM_QPath.Text,
                txtISM_VPath.Text
                );

            StokesImaging.MagnetizedSurface srf = new Maper.StokesImaging.MagnetizedSurface(inc, polesCoLat, polesLong,
                                                                                            polesMagStr, n, m, 1);

            sm = new Maper.StokesImaging.StokesMapper(srf,
                                                      spp_ism.GetStokesPars, this.stokesCurvesBox.StokesCurves);

            txtIS_Results.AppendText("\r\nStart imaging procedure...");
            MathLib.Counter counter = new MathLib.Counter();
            counter.Start();
            sm.StartMapping(regPar, Math.Pow(10, logL), Application.StartupPath);
            counter.Stop();
            txtIS_Results.AppendText(
                string.Format("\r\nDone!\r\nComputings duration is: {0} sec",
                              counter.TotalSeconds.ToString()));

            this.magSrfRes = sm.ResultSurface;
        }
Ejemplo n.º 4
0
        private void btnSI_CreateSurface_Click(object sender, EventArgs e)
        {
            double magStr, betaOffset, lambdaOffset, inc, magStr2;
            int    partFlag = 0;
            int    n, m;

            try
            {
                magStr       = double.Parse(txtSI_PolesMagFieldStr.Text.Replace(".", ",")) * 1e6;
                magStr2      = double.Parse(txtSI_B2.Text.Replace(".", ",")) * 1e6;
                betaOffset   = double.Parse(txtSI_BetaOffset.Text.Replace(".", ",")) * Math.PI / 180;
                lambdaOffset = double.Parse(txtSI_LambdaOffset.Text.Replace(".", ",")) * Math.PI / 180;
                inc          = double.Parse(txtSI_Inc.Text.Replace(".", ",")) * Math.PI / 180;
                n            = int.Parse(txtSI_N.Text);
                m            = int.Parse(txtSI_M.Text);
                if (cbSI_PartSimple.Checked)
                {
                    partFlag = 0;
                }
                if (cbSI_PartEqAreas.Checked)
                {
                    partFlag = 1;
                }
            }
            catch
            {
                return;
            }

            if (magStr == magStr2)
            {
                this.magSrf = new Maper.StokesImaging.MagnetizedSurface(inc, betaOffset,
                                                                        lambdaOffset, magStr, n, m, partFlag);
            }
            else
            {
                this.magSrf = new Maper.StokesImaging.MagnetizedSurface(inc, betaOffset,
                                                                        lambdaOffset, magStr, magStr2, n, m, partFlag);
            }
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    pointsCount;
            double poleOptDepth;
            double scale;



            try
            {
                pointsCount  = int.Parse(txtSM_PointsNumber.Text);
                poleOptDepth = double.Parse(txtSM_PoleOptDepth.Text);
                scale        = double.Parse(txtSM_Scale.Text);
            }
            catch
            {
                MessageBox.Show("Wrong format...", "Error...");
                return;
            }



            ///////////////////////////////////////////////////////////////////////////////////////



            try
            {
                this.stokesProvider = new Maper.StokesImaging.StokesParsProvider(
                    @txtPathToStockesIGrid.Text,
                    @txtPathToStockesQGrid.Text,
                    @txtPathToStockesVGrid.Text
                    );
            }
            catch
            {
                MessageBox.Show("Cannot find some Stockes Grid file...", "Error...");
                txtSM_Results.Text += "\r\nOops... Some error was occured...";
                return;
            }

            double[] phases = new double[pointsCount];
            for (int i = 0; i < phases.Length; i++)
            {
                phases[i] = i / (double)pointsCount;
            }

            StreamWriter sw = new StreamWriter("D:\\out.dat");

            for (double bbg = 0; bbg <= 38.0; bbg = bbg + 0.5)
            {
                double mm1 = 49 * 1e6, mm2 = 51 * 1e6;
                mm1    = 43.31554 - 0.25286 * bbg + 0.00373 * bbg * bbg; // 39
                mm2    = 57.93482 - 0.41099 * bbg + 0.00617 * bbg * bbg; // 51
                mm1    = mm1 * 1e6;
                mm2    = mm2 * 1e6;
                magSrf = new Maper.StokesImaging.MagnetizedSurface(79 * Math.PI / 180, bbg * Math.PI / 180, 80 * Math.PI / 180, mm1, mm2, 360, 720, 0);
                this.stokesModeller = new Maper.StokesImaging.StokesModeller(
                    stokesProvider.StokesI,
                    stokesProvider.StokesV,
                    stokesProvider.StokesQ,
                    stokesProvider.StokesU,
                    this.magSrf);

                this.magSrf.AddRectSpot((38 - bbg) * Math.PI / 180, //!
                                        (39 - bbg) * Math.PI / 180, //!
                                        179 * Math.PI / 180,
                                        181 * Math.PI / 180,
                                        1.0);

                for (double l = 1; l <= 6; l = l + 0.1)
                {
                    this.stokesModeller.StartStokesCurvesModelling(phases, scale, Math.Pow(10, l) * 39e6 / mm1);
                    double[] sti = stokesModeller.StokesI;
                    double[] stv = stokesModeller.StokesV;
                    sw.Write(string.Format("{0}\t{1}\t", bbg, l).Replace(",", "."));
                    for (int k = 0; k < sti.Length; k++)
                    {
                        sw.Write(string.Format("{0}\t", sti[k]).Replace(",", "."));
                    }
                    for (int k = 0; k < stv.Length; k++)
                    {
                        sw.Write(string.Format("{0}\t", stv[k]).Replace(",", "."));
                    }
                    sw.Write("\r\n");
                }
            }
            sw.Close();
            txtSM_Results.Text += "\r\nError String: " + this.stokesModeller.ErrorString;
        }