14 #include "msdevstudio/MSconfig.h"
22 #include <boost/python.hpp>
38 using namespace hippodraw;
43 const std::vector < std::string > & binding )
52 const std::vector< std::string > & binding,
53 QtDisplay * target,
double low,
double high )
66 const std::vector< std::string > & binding,
67 QtDisplay * target,
double low,
double high )
80 const std::string & label,
81 boost::python::numeric::array array,
88 vector < string > binding;
89 binding.push_back ( label );
96 std::runtime_error e (
"HippoDraw was not built with "
97 "numeric Python support" );
100 #endif // HAVE_NUMARRAY
105 const std::vector< std::string > & binding )
115 const std::vector< std::string > & binding )
128 assert ( cut_plotter != 0 );
142 controller -> addCut ( cp, target ->
display () );
152 unsigned int size = targets.size ();
154 for (
unsigned int i = 0;
i <
size;
i++ ) {
156 controller -> addCut ( cp, target ->
display () );
171 assert ( cut_plotter != 0 );
173 const Range range ( low, high );
175 cut_plotter -> setCutRangeAt ( range, type );
178 catch (
const std::out_of_range & ) {
180 string what (
"Cut range axis `" );
182 what +=
"' is invalid";
183 throw std::runtime_error ( what );
192 std::vector<double> myCutRange;
193 vector < const TupleCut * > cuts;
196 for (
unsigned int i = 0;
i < cuts.size();
i++ ) {
199 myCutRange.push_back ( range.
low () );
200 myCutRange.push_back ( range.
high () );
230 const std::vector < QtCut * > & cut_list,
236 std::vector < const TupleCut * > tuple_cut_list;
237 std::vector < QtCut * >::const_iterator
it = cut_list.begin();
240 for ( ; it !=cut_list.end(); ++
it )
257 createTnt (
const std::vector < std::string > & column_list,
258 const std::vector < QtCut * > & cut_list,
260 const std::string & filename,
261 const std::string & dsname )
266 std::vector < const TupleCut * > tuple_cut_list;
267 std::vector < QtCut * >::const_iterator
it = cut_list.begin();
270 for ( ; it !=cut_list.end(); ++
it )
288 createFits (
const std::vector < std::string > & column_list,
289 const std::vector < QtCut * > & cut_list,
291 const std::string & filename,
292 const std::string & dsname )
297 std::vector < const TupleCut * > tuple_cut_list;
298 std::vector < QtCut * >::const_iterator
it = cut_list.begin();
301 for ( ; it !=cut_list.end(); ++
it )
311 fc -> writeNTupleToFile(ds, filename, dsname, column_list, tuple_cut_list );
315 std::string what (
"Sorry, can not create FITS file. hippo module was not "
316 "built with optional FITS support" );
317 throw std::runtime_error ( what );
325 const std::vector < QtCut * > & cut_list )
327 std::vector < QtCut * >::const_iterator
it = cut_list.begin();
328 for ( ; it !=cut_list.end(); ++
it )
PyNTuple * createNTuple() const
Creates and returns an PyNTuple representing the display.
static FitsController * instance()
Returns the singleton instance of the FitsController.
double high() const
Returns the maximum of the range object.
Qt Displays wraps a derived class of Cut1DPlotter.
static CutController * instance()
Returns the pointer to the singleton instance.
hippodraw::QtCut class interface
int createNTupleToFile(const std::vector< std::string > &column_list, const std::vector< const TupleCut * > &cut_list, DataSource *ds, const std::string &filename, const std::string &dsname)
Create NTuple with column list and cut list and save to a file.
static void lock()
Obtains a lock on the application's mutex.
void setEnabled(bool yes)
Sets the enabled status.
DataSource * createNTuple(const std::string &filename)
Creates and registers an NTuple from data in file filename.
The class expresses a cut on a DataSource, i.e.
std::vector< double > cutRange()
Return the range of the cut.
A Color class for creating the color object following the standard RGB color space.
QtCut(const DataSource &nt, const std::vector< std::string > &binding)
Create a cut.
hippodraw::PyDataSource class interface
The base class for the PlotterBase hierarchy.
PyArray_TYPES type(numeric::array arr)
hippodraw::PyApp class interface.
void saveColumnFromNumArray(const std::string &label, boost::python::numeric::array array)
Replace or add a column from a numarray object, indexing by column label.
A PlotterBase derived class that serves a base class for cut plotters.
hippodraw::FitsController class interface.
A singleton class that is the interface between GUI and the NTuple objects.
PlotterBase * m_plotter
The contained PlotterBase object.
static void createFits(const std::vector< std::string > &column_list, const std::vector< QtCut * > &cut_list, DataSource *ds, const std::string &filename, const std::string &dsname)
Static method.
intp size(numeric::array arr)
static void fillCutList(std::vector< const TupleCut * > &tuple_cut_list, const std::vector< QtCut * > &cut_list)
void createCut(const DataSource &ds, const std::vector< std::string > &binding)
Creates an uninitialized cut.
This class is the public interface to a DataSource object that the user sees as the DataArray object ...
static NTupleController * instance()
Returns the pointer to the singleton instance.
PlotterBase * display()
Returns the wrapped display object.
A DataSource class implemented with std::vector<double> to store the column data. ...
hippodraw::TupleCut class interface
hippodraw::CutController class interface
Qt Displays wraps a derived class of PlotterBase.
A Controller class for FITS files.
void addTarget(QtDisplay *)
Adds a display as a target of the cut.
static void createTnt(const std::vector< std::string > &column_list, const std::vector< QtCut * > &cut_list, DataSource *ds, const std::string &filename, const std::string &dsname)
Static method.
static void unlock()
Releases the lock on the application's mutex.
const DataSource & dataSource() const
Return a reference to the underlying DataSource.
void setCutRange(double low, double high, const std::string &axis="x")
Sets the range of the cut on the chosen axis.
double low() const
Returns the minimum of the range object.
Expresses a range of values.
std::vector< double > getRange(const std::string &axis)
Get the Range of the specified axis.
hippodraw::NTupleController class interface
void toggleInverted()
Toggles the inversion status.
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
A singleton class that handles the application logic for cuts.
list< QAction * >::iterator it
void addTargets(const std::vector< QtDisplay * > &targets)
Adds the displays as targets of the cut.
Base class for DataSource.
hippodraw::CutPlotter class interface