Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
merge with develop before release
  • Loading branch information
bbercovici committed Jun 25, 2018
2 parents eeb39c8 + d2ea119 commit 9623128
Show file tree
Hide file tree
Showing 32 changed files with 1,766 additions and 950,085 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,26 @@ to apply the update (if any).



### [SBGAT 1.05.2](https://github.com/bbercovici/SBGAT/releases/tag/1.05.1)
### [SBGAT 1.06.1](https://github.com/bbercovici/SBGAT/releases/tag/1.06.1)

#### New:
- Added `SBGATObsLightcurve` to `SbgatCore` , a module enabling the generation of instantaneous-exposure lightcurves in a fixed-spin scenario. This module assumes constant small-body spin and phase angle between the sun, the small body and the observer.
- `SBGATObsRadar` now throws an instance of `std::runtime_error` if the specified bin sizes are incompatible with the collected data that may yield an empty histogram dimension
- Observations from `SBGATObsRadar` and `SBGATObsLightcurve` can be penalized by incidence so as to diminish the weight of a given measurement. `SBGATObsRadar` weighs by the `cos` of the angle between the observer and the surface normal, while `SBGATObsLightcurve` weighs by the product of the `cos` of the angle between the observer and the surface normal and the `cos` of the angle between the sun and the surface normal

#### Improvements
- Simulated Range/Range-rate images and lightcurves rely on area-weighted surface sampling : `N * surface_area/max_surface_area` points are sampled for each facet, where `max_surface_area` is the surface area of the largest facet in the shape and `surface_area` that of the considered facet
- Removed more deprecated functionalities

#### Bug fixes:
- Fixed bug in `SbgatGui` that was allowing users to bin radar observations before effectively collecting them.
- Saved radar images now have correct color levels


### [SBGAT 1.05.2](https://github.com/bbercovici/SBGAT/releases/tag/1.05.2)

- Adds `SBGATObsRadar` to `SbgatCore`, a class emulating range/range-rate radar measurements. The corresponding menu and action are also available in `SbgatGui`
- If `gcc` exists in Homebrew's Cellar, SBGAT and its dependencies will be compiled using this OpenMP compliant compiler, giving better performance on multithreaded platforms. [This functionality had to be postponed due to Qt 5.10 incompability with recent gcc versions](https://bugreports.qt.io/browse/QTBUG-66585).
- If `gcc` exists in Homebrew's Cellar, SBGAT and its dependencies will be compiled using this OpenMP compliant compiler, giving better performance on multithreaded platforms. [This functionality had to be postponed due to Qt 5.10 incompability with recent gcc versions on MacOS](https://bugreports.qt.io/browse/QTBUG-66585).


### [SBGAT 1.05.1](https://github.com/bbercovici/SBGAT/releases/tag/1.05.1)
Expand Down
2 changes: 2 additions & 0 deletions SbgatCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ add_library(${LIB_NAME}
source/SBGATSphericalHarmo.cpp
source/SBGATObjWriter.cpp
source/SBGATObsRadar.cpp
source/SBGATObsLightcurve.cpp


)

Expand Down
146 changes: 146 additions & 0 deletions SbgatCore/include/SbgatCore/SBGATObsLightcurve.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
/** MIT License
Copyright (c) 2018 Benjamin Bercovici and Jay McMahon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

/*=========================================================================
Program: Small Body Geophysical Analysis
Module: SBGATObsLightcurve.hpp
Derived class from VTK's vtkPolyDataAlgorithm by Benjamin Bercovici
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class SBGATObsRadar
* @author Benjamin Bercovici
* @brief Computes range/range-rate Doppler images over the surface of
provided small body
*
* @details Computes range/range-rate Doppler images over the surface of
provided small body
*
*/

#ifndef SBGATObsLightcurve_H
#define SBGATObsLightcurve_H

#include <vtkFiltersCoreModule.h> // For export macro
#include <vtkPolyDataAlgorithm.h>

#include <vtkModifiedBSPTree.h>
#include <vtkImageData.h>

#include <armadillo>
#include <array>




