-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from SeverinDenisenko/37-add-wcs-code
Add config file
- Loading branch information
Showing
859 changed files
with
370,145 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#pragma once | ||
|
||
#include "linalg.hpp" | ||
#include "source_extractor.hpp" | ||
#include "types.hpp" | ||
|
||
#include <libconfig.hh> | ||
#include <sstream> | ||
#include <stdexcept> | ||
|
||
namespace astro { | ||
struct config { | ||
string_t source_extractor_type { "embeded" }; | ||
embeded_source_extractor_params embeded_source_extractor {}; | ||
external_source_extractor_params external_source_extractor {}; | ||
}; | ||
|
||
inline config read_config(string_t path) | ||
{ | ||
config c; | ||
|
||
try { | ||
libconfig::Config cfg; | ||
cfg.readFile(path); | ||
|
||
c.source_extractor_type | ||
= static_cast<string_t>(cfg.lookup("source_extractor")); | ||
c.embeded_source_extractor.detect_minarea = static_cast<integer_t>( | ||
cfg.lookup("embeded_source_extractor.detect_minarea")); | ||
c.embeded_source_extractor.detect_treshold = static_cast<real_t>( | ||
cfg.lookup("embeded_source_extractor.detect_treshold")); | ||
c.embeded_source_extractor.deblend_ntreshold = static_cast<integer_t>( | ||
cfg.lookup("embeded_source_extractor.deblend_ntreshold")); | ||
c.embeded_source_extractor.deblend_mincount = static_cast<real_t>( | ||
cfg.lookup("embeded_source_extractor.deblend_mincount")); | ||
c.external_source_extractor.path = static_cast<string_t>( | ||
cfg.lookup("external_source_extractor.path")); | ||
} catch (const libconfig::ParseException& ex) { | ||
std::stringstream err; | ||
err << "Cant pase config file:"; | ||
err << " file=" << ex.getFile(); | ||
err << " error = " << ex.getError(); | ||
err << " line = " << ex.getLine(); | ||
throw std::runtime_error(err.str()); | ||
} catch (const libconfig::SettingNotFoundException& ex) { | ||
std::stringstream err; | ||
err << "Cant pase config file:"; | ||
err << " path=" << ex.getPath(); | ||
throw std::runtime_error(err.str()); | ||
} | ||
|
||
return c; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include "types.hpp" | ||
|
||
namespace astro { | ||
|
||
inline string_t path_find(array_t<string_t> variants) | ||
{ | ||
string_t res = ""; | ||
|
||
for (string_t name : variants) { | ||
if (!system(("which " + name + " > /dev/null 2>&1").c_str())) { | ||
res = name; | ||
break; | ||
} | ||
} | ||
|
||
if (res == "") { | ||
throw std::runtime_error( | ||
"Can't find any of variants of " + variants[0]); | ||
} | ||
|
||
return res; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include "frame.hpp" | ||
#include "linalg.hpp" | ||
#include "source_extractor.hpp" | ||
|
||
namespace astro { | ||
class frame_summator_interface { | ||
public: | ||
virtual void sum(frame) = 0; | ||
virtual frame result() = 0; | ||
virtual ~frame_summator_interface() = default; | ||
}; | ||
|
||
class delaney_frame_summator : public frame_summator_interface { | ||
public: | ||
delaney_frame_summator( | ||
frame base_frame, uptr<source_extractor_interface> source_extractor); | ||
|
||
virtual void sum(frame fr) override; | ||
|
||
virtual frame result() override; | ||
|
||
private: | ||
frame base_frame_; | ||
uptr<source_extractor_interface> source_extractor_; | ||
array_t<point_t> base_frame_points_; | ||
}; | ||
|
||
class wcs_frame_summator : public frame_summator_interface { | ||
public: | ||
wcs_frame_summator(frame base_frame); | ||
|
||
virtual void sum(frame fr) override; | ||
|
||
virtual frame result() override; | ||
|
||
private: | ||
frame base_frame_; | ||
}; | ||
|
||
} |
Oops, something went wrong.