diff --git a/documentation/pipeline.man b/documentation/pipeline.man index 9ff82016..efd1ccbf 100644 --- a/documentation/pipeline.man +++ b/documentation/pipeline.man @@ -1,4 +1,4 @@ -.TH PIPELINE 3 "06 November 2021" +.TH PIPELINE 3 "06 November 2021" .SH NAME @@ -88,21 +88,6 @@ The field of view of the camera that took the picture (in degrees). Defaults to .SH MISC PIPELINE OPTIONS -.TP -\fB--centroid-mag-filter\fP \fImin-mag\fP -Will not consider centroids with magnitude below \fImin-mag\fP. - -.TP -\fB--centroid-filter-brightest\fP \fInum-stars\fP -Remove all but the brightest \fInum-stars\fP many stars from the list of centroids before sending to -star-id. Often a better choice than \fB--centroid-mag-filter\fP, because you can ensure that you -keep enough stars to do star-id. If both this option and \fB--centroid-mag-filter\fP are provided, -then all stars satisfying both criteria are kept (intersection). - -.TP -\fB--database\fP \fIfilename\fP -Chooses \fIfilename\fP as the database to use during star identification. - .TP \fB--help\fI Prints the contents of the manual entry for the command to the terminal. @@ -117,12 +102,27 @@ Runs the \fIalgo\fP centroiding algorithm. Recognized options are: dummy (random \fB--centroid-dummy-stars\fP \fInum-stars\fP Runs the dummy centroiding algorithm (random centroid algorithm) with \fInum-stars\fP stars centroided. Defaults to 5 if option is not selected. +.TP +\fB--centroid-mag-filter\fP \fImin-mag\fP +Argument is optional. Will not consider centroids with magnitude below \fImin-mag\fP. + +.TP +\fB--centroid-filter-brightest\fP \fInum-stars\fP +Argument is optional. Remove all but the brightest \fInum-stars\fP many stars from the list of centroids before sending to +star-id. Often a better choice than \fB--centroid-mag-filter\fP, because you can ensure that you +keep enough stars to do star-id. If both this option and \fB--centroid-mag-filter\fP are provided, +then all stars satisfying both criteria are kept (intersection). + .SH STAR IDENTIFICATION OPTIONS .TP \fB--star-id-algo\fP \fIalgo\fP Runs the \fIalgo\fP star identification algorithm. Current options are "dummy", "gv", and "pyramid". Defaults to "dummy" if option is not selected. +.TP +\fB--database\fP \fIfilename\fP +Chooses \fIfilename\fP as the database to use during star identification. + .TP \fB--angular-tolerance\fP [\fItolerance\fP] Sets the estimated angular centroiding error tolerance, used in some star id algorithms, to \fItolerance\fP degrees. Defaults to 0.04 degrees. diff --git a/src/databases.hpp b/src/databases.hpp index c8337c11..f33d6643 100644 --- a/src/databases.hpp +++ b/src/databases.hpp @@ -14,7 +14,7 @@ const int32_t kCatalogMagicValue = 0xF9A283BC; /** * A data structure enabling constant-time range queries into fixed numerical data. - * + * * @note Not an instantiable database on its own -- used in other databases */ // TODO: QueryConservative, QueryExact, QueryTrapezoidal? @@ -114,7 +114,7 @@ class MultiDatabaseEntry { std::vector bytes; }; -typedef std::vector MultiDatabaseDescriptor; +using MultiDatabaseDescriptor = std::vector; void SerializeMultiDatabase(SerializeContext *, const MultiDatabaseDescriptor &dbs); diff --git a/src/io.cpp b/src/io.cpp index 6646f8e4..e366a8ab 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -97,16 +97,24 @@ const Catalog &CatalogRead() { char *tsvPath = getenv("LOST_BSC_PATH"); catalog = BscParse(tsvPath ? tsvPath : DEFAULT_BSC_PATH); // perform essential narrowing - // remove all stars with exactly the same position as another, keeping the one with brighter magnitude + // remove all stars with exactly the same position as another, keeping the one with brighter + // magnitude std::sort(catalog.begin(), catalog.end(), [](const CatalogStar &a, const CatalogStar &b) { - return a.spatial.x < b.spatial.x; + if (a.spatial.x != b.spatial.x) { + return a.spatial.x < b.spatial.x; + } else if (a.spatial.y != b.spatial.y) { + return a.spatial.y < b.spatial.y; + } + return a.spatial.z < b.spatial.z; }); - for (int i = catalog.size(); i > 0; i--) { - if ((catalog[i].spatial - catalog[i-1].spatial).Magnitude() < 5e-5) { // 70 stars removed at this threshold. - if (catalog[i].magnitude > catalog[i-1].magnitude) { - catalog.erase(catalog.begin() + i); - } else { + for (int i = catalog.size() - 1; i > 0; i--) { // [BUG]? catalog[catalog.size()] is invalid + if ((catalog[i].spatial - catalog[i - 1].spatial).Magnitude() < 5e-5) { // 70 stars removed at this threshold. + if (catalog[i].magnitude > catalog[i - 1].magnitude) { + // [BUG]? If mag of i > mag of i-1, we want to keep i, not i-1 catalog.erase(catalog.begin() + i - 1); + i--; + } else { + catalog.erase(catalog.begin() + i); } } } diff --git a/src/star-id.cpp b/src/star-id.cpp index b0787313..93cd38d2 100644 --- a/src/star-id.cpp +++ b/src/star-id.cpp @@ -32,7 +32,7 @@ StarIdentifiers GeometricVotingStarIdAlgorithm::Go( StarIdentifiers identified; MultiDatabase multiDatabase(database); const unsigned char *databaseBuffer = multiDatabase.SubDatabasePointer(PairDistanceKVectorDatabase::kMagicValue); - if (databaseBuffer == NULL) { + if (databaseBuffer == nullptr) { return identified; } DeserializeContext des(databaseBuffer); @@ -173,7 +173,7 @@ class PairDistanceInvolvingIterator { * If another PairDistanceInvolvingIterator is equal to this, then it is done iterating. */ PairDistanceInvolvingIterator() - : pairs(NULL), end(NULL) { }; + : pairs(nullptr), end(nullptr) { }; /** * The main constructor. @@ -252,7 +252,7 @@ std::vector ConsumeInvolvingIterator(PairDistanceInvolvingIterator it) /** * Given the result of a pair-distance kvector query, build a hashmultimap of stars to other stars * that appeared with it in the query. - * + * * The resulting map is "symmetrical" in the sense that if a star B is in the map for star A, then * star A is also in the map for star B. */ @@ -447,7 +447,7 @@ IRUnidentifiedCentroid *SelectNextUnidentifiedCentroid(std::vector maxMismatchProbability) { - std::cout << "skip: mismatch prob." << std::endl; + std::cerr << "skip: mismatch prob." << std::endl; continue; }