Skip to content

Commit

Permalink
.NET core initial checkin.
Browse files Browse the repository at this point in the history
  • Loading branch information
abrudana committed Jun 28, 2019
1 parent d1298df commit f031d1c
Show file tree
Hide file tree
Showing 250 changed files with 44,093 additions and 11 deletions.
62 changes: 62 additions & 0 deletions WorldWideAstronomy/WWA.Core/Astronomy/Astrometry/ab.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//namespace SOFA.Astronomy.Astrometry
namespace WorldWideAstronomy
{
public static partial class WWA
{
/// <summary>
/// Apply aberration to transform natural direction into proper direction.
/// </summary>
///
/// <remarks>
/// World Wide Astronomy - WWA
/// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
///
/// This program is derived from the International Astronomical Union's
/// SOFA (Standards of Fundamental Astronomy) software collection.
/// http://www.iausofa.org
///
/// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
/// This version is intended to retain identical functionality to the SOFA library, but
/// made distinct through different function names (prefixes) and C# language specific
/// modifications in code.
///
/// Contributor
/// Attila Abrudán
///
/// Please read the ReadMe.1st text file for more information.
/// </remarks>
/// <param name="pnat">natural direction to the source (unit vector)</param>
/// <param name="v">observer barycentric velocity in units of c</param>
/// <param name="s">distance between the Sun and the observer (au)</param>
/// <param name="bm1">sqrt(1-|v|^2): reciprocal of Lorenz factor</param>
/// <param name="ppr">proper direction to source (unit vector)</param>
public static void wwaAb(double[] pnat, double[] v, double s, double bm1, ref double[] ppr)
{
int i;
double pdv, w1, w2, r2, w, r;
double[] p = new double[3];
pdv = wwaPdp(pnat, v);
w1 = 1.0 + pdv/(1.0 + bm1);
w2 = SRS/s;
r2 = 0.0;
for (i = 0; i < 3; i++)
{
w = pnat[i]*bm1 + w1*v[i] + w2*(v[i] - pdv*pnat[i]);
p[i] = w;
r2 = r2 + w*w;
}

r = Math.Sqrt(r2);
for (i = 0; i < 3; i++)
{
ppr[i] = p[i]/r;
}
}
}
}
53 changes: 53 additions & 0 deletions WorldWideAstronomy/WWA.Core/Astronomy/Astrometry/apcg.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorldWideAstronomy
{
public static partial class WWA
{
/// <summary>
/// For a geocentric observer, prepare star-independent astrometry
/// parameters for transformations between ICRS and GCRS coordinates.
/// The Earth ephemeris is supplied by the caller.
///
/// The parameters produced by this function are required in the
/// parallax, light deflection and aberration parts of the astrometric
/// transformation chain.
/// </summary>
///
/// <remarks>
/// World Wide Astronomy - WWA
/// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
///
/// This program is derived from the International Astronomical Union's
/// SOFA (Standards of Fundamental Astronomy) software collection.
/// http://www.iausofa.org
///
/// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
/// This version is intended to retain identical functionality to the SOFA library, but
/// made distinct through different function names (prefixes) and C# language specific
/// modifications in code.
///
/// Contributor
/// Attila Abrudán
///
/// Please read the ReadMe.1st text file for more information.
/// </remarks>
/// <param name="date1">TDB as a 2-part...</param>
/// <param name="date2">...Julian Date (Note 1)</param>
/// <param name="ebpv">Earth barycentric pos/vel (au, au/day)</param>
/// <param name="ehp">Earth heliocentric position (au)</param>
/// <param name="astrom">star-independent astrometry parameters</param>
public static void wwaApcg(double date1, double date2, double[,] ebpv, double[] ehp, ref WWA.wwaASTROM astrom)
{
/* Geocentric observer */
double[,] pv = new double[2,3] { { 0, 0, 0 }, { 0, 0, 0 } };

/* Compute the star-independent astrometry parameters. */
wwaApcs(date1, date2, pv, ebpv, ehp, ref astrom);
}
}
}
55 changes: 55 additions & 0 deletions WorldWideAstronomy/WWA.Core/Astronomy/Astrometry/apcg13.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorldWideAstronomy
{
public static partial class WWA
{
/// <summary>
/// For a geocentric observer, prepare star-independent astrometry
/// parameters for transformations between ICRS and GCRS coordinates.
/// The caller supplies the date, and SOFA models are used to predict
/// the Earth ephemeris.
/// The parameters produced by this function are required in the
/// parallax, light deflection and aberration parts of the astrometric
/// transformation chain.
/// </summary>
///
/// <remarks>
/// World Wide Astronomy - WWA
/// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
///
/// This program is derived from the International Astronomical Union's
/// SOFA (Standards of Fundamental Astronomy) software collection.
/// http://www.iausofa.org
///
/// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
/// This version is intended to retain identical functionality to the SOFA library, but
/// made distinct through different function names (prefixes) and C# language specific
/// modifications in code.
///
/// Contributor
/// Attila Abrudán
///
/// Please read the ReadMe.1st text file for more information.
/// </remarks>
/// <param name="date1">TDB as a 2-part...</param>
/// <param name="date2">...Julian Date (Note 1)</param>
/// <param name="astrom">star-independent astrometry parameters</param>
public static void wwaApcg13(double date1, double date2, ref wwaASTROM astrom)
{
double[,] ehpv = new double[2, 3] { { 0, 0, 0 }, { 0, 0, 0 } };
double[,] ebpv = new double[2, 3] { { 0, 0, 0 }, { 0, 0, 0 } };

/* Earth barycentric & heliocentric position/velocity (au, au/d). */
wwaEpv00(date1, date2, ehpv, ebpv);

/* Compute the star-independent astrometry parameters. */
//wwaApcg(date1, date2, ebpv, ehpv[0], ref astrom);
wwaApcg(date1, date2, ebpv, CopyArray(ehpv, 0), ref astrom);
}
}
}
57 changes: 57 additions & 0 deletions WorldWideAstronomy/WWA.Core/Astronomy/Astrometry/apci.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorldWideAstronomy
{
public static partial class WWA
{
/// <summary>
/// For a terrestrial observer, prepare star-independent astrometry
/// parameters for transformations between ICRS and geocentric CIRS
/// coordinates. The Earth ephemeris and CIP/CIO are supplied by the
/// caller.
///
/// The parameters produced by this function are required in the
/// parallax, light deflection, aberration, and bias-precession-nutation
/// parts of the astrometric transformation chain.
/// </summary>
///
/// /// <remarks>
/// World Wide Astronomy - WWA
/// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
///
/// This program is derived from the International Astronomical Union's
/// SOFA (Standards of Fundamental Astronomy) software collection.
/// http://www.iausofa.org
///
/// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
/// This version is intended to retain identical functionality to the SOFA library, but
/// made distinct through different function names (prefixes) and C# language specific
/// modifications in code.
///
/// Contributor
/// Attila Abrudán
///
/// Please read the ReadMe.1st text file for more information.
/// </remarks>
/// <param name="date1">TDB as a 2-part...</param>
/// <param name="date2">...Julian Date (Note 1)</param>
/// <param name="ebpv">Earth barycentric position/velocity (au, au/day)</param>
/// <param name="ehp">Earth heliocentric position (au)</param>
/// <param name="x">CIP X,Y (components of unit vector)</param>
/// <param name="y">CIP X,Y (components of unit vector)</param>
/// <param name="s"></param>
/// <param name="astrom">the CIO locator s (radians)</param>
public static void wwaApci(double date1, double date2, double[,] ebpv, double[] ehp, double x, double y, double s, ref wwaASTROM astrom)
{
/* Star-independent astrometry parameters for geocenter. */
wwaApcg(date1, date2, ebpv, ehp, ref astrom);

/* CIO based BPN matrix. */
wwaC2ixys(x, y, s, astrom.bpn);
}
}
}
71 changes: 71 additions & 0 deletions WorldWideAstronomy/WWA.Core/Astronomy/Astrometry/apci13.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WorldWideAstronomy
{
public static partial class WWA
{
/// <summary>
/// For a terrestrial observer, prepare star-independent astrometry
/// parameters for transformations between ICRS and geocentric CIRS
/// coordinates. The caller supplies the date, and SOFA models are used
/// to predict the Earth ephemeris and CIP/CIO.
///
/// The parameters produced by this function are required in the
/// parallax, light deflection, aberration, and bias-precession-nutation
/// parts of the astrometric transformation chain.
/// </summary>
///
/// <remarks>
/// World Wide Astronomy - WWA
/// Set of C# algorithms and procedures that implement standard models used in fundamental astronomy.
///
/// This program is derived from the International Astronomical Union's
/// SOFA (Standards of Fundamental Astronomy) software collection.
/// http://www.iausofa.org
///
/// The WWA code does not itself constitute software provided by and/or endorsed by SOFA.
/// This version is intended to retain identical functionality to the SOFA library, but
/// made distinct through different function names (prefixes) and C# language specific
/// modifications in code.
///
/// Contributor
/// Attila Abrudán
///
/// Please read the ReadMe.1st text file for more information.
/// </remarks>
/// <param name="date1">TDB as a 2-part...</param>
/// <param name="date2">...Julian Date (Note 1)</param>
/// <param name="astrom">star-independent astrometry parameters</param>
/// <param name="eo">equation of the origins (ERA-GST)</param>
public static void wwaApci13(double date1, double date2, ref wwaASTROM astrom, ref double eo)
{
double[,] ehpv = new double[2, 3] { { 0, 0, 0 }, { 0, 0, 0 } };
double[,] ebpv = new double[2, 3] { { 0, 0, 0 }, { 0, 0, 0 } };

double[,] r = new double[3,3];
double x = 0, y = 0, s;

/* Earth barycentric & heliocentric position/velocity (au, au/d). */
wwaEpv00(date1, date2, ehpv, ebpv);

/* Form the equinox based BPN matrix, IAU 2006/2000A. */
wwaPnm06a(date1, date2, r);

/* Extract CIP X,Y. */
wwaBpn2xy(r, ref x, ref y);

/* Obtain CIO locator s. */
s = wwaS06(date1, date2, x, y);

/* Compute the star-independent astrometry parameters. */
wwaApci(date1, date2, ebpv, CopyArray(ehpv, 0), x, y, s, ref astrom);

/* Equation of the origins. */
eo = wwaEors(r, s);
}
}
}
Loading

0 comments on commit f031d1c

Please sign in to comment.