示例#1
0
Neuron::Neuron(double Vm0, uint id)
        : DynamicalEntity(id), m_Vm0(Vm0)
{
        m_state.push_back(Vm0); // m_state[0] -> membrane potential
        setName("Neuron");
        setUnits("mV");
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapPolygonObject
    \brief The QGeoMapPolygonObject class is a QGeoMapObject used to draw
    a polygon on a map.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The polygon is specified by a set of at least 3 valid QGeoCoordinate
    instances listed in the same order in which the coordinates would be
    traversed when traveling around the border of the polygon.
*/

/*!
    Constructs a new polygon object.
*/
QGeoMapPolygonObject::QGeoMapPolygonObject()
    : d_ptr(new QGeoMapPolygonObjectPrivate())
{
    setUnits(QGeoMapObject::RelativeArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
示例#3
0
IzhikevichNeuron::IzhikevichNeuron(double a, double b, double c,
                     double d, double Vspk, double Iext,
                     uint id)
        : Neuron(c, id)
{
        m_state.push_back(b*VM);                  // m_state[1] -> u the membrane recovery variable
        IZH_A = a;
        IZH_B = b;
        IZH_C = c;
        IZH_D = d;
        IZH_VSPK = Vspk;
        IZH_IEXT = Iext;
        setName("IzhikevichNeuron");
        setUnits("mV");
        switch (lcg::integr_algo) {
                case EULER:
                        doStep = IzhiStepEuler;
                        break;
                case RK4:
                        doStep = IzhiStepRK4;
                        break;
                default:
                        doStep = IzhiStepEuler;
                        break;
        }
}
BioXASSSRLMonochromatorEnergyControl::BioXASSSRLMonochromatorEnergyControl(const QString &name, QObject *parent) :
	BioXASMonochromatorEnergyControl(name, parent)
{
	// Initialize inherited variables.

	value_ = 0;
	setpoint_ = 0;
	minimumValue_ = -1000000;
	maximumValue_ = 1000000;

	setAllowsMovesWhileMoving(false);
	setContextKnownDescription("Energy");
	setTolerance(0.05);

	// Initialize member variables.

	hc_ = 12398.42;
	crystal2D_ = 3.8403117;
	thetaBraggOffset_ = 180.0;
	regionOffset_ = 180;

	bragg_ = 0;
	region_ = 0;
	m1MirrorPitch_ = 0;

	// Current settings.

	setDisplayPrecision(3);
	setUnits("eV");
	updateStates();
}
示例#5
0
void AMPVwStatusControl::onReadPVInitialized()
{
	// Same as read only PV control's except we don't get grab the limits from here.
	setUnits(readPV_->units());	// copy over the new unit string
	setEnumStates(readPV_->enumStrings());
	setDisplayPrecision(readPV_->displayPrecision());
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapRouteObject
    \brief The QGeoMapRouteObject class is a QGeoMapObject used to draw
    a route on a map.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The route is specified by a QGeoRoute object.

    The route might be quite detailed, and so to improve performance the
    detail level can be set with QGeoMapRouteObject::detailLevel.

    The route object draws the route as a series of lines with a minimum
    on-screen harmattan length equal to the detail level.  This is done so that
    the small changes in direction of a road will be visible at high zoom
    levels but will not slow down the rendering at the lower zoom levels.
*/

/*!
    Constructs a new route object.
*/
QGeoMapRouteObject::QGeoMapRouteObject()
    : d_ptr(new QGeoMapRouteObjectPrivate())
{
    setUnits(QGeoMapObject::AbsoluteArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
/*!
    Constructs a new route object for the route \a route.
*/
QGeoMapRouteObject::QGeoMapRouteObject(const QGeoRoute &route)
    : d_ptr(new QGeoMapRouteObjectPrivate())
{
    d_ptr->route = route;
    setUnits(QGeoMapObject::AbsoluteArcSecondUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
QTM_BEGIN_NAMESPACE

/*!
    \class QGeoMapCircleObject
    \brief The QGeoMapCircleObject class is a QGeoMapObject used to draw the region
    within a given distance of a coordinate.

    \inmodule QtLocation
    \since 1.1

    \ingroup maps-mapping-objects

    The circle is specified by either a valid QGeoBoundingCircle instance or a
    valid QGeoCoordinate instance and a qreal with value greater than 0.0,
    which represent the center of the circle and the radius of the circle in
    metres respectively.

    The circle may appear as an ellipse on maps which use the Mercator
    projection. This is done so that the circle accurately covers all points at
    a distance of the radius or less from the center.
*/

/*!
    Constructs a new circle object.
*/
QGeoMapCircleObject::QGeoMapCircleObject()
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
/*!
    Constructs a new circle object based on the circle \a circle.
    \since 1.1
*/
QGeoMapCircleObject::QGeoMapCircleObject(const QGeoBoundingCircle &circle)
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    d_ptr->circle = circle;
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
}
示例#10
0
void QgsComposerScaleBar::applyDefaultSize()
{
  if ( mComposerMap )
  {
    setUnits( Meters );
    double widthMeter = mapWidth();
    int nUnitsPerSegment =  widthMeter / 10.0; //default scalebar width equals half the map width
    setNumUnitsPerSegment( nUnitsPerSegment );

    if ( nUnitsPerSegment > 1000 )
    {
      setNumUnitsPerSegment(( int )( numUnitsPerSegment() / 1000.0 + 0.5 ) * 1000 );
      setUnitLabeling( tr( "km" ) );
      setNumMapUnitsPerScaleBarUnit( 1000 );
    }
    else
    {
      setUnitLabeling( tr( "m" ) );
    }

    setNumSegments( 4 );
    setNumSegmentsLeft( 2 );
  }

  refreshSegmentMillimeters();
  adjustBoxSize();
  emit itemChanged();
}
示例#11
0
Constant::Constant(double value, const std::string& units, uint id)
        : Entity(id)
{
        m_parameters["value"] = value;
        setName("Constant");
        setUnits(units);
}
示例#12
0
ConductanceBasedNeuron::ConductanceBasedNeuron(double C, double gl, double El, double Iext,
                                               double area, double spikeThreshold, double V0,
                                               uint id)
        : Neuron(V0, id)
{
        m_state.push_back(V0);                  // m_state[1] -> previous membrane voltage (for spike detection)

        CBN_C = C;
        CBN_GL = gl;
        CBN_EL = El;
        CBN_IEXT = Iext;
        CBN_AREA = area;
        CBN_SPIKE_THRESH = spikeThreshold;
        CBN_GL_NS = gl*10*area; // leak conductance in nS
        CBN_COEFF = GetGlobalDt() / (C*1e-5*area); // coefficient

        setName("ConductanceBasedNeuron");
        setUnits("mV");

        switch (lcg::integr_algo) {
                case EULER:
                        doStep = CBNStepEuler;
                        break;
                case RK4:
                        // FIX!!!
                        doStep = CBNStepEuler;
                        break;
                default:
                        doStep = CBNStepEuler;
                        break;
        }
}
/*!
    Constructs a new circle object with a center at coordinate \a center
    and a radius in meters of \a radius.
    \since 1.1
*/
QGeoMapCircleObject::QGeoMapCircleObject(const QGeoCoordinate &center, qreal radius)
    : d_ptr(new QGeoMapCircleObjectPrivate())
{
    d_ptr->circle = QGeoBoundingCircle(center, radius);
    setUnits(QGeoMapObject::MeterUnit);
    setTransformType(QGeoMapObject::ExactTransform);
    setOrigin(center);
}
QWidget *QgsProcessingDistanceWidgetWrapper::createWidget()
{
  const QgsProcessingParameterDistance *distanceDef = static_cast< const QgsProcessingParameterDistance * >( parameterDefinition() );

  QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
  switch ( type() )
  {
    case QgsProcessingGui::Standard:
    {
      mLabel = new QLabel();
      mUnitsCombo = new QComboBox();

      mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMeters ), QgsUnitTypes::DistanceMeters );
      mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceKilometers ), QgsUnitTypes::DistanceKilometers );
      mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceFeet ), QgsUnitTypes::DistanceFeet );
      mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMiles ), QgsUnitTypes::DistanceMiles );
      mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceYards ), QgsUnitTypes::DistanceYards );

      const int labelMargin = static_cast< int >( std::round( mUnitsCombo->fontMetrics().width( 'X' ) ) );
      QHBoxLayout *layout = new QHBoxLayout();
      layout->addWidget( spin, 1 );
      layout->insertSpacing( 1, labelMargin / 2 );
      layout->insertWidget( 2, mLabel );
      layout->insertWidget( 3, mUnitsCombo );

      // bit of fiddlyness here -- we want the initial spacing to only be visible
      // when the warning label is shown, so it's embedded inside mWarningLabel
      // instead of outside it
      mWarningLabel = new QWidget();
      QHBoxLayout *warningLayout = new QHBoxLayout();
      warningLayout->setMargin( 0 );
      warningLayout->setContentsMargins( 0, 0, 0, 0 );
      QLabel *warning = new QLabel();
      QIcon icon = QgsApplication::getThemeIcon( QStringLiteral( "mIconWarning.svg" ) );
      const int size = static_cast< int >( std::max( 24.0, spin->minimumSize().height() * 0.5 ) );
      warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
      warning->setToolTip( tr( "Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) );
      warningLayout->insertSpacing( 0, labelMargin / 2 );
      warningLayout->insertWidget( 1, warning );
      mWarningLabel->setLayout( warningLayout );
      layout->insertWidget( 4, mWarningLabel );

      setUnits( distanceDef->defaultUnit() );

      QWidget *w = new QWidget();
      layout->setMargin( 0 );
      layout->setContentsMargins( 0, 0, 0, 0 );
      w->setLayout( layout );
      return w;
    }

    case QgsProcessingGui::Batch:
    case QgsProcessingGui::Modeler:
      return spin;

  }
  return nullptr;
}
示例#15
0
文件: Page.cpp 项目: J05huaUCR/sMHDL
/*	==========================================================================
	DESC
	
	@param 	null		nothing
	@return 	null		nothing
	========================================================================== */