class VTKFILTERSCORE_EXPORT SBGATObsLightcurve : public vtkPolyDataAlgorithm{
public:

/**
* Constructs with initial values of zero.
*/
static SBGATObsLightcurve *New();

vtkTypeMacro(SBGATObsLightcurve,vtkPolyDataAlgorithm);
void PrintSelf(std::ostream& os, vtkIndent indent) override;
void PrintHeader(std::ostream& os, vtkIndent indent) override;
void PrintTrailer(std::ostream& os, vtkIndent indent) override;

/**
Computes collected luminosity over the surface of the small body at the
specified time after epoch. Exposure is instantaneous. The luminosity is computed as the
number of sample points in view of both the sun and the observer at each time (the "hit count"), normalized by the largest hit count in the observation sequence.
@param measurements reference to a vector of std::arrays holding (times,luminosity)
@param N maximum number of measurements to produce over the largest facet in the shape. The number of samples for any other facet will be equal to N * facet_surface_area / larget_facet_surface_area
@param dt time since epoch (s)
@param period rotation period of target (s)
@param sun_pos unit direction of sun with respect to target in inertial frame
@param observer_pos unit direction of observer with respect to target in inertial frame
@param spin (unit vector) direction of target's spin vector expressed in the target's body frame
@param penalize_incidence if true, each measurement will be weighed by the cos(incidence) angle between
the sampled point and the observer TIMES the cos(incidence) the sampled point and the sun. If false, all accepted measurements (in view of the observer and not blocked)
*/
void CollectMeasurementsSimpleSpin(
std::vector<std::array<double, 2> > & measurements,
const int & N,
const double & dt,
const double & period,
const arma::vec & sun_dir,
const arma::vec & observer_dir,
const arma::vec & spin,
const bool & penalize_indicence);


/**
Sets the scale factor to 1, indicative that the polydata has its coordinates expressed in meters (default)
*/
void SetScaleMeters() { this -> scaleFactor = 1; }

/**
Sets the scale factor to 1000, indicative that the polydata has its coordinates expressed in kilometers
*/
void SetScaleKiloMeters() { this -> scaleFactor = 1000; }


/**
Save the raw data points from the unnormalized (times,luminosity) time series to file
@param measurements reference to a vector of std::arrays holding (times,luminosity)
@param savepath path to file where raw lightcurve data will be saved (ex: "output/lightcurve.txt")
*/
void SaveLightCurveData(const std::vector<std::array<double, 2> > & measurements, std::string savepath);


protected:
SBGATObsLightcurve();
~SBGATObsLightcurve() override;

int RequestData(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector) override;


vtkSmartPointer<vtkModifiedBSPTree> bspTree;

arma::vec center_of_mass;

double scaleFactor = 1;
double max_value;

private:
SBGATObsLightcurve(const SBGATObsLightcurve&) = delete;
void operator=(const SBGATObsLightcurve&) = delete;
};

#endif


31 changes: 22 additions & 9 deletions SbgatCore/include/SbgatCore/SBGATObsRadar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ SOFTWARE.
#include <array>


typedef typename std::vector<std::vector<std::array<double, 2> > > SBGATMeasurementsSequence;


/**
Vector of vector of radar observations. Each observation is comprised of (range,range-rate,incidence)
This incidence is not strictly speaking a measured quantity but is used to penalize the binned
observations, blurring out returns collected at a high incidence
*/
typedef typename std::vector<std::vector<std::array<double, 3> > > SBGATMeasurementsSequence;


class VTKFILTERSCORE_EXPORT SBGATObsRadar : public vtkPolyDataAlgorithm{
Expand All @@ -78,29 +85,34 @@ class VTKFILTERSCORE_EXPORT SBGATObsRadar : public vtkPolyDataAlgorithm{

/**
Collects range/range-rate samples over the surface of the small body at the
specified time after epoch.
The radar source is positionned at 1e6 * l meters from the target's center of mass, where
l is a measure of the object's diagonal
specified time after epoch. The radar source is positionned at 1e6 * l meters from the target's center of mass, where
l is a measure of the object's diagonal.
@param measurements_sequence reference to MeasurementsSequence, holding collected range/range-rate measurements at each observation time
@param N maximum number of measurements to produce per illuminated facet
@param N maximum number of measurements to produce over the largest facet in the shape. The number of samples for any other facet will be equal to N * facet_surface_area / larget_facet_surface_area
@param dt time since epoch (s)
@param period rotation period of target (s)
@param dir (unit vector) direction of radar-to-target vector expressed in the target's body frame at epoch
@param spin (unit vector) direction of target's spin vector expressed in the target's body frame
@param penalize_incidence if true, each measurement will be weighed by the incidence angle between
the sampled point and the observer. If false, all accepted measurements (in view of the observer and not blocked)
have the same weight
*/
void CollectMeasurementsSimpleSpin(
SBGATMeasurementsSequence & measurements_sequence,
const int & N,
const double & dt,
const double & period,
const arma::vec & dir,
const arma::vec & spin);
const arma::vec & spin,
const bool & penalize_incidence);

/**
Bins the provided measurements sequence into a series of 2d-histogram
Will throw an std::runtime_error exception if ither of the provided bin sizes are invalid (i.e <= 0)
@param measurements_sequence reference to MeasurementsSequence, holding collected range/range-rate measurements at each observation time
Will throw an std::runtime_error exception if
- either of the provided bin sizes are invalid (i.e <= 0)
- the provided bin sizes yield empty histogram dimensions
@param measurements_sequence reference to MeasurementsSequence, holding collected range/range-rate measurements at each observation time
@param r_bin range bin size (m)
@param rr_bin range-rate bin size (m/s)
*/
Expand All @@ -110,7 +122,8 @@ class VTKFILTERSCORE_EXPORT SBGATObsRadar : public vtkPolyDataAlgorithm{
const double & rr_bin);

/**
Save the binned radar images to the prescribed folder
Save the binned radar images to PNGs in the prescribed folder.
The images will be normalized by the largest value in the observation sequence
@param savepath path to folder where images will be saved (ex: "output/")
*/
void SaveImages(std::string savepath);
Expand Down
Loading

0 comments on commit 9623128

Please sign in to comment.