Beispiel #1
0
        public WM85Interpolator()
        {
            MathLib.Table3D tableT = new MathLib.Table3D(Application.StartupPath + @"\Data\Stokes\MW85Original_kT10_TOTAL.dat");
            MathLib.Table3D tableL = new MathLib.Table3D(Application.StartupPath + @"\Data\Stokes\MW85Original_kT10_LINEAR.dat");
            MathLib.Table3D tableC = new MathLib.Table3D(Application.StartupPath + @"\Data\Stokes\MW85Original_kT10_CIRC.dat");

            this.xT = tableT.XMas; this.yT = tableT.YMas; this.zT = tableT.ZMas; this.fT = tableT.FMas;
            this.xL = tableL.XMas; this.yL = tableL.YMas; this.zL = tableL.ZMas; this.fL = tableL.FMas;
            this.xC = tableC.XMas; this.yC = tableC.YMas; this.zC = tableC.ZMas; this.fC = tableC.FMas;

            // form [deg] to [rad] and replacing 1 deg -> 0 deg and 89 deg -> 90 deg;

            for (int i = 0; i < this.yT.Length; i++)
            {
                this.yT[i] = this.yT[i] * Math.PI / 180;
            }
            this.yT[0] = 0;
            this.yT[this.yT.Length - 1] = 0.5 * Math.PI;

            for (int i = 0; i < this.yL.Length; i++)
            {
                this.yL[i] = this.yL[i] * Math.PI / 180;
            }
            this.yL[0] = 0;
            this.yL[this.yL.Length - 1] = 0.5 * Math.PI;

            for (int i = 0; i < this.yC.Length; i++)
            {
                this.yC[i] = this.yC[i] * Math.PI / 180;
            }
            this.yC[0] = 0;
            this.yC[this.yC.Length - 1] = 0.5 * Math.PI;
        }
Beispiel #2
0
        public StokesParsProvider(string stockesIGridFile, string stockesQGridFile, string stockesVGridFile)
        {
            this.stokesI = new MathLib.Table3D(Application.StartupPath + stockesIGridFile);
            this.stokesQ = new MathLib.Table3D(Application.StartupPath + stockesQGridFile);
            this.stokesV = new MathLib.Table3D(Application.StartupPath + stockesVGridFile);

            this.lambdas = new double[this.stokesI.ZMas.Length];
            this.thetas  = new double[this.stokesI.YMas.Length];
            this.mags    = new double[this.stokesI.XMas.Length];

            for (int i = 0; i < this.lambdas.Length; i++)
            {
                this.lambdas[i] = this.stokesI.ZMas[i];
            }

            for (int i = 0; i < this.thetas.Length; i++)
            {
                this.thetas[i] = this.stokesI.YMas[i];
            }

            for (int i = 0; i < this.mags.Length; i++)
            {
                this.mags[i] = this.stokesI.XMas[i];
            }

            for (int i = 0; i < this.stokesQ.ZMas.Length; i++)
            {
                for (int j = 0; j < this.stokesQ.YMas.Length; j++)
                {
                    for (int k = 0; k < this.stokesQ.XMas.Length; k++)
                    {
                        if (this.stokesI.FMas[i][j][k] != 0)
                        {
                            this.stokesQ.FMas[i][j][k] =
                                this.stokesQ.FMas[i][j][k] / this.stokesI.FMas[i][j][k];
                        }
                        else
                        {
                            this.stokesQ.FMas[i][j][k] = 0;
                        }
                    }
                }
            }

            for (int i = 0; i < this.stokesV.ZMas.Length; i++)
            {
                for (int j = 0; j < this.stokesV.YMas.Length; j++)
                {
                    for (int k = 0; k < this.stokesV.XMas.Length; k++)
                    {
                        if (this.stokesI.FMas[i][j][k] != 0)
                        {
                            this.stokesV.FMas[i][j][k] =
                                this.stokesV.FMas[i][j][k] / this.stokesI.FMas[i][j][k];
                        }
                        else
                        {
                            this.stokesV.FMas[i][j][k] = 0;
                        }
                    }
                }
            }

            // saving circular polarization grid to the file;
            StreamWriter sw = new StreamWriter(Application.StartupPath + "\\circ_pol_tmp.dat");

            for (int i = 0; i < this.stokesV.ZMas.Length; i++)
            {
                sw.WriteLine(this.stokesV.ZMas[i]);
                for (int j = 0; j < this.stokesV.YMas.Length; j++)
                {
                    for (int k = 0; k < this.stokesV.XMas.Length; k++)
                    {
                        sw.Write("{0:0000.000}\t", this.stokesV.FMas[i][j][k].ToString());
                    }
                    sw.Write("\r\n");
                }
            }
            sw.Flush();
            sw.Close();

            // end of saving;

            for (int i = 0; i < this.stokesI.ZMas.Length; i++)
            {
                for (int j = 0; j < this.stokesI.YMas.Length; j++)
                {
                    for (int k = 0; k < this.stokesI.XMas.Length; k++)
                    {
                        if (this.stokesI.FMas[i][j][k] != 0)
                        {
                            this.stokesI.FMas[i][j][k] = Math.Log10(Math.Abs(this.stokesI.FMas[i][j][k]));
                        }
                        else
                        {
                            this.stokesI.FMas[i][j][k] = -50;
                        }
                    }
                }
            }

            int lambdaNumber = this.stokesI.ZMas.Length;

            this.splineI = new MathLib.Spline32D[lambdaNumber];
            this.splineQ = new MathLib.Spline32D[lambdaNumber];
            this.splineV = new MathLib.Spline32D[lambdaNumber];

            this.liI = new LinInterpolator2D[lambdaNumber];
            this.liQ = new LinInterpolator2D[lambdaNumber];
            this.liV = new LinInterpolator2D[lambdaNumber];

            for (int i = 0; i < this.liI.Length; i++)
            {
                this.splineI[i] = new MathLib.Spline32D(this.stokesI.YMas, this.stokesI.XMas, this.stokesI.FMas[i]);
                this.splineQ[i] = new MathLib.Spline32D(this.stokesQ.YMas, this.stokesQ.XMas, this.stokesQ.FMas[i]);
                this.splineV[i] = new MathLib.Spline32D(this.stokesV.YMas, this.stokesV.XMas, this.stokesV.FMas[i]);

                this.liI[i] = new LinInterpolator2D(this.stokesI.YMas, this.stokesI.XMas, this.stokesI.FMas[i]);
                this.liQ[i] = new LinInterpolator2D(this.stokesQ.YMas, this.stokesQ.XMas, this.stokesQ.FMas[i]);
                this.liV[i] = new LinInterpolator2D(this.stokesV.YMas, this.stokesV.XMas, this.stokesV.FMas[i]);
            }
        }