sky.h 2.05 KB
Newer Older
Noah Smith's avatar
sync  
Noah Smith committed
1 2
#ifndef SKY_H
#define SKY_H
Noah Smith's avatar
init  
Noah Smith committed
3
#include <Eigen/Core>
4
#include <map>
Noah Smith's avatar
sync  
Noah Smith committed
5
#include "util.h"
Noah Smith's avatar
init  
Noah Smith committed
6 7

namespace starid {
Noah Smith's avatar
sync  
Noah Smith committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

    struct skymaprec {
        double mv1;
        std::string iau_identifier;
        std::string star_name;
        std::string variablestar_name;
        int skymap_number;
        int hd_number;
        int sao_number;
        int dm_number;
        int hr_number;
        int wds_number;
        int ppm_number;
        bool blended_position;
        double rah;
        double ram;
        double ras;
        double decd;
        double decm;
        double decs;
        double pmra_arcsec_per_year;
        double pmdec_arcsec_per_year;
        double decsign;
        double pmdecsign;
        std::string fileline;
    };
    
    struct star {
        int starndx;
        int skymap_number;
        double mv;
        double ra_degrees;
        double dec_degrees;
        double x;
        double y;
        double z;
        template<class Archive>
        void serialize(Archive &ar) {
            ar(starndx, skymap_number, mv, ra_degrees, dec_degrees, x, y, z);
        }
    };
    
Noah Smith's avatar
Noah Smith committed
50
    class skymap {
Noah Smith's avatar
sync  
Noah Smith committed
51
    public:
Noah Smith's avatar
sync  
Noah Smith committed
52 53
        explicit skymap(std::string pathcat);
        std::vector<skymaprec> records;
Noah Smith's avatar
sync  
Noah Smith committed
54
    };
Noah Smith's avatar
init  
Noah Smith committed
55

Noah Smith's avatar
Noah Smith committed
56
    class sky {
Noah Smith's avatar
sync  
Noah Smith committed
57
    public:
Noah Smith's avatar
Noah Smith committed
58
        void start(std::string pathin);
Noah Smith's avatar
sync  
Noah Smith committed
59
        std::vector<star> stars;
Noah Smith's avatar
Noah Smith committed
60 61
        std::vector<std::string> catalog_lines;
        std::vector<int> stars_near_point(double x, double y, double z);
Noah Smith's avatar
Noah Smith committed
62 63
        std::map<std::string, Eigen::MatrixXd> image_generator(int starndx);
        std::map<std::string, Eigen::MatrixXd> angle_generator(int starndx);
Noah Smith's avatar
sync  
Noah Smith committed
64
    private:
Noah Smith's avatar
Noah Smith committed
65
        double t;
Noah Smith's avatar
sync  
Noah Smith committed
66
        std::string pathcat;
Noah Smith's avatar
sync  
Noah Smith committed
67 68 69
        starid::range_of_floats_indexer xndxer;
        starid::range_of_floats_indexer yndxer;
        starid::range_of_floats_indexer zndxer;
Noah Smith's avatar
sync  
Noah Smith committed
70
        std::vector<int> stars_in_ring(double p, double radius, starid::range_of_floats_indexer &table);
Noah Smith's avatar
Noah Smith committed
71 72 73
        friend class cereal::access;
        template<class Archive>
        void serialize(Archive &ar) {
Noah Smith's avatar
sync  
Noah Smith committed
74
            ar(stars, xndxer, yndxer, zndxer);
Noah Smith's avatar
Noah Smith committed
75
        }
Noah Smith's avatar
sync  
Noah Smith committed
76
    };
Noah Smith's avatar
init  
Noah Smith committed
77 78 79 80
}

#endif