Skip to content

Commit

Permalink
replace Fm -> From
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Apr 10, 2024
1 parent ed0685c commit 15a5cd7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions chem/conc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func CoToN(co, vol float64) float64 {
return co * vol
}

// CoFmN returns concentration from N, for given volume: co / vol
func CoFmN(n, vol float64) float64 {
// CoFromN returns concentration from N, for given volume: co / vol
func CoFromN(n, vol float64) float64 {
return n / vol
}
2 changes: 1 addition & 1 deletion chem/enz.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (rt *Enz) Update() {
// occurring in forward component (s * e), vs just 1 in back
func (rt *Enz) SetKmVol(km, vol, k2, k3 float64) {
k1 := (k2 + k3) / km
rt.K1 = CoFmN(k1, vol)
rt.K1 = CoFromN(k1, vol)
rt.K2 = k2
rt.K3 = k3
rt.Update()
Expand Down
2 changes: 1 addition & 1 deletion chem/enzrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (rt *EnzRate) Update() {
// occurring in forward component (s * e), vs just 1 in back
func (rt *EnzRate) SetKmVol(km, vol, k2, k3 float64) {
k1 := (k2 + k3) / km
rt.K1 = CoFmN(k1, vol)
rt.K1 = CoFromN(k1, vol)
rt.K2 = k2
rt.K3 = k3
rt.Update()
Expand Down
2 changes: 1 addition & 1 deletion chem/react.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type React struct {
// dividing forward Kf by volume to compensate for 2 volume-based concentrations
// occurring in forward component, vs just 1 in back
func (rt *React) SetVol(f, vol, b float64) {
rt.Kf = CoFmN(f, vol)
rt.Kf = CoFromN(f, vol)
rt.Kb = b
}

Expand Down
4 changes: 2 additions & 2 deletions chem/senz.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type SimpleEnz struct {
// dividing forward Kf by volume to compensate for 2 volume-based concentrations
// occurring in forward component, vs just 1 in back
func (rt *SimpleEnz) SetVol(f, vol float64) {
rt.Kf = CoFmN(f, vol)
rt.Kf = CoFromN(f, vol)
}

// Step computes delta S and P values based on current S, E values
Expand All @@ -37,7 +37,7 @@ func (rt *SimpleEnz) Step(cs, ce float64, ds, dp *float64) {
// StepCo computes delta S and P values based on current S, E values
// based on concentration
func (rt *SimpleEnz) StepCo(cs, ce, vol float64, ds, dp *float64) {
df := rt.Kf * CoFmN(cs, vol) * CoFmN(ce, vol) // forward
df := rt.Kf * CoFromN(cs, vol) * CoFromN(ce, vol) // forward
*ds -= df
*dp += df
}
Expand Down
6 changes: 3 additions & 3 deletions egui/plots.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (gui *GUI) AddPlots(title string, lg *elog.Logs) {

plt := gui.NewPlotTab(key, mode+" "+time+" Plot")
plt.SetTable(lt.Table)
plt.Params.FmMetaMap(lt.Meta)
plt.Params.FromMetaMap(lt.Meta)

ConfigPlotFromLog(title, plt, lg, key)
}
Expand Down Expand Up @@ -67,8 +67,8 @@ func ConfigPlotFromLog(title string, plt *eplot.Plot2D, lg *elog.Logs, key etime
plt.Params.LegendCol = legend
}
}
plt.ColsFmMetaMap(lt.Table.MetaData)
plt.ColsFmMetaMap(lt.Meta)
plt.ColsFromMetaMap(lt.Table.MetaData)
plt.ColsFromMetaMap(lt.Meta)
plt.Update()
}

Expand Down
12 changes: 6 additions & 6 deletions evec/vec2i.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ func NewVec2iScalar(s int) Vec2i {
return Vec2i{X: s, Y: s}
}

// NewVec2iFmVec2Round converts from floating point mat32.Vec2 vector to int, using rounding
func NewVec2iFmVec2Round(v mat32.Vec2) Vec2i {
// NewVec2iFromVec2Round converts from floating point mat32.Vec2 vector to int, using rounding
func NewVec2iFromVec2Round(v mat32.Vec2) Vec2i {
return Vec2i{int(mat32.Round(v.X)), int(mat32.Round(v.Y))}
}

// NewVec2iFmVec2Floor converts from floating point mat32.Vec2 vector to int, using floor
func NewVec2iFmVec2Floor(v mat32.Vec2) Vec2i {
// NewVec2iFromVec2Floor converts from floating point mat32.Vec2 vector to int, using floor
func NewVec2iFromVec2Floor(v mat32.Vec2) Vec2i {
return Vec2i{int(mat32.Floor(v.X)), int(mat32.Floor(v.Y))}
}

// NewVec2iFmVec2Ceil converts from floating point mat32.Vec2 vector to int, using ceil
func NewVec2iFmVec2Ceil(v mat32.Vec2) Vec2i {
// NewVec2iFromVec2Ceil converts from floating point mat32.Vec2 vector to int, using ceil
func NewVec2iFromVec2Ceil(v mat32.Vec2) Vec2i {
return Vec2i{X: int(mat32.Ceil(v.X)), Y: int(mat32.Ceil(v.Y))}
}

Expand Down
8 changes: 4 additions & 4 deletions patgen/configvocab.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func PctActInTensor(trow *etensor.Float32) float32 {
return float32(NOnInTensor(trow)) / float32(trow.Len())
}

// NFmPct returns the number of bits for given pct (proportion 0-1),
// NFromPct returns the number of bits for given pct (proportion 0-1),
// relative to total n. uses math.Round.
func NFmPct(pct float32, n int) int {
func NFromPct(pct float32, n int) int {
return int(math.Round(float64(n) * float64(pct)))
}

Expand All @@ -71,8 +71,8 @@ func AddVocabEmpty(mp Vocab, name string, rows, poolY, poolX int) (*etensor.Floa
// will be returned and printed if it cannot be satisfied in a reasonable
// amount of time.
func AddVocabPermutedBinary(mp Vocab, name string, rows, poolY, poolX int, pctAct, minPctDiff float32) (*etensor.Float32, error) {
nOn := NFmPct(pctAct, poolY*poolX)
minDiff := NFmPct(minPctDiff, nOn)
nOn := NFromPct(pctAct, poolY*poolX)
minDiff := NFromPct(minPctDiff, nOn)
tsr := etensor.NewFloat32([]int{rows, poolY, poolX}, nil, []string{"row", "Y", "X"})
err := PermutedBinaryMinDiff(tsr, nOn, 1, 0, minDiff)
mp[name] = tsr
Expand Down
2 changes: 1 addition & 1 deletion weights/cpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NetReadCpp(r io.Reader) (*Network, error) {
if err != nil {
errlist = append(errlist, err)
}
fm := strings.TrimPrefix(css[1], "Fm:")
fm := strings.TrimPrefix(css[1], "From:")
if len(lw.Prjns) < pi+1 {
lw.Prjns = append(lw.Prjns, Prjn{From: fm})
}
Expand Down

0 comments on commit 15a5cd7

Please sign in to comment.