void Page::init() {
	setID(DEFAULT_PAGE_NAME);
	PageSubstrate = NULL;
	MarginTop = 0.0;
	MarginBottom = 0.0;
	MarginLeft = 0.0; 
	MarginRight = 0.0;
	setUnits(in);
}
示例#16
0
AMOldDetectorInfo& AMOldDetectorInfo::operator =(const AMOldDetectorInfo &other)
{
	if(this != &other){
		AMDbObject::operator =(other);
		description_ = other.description();
		setUnits(other.units());
	}
	return *this;
}
示例#17
0
StateMachine::StateMachine() {
	currentState = States::KM_MI;
	setUnits( false );
	count = 0;
	autoMode = true;
	// create thread
	pthread_create(&thread, NULL, &thread_worker_sm, (void*)this);

}
示例#18
0
void Parameter::setup(const ConstantString & name)
{
  setName(name);
  setUnits(constants::empty_constant_string);
  type_ = JsonStream::LONG_TYPE;
  array_element_type_ = JsonStream::LONG_TYPE;
  range_is_set_ = false;
  array_length_range_is_set_ = false;
  subset_is_set_ = false;
}
示例#19
0
DPAngVelPlot::DPAngVelPlot(int type, int system, bool hasgrid, std::string title, int plottype, int units, double linethickness)
    : DPPlotSettings(type, system, hasgrid, title)
{
    PROGRAMCOLORS = Colors();
    setAngVelPlotType(plottype);
    setUnits(units);
    setLineThickness(linethickness);
    this->colors.push_back(PROGRAMCOLORS.colorlist[DEEPORANGE]);

}
FrequencyEstimator::FrequencyEstimator(double tau, double initialFrequency, uint id)
    : Entity(id)
{
    if (tau <= 0)
        throw "Tau must be positive";
    m_parameters["tau"] = tau;
    m_parameters["f0"] = initialFrequency;
    setName("FrequencyEstimator");
    setUnits("Hz");
}
示例#21
0
DPAnglePlot::DPAnglePlot(int type, int system, bool hasgrid, std::string title, int plottype, double units, bool normalized, double linethickness)
    :DPPlotSettings(type, system, hasgrid, title)
{
    PROGRAMCOLORS = Colors();
    setAnglePlotType(plottype);
    setUnits(units);
    setNormalized(normalized);
    this->setLineThickness(linethickness);

    this->colors.push_back(PROGRAMCOLORS.colorlist[DEEPORANGE]); // set the default line color to deep orange
}
示例#22
0
void AMReadOnlyPVControl::onReadPVInitialized() {
	setUnits(readPV_->units());	// copy over the new unit string
	setEnumStates(readPV_->enumStrings());
	setDisplayPrecision(readPV_->displayPrecision());

	if (allowLowLimitValuePVUpdates_)
		setLowLimitValue(readPV_->lowerGraphicalLimit());

	if (allowHighLimitValuePVUpdates_)
		setHighLimitValue(readPV_->upperGraphicalLimit());
}
PlanarSurfaceWidget::PlanarSurfaceWidget(bool isIP, QWidget * parent )
  : QWidget(parent)
{
  this->setObjectName("GrayWidget");

  setUnits(isIP);

  auto layout = new QGridLayout();
  layout->setContentsMargins(7,7,7,7);
  layout->setSpacing(7);
  this->setLayout(layout);
}
示例#24
0
//-----------------------------------------------------------------------------
// key typed
void SeaOfMemes::appKeyChar(
  int keyCode,
  int modifiers)
{
  // if UI open, give it character
  if (m_helpUI != NULL && m_helpUI->hasKeyFocus())
  {
    m_helpUI->getTop()->surfaceKeyChar(keyCode, modifiers);
    return;
  }

  switch (keyCode)
  {
    case 'L':
      setLandingMode(!m_landingMode);
      break;

    case 'K':
      setUnits(!m_unitsMetric);
      break;

    case '=': 
    case '+':
    {
      m_avatarSpeed = m_avatarSpeed * 2.0;
      m_avatarSpeed = min(MAX_AVATAR_SPEED, m_avatarSpeed);
      if (m_speedUI != NULL)
        m_speedUI->setSpeed(m_avatarSpeed);
/*
      if (m_landingMode)
        m_avatarSpeed = min(MAX_LAND_SPEED, m_avatarSpeed);
      else m_avatarSpeed = min(MAX_SPACE_SPEED, m_avatarSpeed);
      showSpeed();
*/
      break;
    }
      
    case '-':
    {
      m_avatarSpeed = m_avatarSpeed / 2.0;
      m_avatarSpeed = max(MIN_AVATAR_SPEED, m_avatarSpeed);
      if (m_speedUI != NULL)
        m_speedUI->setSpeed(m_avatarSpeed);
/*
      if (m_landingMode)
        m_avatarSpeed = max(MIN_LAND_SPEED, m_avatarSpeed);
      else m_avatarSpeed = max(MIN_SPACE_SPEED, m_avatarSpeed);
      showSpeed();
*/
      break;
    }
  }
}
示例#25
0
DigitalInput::DigitalInput(const char *deviceFile, uint inputSubdevice,
                         uint readChannel, const std::string& units,
                         EventType eventToSend, uint id)
        : Entity(id),
