PetaVision  Alpha
InitGauss2DWeights.hpp
1 /*
2  * InitGauss2DWeights.hpp
3  *
4  * Created on: Apr 8, 2013
5  * Author: garkenyon
6  */
7 
8 #ifndef INITGAUSS2DWEIGHTS_HPP_
9 #define INITGAUSS2DWEIGHTS_HPP_
10 
11 #include "InitWeights.hpp"
12 
13 namespace PV {
14 
16  protected:
22  virtual void ioParam_aspect(enum ParamsIOFlag ioFlag);
23  virtual void ioParam_sigma(enum ParamsIOFlag ioFlag);
24  virtual void ioParam_rMax(enum ParamsIOFlag ioFlag);
25  virtual void ioParam_rMin(enum ParamsIOFlag ioFlag);
26 
32  virtual void ioParam_numOrientationsPost(enum ParamsIOFlag ioFlag);
33 
39  virtual void ioParam_numOrientationsPre(enum ParamsIOFlag ioFlag);
40  virtual void ioParam_deltaThetaMax(enum ParamsIOFlag ioFlag);
41  virtual void ioParam_thetaMax(enum ParamsIOFlag ioFlag);
42  virtual void ioParam_numFlanks(enum ParamsIOFlag ioFlag);
43  virtual void ioParam_flankShift(enum ParamsIOFlag ioFlag);
44  virtual void ioParam_rotate(enum ParamsIOFlag ioFlag);
45  virtual void ioParam_bowtieFlag(enum ParamsIOFlag ioFlag);
46  virtual void ioParam_bowtieAngle(enum ParamsIOFlag ioFlag);
49  public:
50  InitGauss2DWeights(char const *name, HyPerCol *hc);
51  virtual ~InitGauss2DWeights();
52 
53  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
54 
55  protected:
57  int initialize(char const *name, HyPerCol *hc);
58 
59  virtual Response::Status
60  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
61 
62  void calcOtherParams(int patchIndex);
63 
64  virtual void calcWeights() override;
65 
66  virtual void calcWeights(int dataPatchIndex, int arborId) override;
67 
68  void calculateThetas(int kfPre_tmp, int patchIndex);
69  float calcThPost(int fPost);
70  bool checkThetaDiff(float thPost);
71  bool checkColorDiff(int fPost);
72  bool isSameLocAndSelf(float xDelta, float yDelta, int fPost);
73  bool checkBowtieAngle(float xp, float yp);
74 
75  private:
76  void gauss2DCalcWeights(float *dataStart);
77 
78  protected:
79  // params
80  float mAspect = 1.0f;
81  float mSigma = 0.8f;
82  float mRMax = 1.4f;
83  float mRMin = 0.0f;
84  float mStrength = 1.0f;
85  int mNumOrientationsPost = 1;
86  int mNumOrientationsPre = 1;
87  float mDeltaThetaMax = 2.0f * PI;
88  float mThetaMax = 1.0f;
89  int mNumFlanks = 1;
90  float mFlankShift = 0.0f;
91  float mRotate = 0.0f;
92  bool mBowtieFlag = false;
93  float mBowtieAngle = 2.0f * PI;
94 
95  // calculated values
96  float mRMaxSquared;
97  float mRMinSquared;
98  float mDeltaThetaPost;
99  float mTheta0Post;
100  float mThetaPre;
101  int mFeaturePre;
102  float mDeltaTheta;
103 
104 }; // class InitGauss2DWeights
105 
106 } /* namespace PV */
107 #endif /* INITGAUSS2DWEIGHTS_HPP_ */
virtual void calcWeights() override
virtual void ioParam_numOrientationsPost(enum ParamsIOFlag ioFlag)
virtual void ioParam_numOrientationsPre(enum ParamsIOFlag ioFlag)
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override