Skip to content

Commit 9c93aae

Browse files
committed
2024.02.21
1 parent d1fee74 commit 9c93aae

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

JPFITS/AstraCarta.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static void Help()
6969
{
7070
StringBuilder sb = new StringBuilder();
7171
sb.AppendLine("\"-maglimit\" Magnitude limit below which to flag bright sources and save to output table. Default is 100, to pass all, given that there is no such low magnitude." + Environment.NewLine);
72-
sb.AppendLine("\"-buffer\" Tolerance buffer around image field, in arcminutes. This field can be negative, if one wishes to mitigate image padding in the query." + Environment.NewLine);
72+
sb.AppendLine("\"-buffer\" Tolerance buffer around image field, in arcminutes. This field can be negative, if one wishes to mitigate image padding." + Environment.NewLine);
7373
sb.AppendLine("\"-offsetra\" Offset the center of the query region in right ascension. Units in arcminutes." + Environment.NewLine);
7474
sb.AppendLine("\"-offsetdec\" Offset the center of the query region in declination. Units in arcminutes." + Environment.NewLine);
7575
sb.AppendLine("\"-shape\" Shape of field to query: \"rectangle\" (default) or \"circle\". Circle may only be used if pixwidth and pixheight are equal. Rectangle query uses a polygon query with corners defined by an ad-hoc WCS given the supplied field parameters, whereas circle uses a radius." + Environment.NewLine);
@@ -99,8 +99,8 @@ public static void Help()
9999
/// <summary>
100100
/// Perform a query with no user interface dialog form. Will throw an informative exception if something goes wrong. Returns a string which is the filename of the catalogue data downloaded. If nothing was found the string will be empty.
101101
/// </summary>
102-
/// <param name="ra">The right acension of the field center.</param>
103-
/// <param name="dec">The declination of the field center.</param>
102+
/// <param name="ra">The right acension of the field center. Degrees.</param>
103+
/// <param name="dec">The declination of the field center. Degrees.</param>
104104
/// <param name="scale">The plate scale in arcseconds per pixel.</param>
105105
/// <param name="pixwidth">The number of horizontal pixels of the image.</param>
106106
/// <param name="pixheight">The number of vertical pixels of the image</param>
@@ -110,6 +110,9 @@ public static void Help()
110110
/// <br />Boolean arguments do not require a value, and their presence indicates true. For example the presence of optArgs.Add("-fitsout") equates to true for writing the file as a FITS bintable.</param>
111111
public static string Query(double ra, double dec, double scale, int pixwidth, int pixheight, ArrayList? optArgs = null)
112112
{
113+
double RAorig = ra;
114+
double decorig = dec;
115+
113116
try
114117
{
115118
if (optArgs == null)
@@ -609,6 +612,11 @@ public static string Query(double ra, double dec, double scale, int pixwidth, in
609612

610613
FITSBinTable fbt = new FITSBinTable(catalogue);
611614
fbt.SetTTYPEEntries(ttypes, null, table);
615+
fbt.AddExtraHeaderKey("RADEG", RAorig.ToString(), "Right Ascension of query center");
616+
fbt.AddExtraHeaderKey("DECDEG", decorig.ToString(), "Declination of query center");
617+
WorldCoordinateSolution.DegreeElementstoSexagesimalElements(RAorig, decorig, out string rasex, out string decsex, ":", 4);
618+
fbt.AddExtraHeaderKey("RASEX", rasex, "Right Ascension of query center");
619+
fbt.AddExtraHeaderKey("DECSEX", decsex, "Declination of query center");
612620
File.Delete(resultsfilename);
613621
resultsfilename = resultsfilename.Split('.')[0];
614622
resultsfilename += ".fit";

JPFITS/FITSBinTable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class FITSBinTable
3434
{
3535
#region CONSTRUCTORS
3636
/// <summary>Create an empty FITSBinTable object. TTYPE entries may be added later via SetTTYPEEntries or AddTTYPEEntry.</summary>
37-
/// <param name="extensionName">The EXTNAME keyword extension name of the table. Always name your BINTABLE's. Cannot be numeric string.</param>
37+
/// <param name="extensionName">The EXTNAME keyword extension name of the table. Always name your BINTABLEs. Cannot be numeric string.</param>
3838
public FITSBinTable(string extensionName)
3939
{
4040
if (extensionName == null || extensionName.Trim() == "")

JPFITS/FITSFILEOPS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7451,7 +7451,7 @@ public static bool SeekExtension(FileStream fs, string extension_type, int exten
74517451
return SeekExtension(fs, extension_type, "_FINDEXTNUM_" + extension_number.ToString(), ref header_return, out extensionStartPosition, out extensionEndPosition, out tableEndPosition, out pcount, out theap);
74527452
}
74537453

7454-
/// <summary>Gets all extension names of a specified extension type in the FITS file. If no extensions of the type exist, returns and empty array.</summary>
7454+
/// <summary>Gets all extension names of a specified extension type in the FITS file. If no extensions of the type exist, returns an empty array.</summary>
74557455
/// <param name="FileName">The full file name to read from disk.</param>
74567456
/// <param name="extension_type">The XTENSION extension type, either: &quot;BINTABLE&quot;, &quot;TABLE&quot;, or &quot;IMAGE&quot;.</param>
74577457
public static string[] GetAllExtensionNames(string FileName, ExtensionType extension_type)

JPFITS/FITSImage.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public FITSImage(string fullFileName, bool mayContainExtensions)
6464
/// <param name="imageArrayVectorData">The data array or vector to use for the FITS image data. The precision and rank of the underlying array will be automatically determined. Vectors will be converted to a 1D array.</param>
6565
/// <param name="doStats">Optionally perform the statistics to determine min, max, mean, median, and standard deviation of the image data - saves time if you don't need those.</param>
6666
/// <param name="doParallel">Populate the FITSImage object ImageData and perform stats (if true) with parallelization.</param>
67-
public FITSImage(string fullFileName, Array imageArrayVectorData, bool doStats, bool doParallel)
67+
public FITSImage(string fullFileName, Array imageArrayVectorData, bool doStats, bool doParallel = false)
6868
{
6969
int rank = imageArrayVectorData.Rank;
7070

@@ -309,7 +309,7 @@ public FITSImage(string fullFileName, Array imageArrayVectorData, bool doStats,
309309
/// <param name="populateData">Optionally populate the image data array - sometimes you just want the header and don't need the data.</param>
310310
/// <param name="doStats">Optionally perform the statistics to determine min, max, mean, median, and standard deviation of the image data (if populated) - saves time if you don't need those.</param>
311311
/// <param name="doParallel">Populate the FITSImage object ImageData and perform stats (if true) with parallelization.</param>
312-
public FITSImage(string fullFileName, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel)
312+
public FITSImage(string fullFileName, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel = false)
313313
{
314314
FULLFILENAME = fullFileName;
315315
FILENAME = Path.GetFileName(FULLFILENAME);
@@ -359,7 +359,7 @@ public FITSImage(string fullFileName, int[]? range, bool populateHeader, bool po
359359
/// <param name="populateData">Optionally populate the image data array - sometimes you just want the header and don't need the data.</param>
360360
/// <param name="doStats">Optionally perform the statistics to determine min, max, mean, median, and standard deviation of the image data (if populated) - saves time if you don't need those.</param>
361361
/// <param name="doParallel">Populate the FITSImage object ImageData and perform stats (if true) with parallelization.</param>
362-
public FITSImage(string fullFileName, string extensionName, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel)
362+
public FITSImage(string fullFileName, string extensionName, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel = false)
363363
{
364364
FULLFILENAME = fullFileName;
365365
FILENAME = Path.GetFileName(FULLFILENAME);
@@ -428,7 +428,7 @@ public FITSImage(string fullFileName, string extensionName, int[]? range, bool p
428428
/// <param name="populateData">Optionally populate the image data array - sometimes you just want the header and don't need the data.</param>
429429
/// <param name="doStats">Optionally perform the statistics to determine min, max, mean, median, and standard deviation of the image data (if populated) - saves time if you don't need those.</param>
430430
/// <param name="doParallel">Populate the FITSImage object ImageData and perform stats (if true) with parallelization.</param>
431-
public FITSImage(string fullFileName, int extensionNumber, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel)
431+
public FITSImage(string fullFileName, int extensionNumber, int[]? range, bool populateHeader, bool populateData, bool doStats, bool doParallel = false)
432432
{
433433
FULLFILENAME = fullFileName;
434434
FILENAME = Path.GetFileName(FULLFILENAME);
@@ -751,7 +751,7 @@ public void StatsUpD(bool doParallel)
751751
/// <summary>Use SetImage to replace the existing double array for the FITSImage object with a new double array.</summary>
752752
/// <param name="imageArrayData">The 2-D double array to set for the FITSImage object.</param>
753753
/// <param name="Do_Stats">Optionally update the stats for the new array.</param>
754-
public void SetImage(double[,] imageArrayData, bool Do_Stats, bool doParallel)
754+
public void SetImage(double[,] imageArrayData, bool Do_Stats, bool doParallel = false)
755755
{
756756
DIMAGE = imageArrayData;
757757
NAXISN = new int[2] { imageArrayData.GetLength(0), imageArrayData.GetLength(1) };
@@ -935,7 +935,7 @@ public void FlipHorizontal()
935935
/// <br />If the file name already exists on disk, the primary unit will be overwritten, and any existing extensions will be appended to conserve the data file.</summary>
936936
/// <param name="precision">Byte precision at which to write the image data.</param>
937937
/// <param name="doParallel">Populate the underlying byte arrays for writing with parallelization.</param>
938-
public void WriteImage(DiskPrecision precision, bool doParallel)
938+
public void WriteImage(DiskPrecision precision, bool doParallel = false)
939939
{
940940
ISEXTENSION = false;
941941
EXTNAME = null;
@@ -948,7 +948,7 @@ public void WriteImage(DiskPrecision precision, bool doParallel)
948948
/// <param name="fullFileName">File name.</param>
949949
/// <param name="precision">Byte precision at which to write the image data.</param>
950950
/// <param name="doParallel">Populate the underlying byte arrays for writing with parallelization.</param>
951-
public void WriteImage(string fullFileName, DiskPrecision precision, bool doParallel)
951+
public void WriteImage(string fullFileName, DiskPrecision precision, bool doParallel = false)
952952
{
953953
ISEXTENSION = false;
954954
EXTNAME = null;
@@ -972,7 +972,7 @@ public void WriteImage(string fullFileName, DiskPrecision precision, bool doPara
972972
/// <param name="overwriteExtensionIfExists">If the image extension already exists it can be overwritten. If it exists and the option is given to not overwrite it, then an exception will be thrown.</param>
973973
/// <param name="precision">Byte precision at which to write the image data.</param>
974974
/// <param name="doParallel">Populate the underlying byte arrays for writing with parallelization.</param>
975-
public void WriteImage(string fullFileName, string extensionName, bool overwriteExtensionIfExists, DiskPrecision precision, bool doParallel)
975+
public void WriteImage(string fullFileName, string extensionName, bool overwriteExtensionIfExists, DiskPrecision precision, bool doParallel = false)
976976
{
977977
ISEXTENSION = true;
978978
EXTNAME = extensionName;
@@ -1178,7 +1178,7 @@ public static void RawDataToFITSImage(string diskRawDataFileName, string fitsFil
11781178
/// <summary>Return the primary image of the FITS file as a double 2-D array.</summary>
11791179
/// <param name="fullFileName">The full file name to read from disk.</param>
11801180
/// <param name="range">Range is ZERO based 1-D int array [xmin xmax ymin ymax]. Pass null or Range[0] = -1 to default to full image size.</param>
1181-
public static double[,] ReadImageArrayOnly(string fullFileName, int[]? range, bool doParallel)
1181+
public static double[,] ReadImageArrayOnly(string fullFileName, int[]? range, bool doParallel = false)
11821182
{
11831183
return new FITSImage(fullFileName, range, false, true, false, doParallel).Image;
11841184
}
@@ -1187,7 +1187,7 @@ public static void RawDataToFITSImage(string diskRawDataFileName, string fitsFil
11871187
/// <param name="fullFileName">The full file name to read from disk.</param>
11881188
/// <param name="range">Range is ZERO based 1-D int array [xmin xmax ymin ymax]. One of the axes ranges must be length equal to 1.
11891189
/// <br /> Pass null or Range[0] = -1 to default to full image size, assuming the image data is a vector.</param>
1190-
public static double[] ReadImageVectorOnly(string fullFileName, int[]? range, bool doParallel)
1190+
public static double[] ReadImageVectorOnly(string fullFileName, int[]? range, bool doParallel = false)
11911191
{
11921192
FileStream fs = new FileStream(fullFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
11931193
ArrayList header = null;

0 commit comments

Comments
 (0)