#if defined(HAVE_LIBCOMEDI)
	m_input(deviceFile, inputSubdevice, readChannel),
#endif
	m_eventToSend(eventToSend)
{
        setName("DigitalInput");
        setUnits(units);
		m_previous = 0;
}
示例#26
0
ALSBL8XESDetectorInfo::ALSBL8XESDetectorInfo(QObject *parent) :
	AMOldDetectorInfo("xes", "XES Image Detector", parent)
{
	centerEnergy_ = (0.0);
	gratingNumber_ = (1);
	detectorAngle_ = (0.0);
	positionX_ = (0.0);
	positionY_ = (0.0);
	positionA_ = (0.0);
	slitWidth_ = (0.0);

	targetCounts_ = (10000);
	targetExposureSeconds_ = (180);

	gratingCount_ = (4);
	anodeWidthMm_ = (40);
	gratingNames_ << "Grating 1" << "Grating 2" << "Grating 3" << "Grating 4";
	slitPositionX_ = (1138.161);
	slitPositionY_ = (180.420);

	gratingGrooveDensities_ << 600.0 << 1500.0 << 1000.0 << 1500.0;
	gratingRadii_ << 4999.05 << 5000.2 << 10000.33 << 10000.0;
	gratingPositionsX_ << 801.567 << 801.637 << 801.608 << 801.608;
	gratingPositionsY_ << 102.767 << 102.718 << 102.505 << 102.336;
	zeroOrderRayAngles_ << -10.0815 << -10.2915 << -14.0385 << -14.0385;

	gratingCorrectionsDX_ << 0 << 0 << 0 << 6.55034;
	gratingCorrectionsDY_ << 0 << 0 << 0 << 3.62933;
	gratingCorrectionsDA_ << 0 << 0 << 0 << -0.0100719;
	gratingCorrectionsGrooveDensity_ << 0 << 0 << 0 << 27.1196;
	gratingCorrectionsRadii_ << 0 << 0 << 0 << -65.4955;

	slitCorrectionsDX_ << 0 << 0 << 0 << -1.97679;
	slitCorrectionsDY_ << 0 << 0 << 0 << 2.79737;

	axes_ << AMAxisInfo("xesImage_x", 1024, "XES Detector eV Axis", "pixels");
	axes_ << AMAxisInfo("xesImage_y", 32, "XES Detector vertical axis", "pixels");
	axes_[0].isUniform = true;
	axes_[0].increment = 1;
	axes_[0].start = 0;
	axes_[1].isUniform = true;
	axes_[1].increment = 1;
	axes_[1].start = 0;

	setUnits("counts");

}
ProbabilityEstimator::ProbabilityEstimator(double tau, double stimulationFrequency, double window, double initialProbability, uint id)
        : Entity(id)
{
        if (tau <= 0)
                throw "Tau must be positive";
        if (stimulationFrequency <= 0)
                throw "The stimulation frequency must be positive";
        if (window <= 0)
                throw "The window for spike detection must be positive";
        PE_TAU = tau;
        PE_P0 = initialProbability;
        PE_F = stimulationFrequency;
        PE_T = 1./stimulationFrequency;
        PE_WNDW = window;
        setName("ProbabilityEstimator");
        setUnits("1");
}
示例#28
0
/// ========================= implementation of AMPVwStatusAndUnitConversionControl =================
AMPVwStatusAndUnitConversionControl::AMPVwStatusAndUnitConversionControl(const QString &name, const QString &readPVname, const QString &writePVname, const QString &movingPVname, const QString &stopPVname, AMAbstractUnitConverter *readUnitConverter, AMAbstractUnitConverter *writeUnitConverter, QObject *parent, double tolerance, double moveStartTimeoutSeconds, AMAbstractControlStatusChecker *statusChecker, int stopValue, const QString &description) :
	AMPVwStatusControl(name, readPVname, writePVname, movingPVname, stopPVname, parent, tolerance, moveStartTimeoutSeconds, statusChecker, stopValue, description)
{
	readConverter_ = readUnitConverter;
	writeConverter_ = writeUnitConverter;

	disconnect(readPV_, SIGNAL(valueChanged(double)), this, SIGNAL(valueChanged(double)));
	connect(readPV_, SIGNAL(valueChanged(double)), this, SLOT(onReadPVValueChanged(double)));

	disconnect(writePV_, SIGNAL(valueChanged(double)), this, SIGNAL(setpointChanged(double)));
	connect(writePV_, SIGNAL(valueChanged(double)), this, SLOT(onWritePVValueChanged(double)));

	disconnect(readPV_, SIGNAL(initialized()), this, SLOT(onReadPVInitialized()));	// don't allow AMReadOnlyPV to change our units or enum names.

	setUnits(readConverter_->units());

}
示例#29
0
RealNeuron::RealNeuron(double spikeThreshold, double V0,
                       const char *deviceFile,
                       uint inputSubdevice, uint outputSubdevice,
                       uint readChannel, uint writeChannel,
                       double inputConversionFactor, double outputConversionFactor,
                       uint inputRange, uint reference, const char *kernelFile,
                       bool holdLastValue, const std::string& holdLastValueFilename,
		       bool adaptiveThreshold, uint id)
        : Neuron(V0, id), m_aec(kernelFile),
          m_input(deviceFile, inputSubdevice, readChannel, inputConversionFactor, inputRange, reference),
          m_output(deviceFile, outputSubdevice, writeChannel, outputConversionFactor, reference),
          m_holdLastValue(holdLastValue),m_holdLastValueFilename(holdLastValueFilename),
	  m_adaptiveThreshold(adaptiveThreshold)
{
        m_state.push_back(V0);        // m_state[1] -> previous membrane voltage (for spike detection)
        RN_SPIKE_THRESH = spikeThreshold;
        setName("RealNeuron");
        setUnits("mV");
}
void KLFUnitChooser::setUnits(const QString& unitstr)
{
  QStringList unitstrlist = unitstr.split(';');
  QList<Unit> units;
  int k;
  for (k = 0; k < unitstrlist.size(); ++k) {
    QStringList parts = unitstrlist[k].split('=');
    if (parts.size() != 3) {
      qWarning()<<KLF_FUNC_NAME<<": Invalid unit specification: "<<unitstrlist[k];
      continue;
    }
    Unit u;
    u.name = parts[0];
    u.abbrev = parts[1];
    u.factor = parts[2].toDouble();
    units << u;
  }
  setUnits(units);
}