Skip to content

Commit

Permalink
update printing and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdfish committed Jan 17, 2021
1 parent abb77d1 commit 98c8048
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ACTRModels"
uuid = "c095b0ea-a6ca-5cbd-afed-dbab2e976880"
authors = ["itsdfish"]
version = "0.6.4"
version = "0.6.5"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
8 changes: 1 addition & 7 deletions src/MemoryFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ function add_noise!(actr, chunk)
@unpack τ,s = actr.parms
σ = s * pi / sqrt(3)
chunk.act_noise = rand(Normal(0, σ))
actr.parms.τ′ = rand(Normal(τ, σ))
return nothing
end

Expand Down Expand Up @@ -794,12 +793,7 @@ Modifies fields of NamedTupled
modify!(c; args...)
````
"""
function modify!(c; args...)
for (k,v) in args
setfield!(c, k, v)
end
return nothing
end

function modify!(c::NamedTuple; args...)
for (k,v) in args
c[k][1] = v
Expand Down
19 changes: 10 additions & 9 deletions src/Structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mutable struct Parms{T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11} <: AbstractParms
end

function Parms(;d=.5, τ=0.0, s=.3, γ=0.0, δ=0.0, blc=0.0, ter=0.0, mmpFun=defaultFun,
lf=1.0, τ′=zero(typeof(τ)), bll=false, mmp=false, sa=false, noise=false, args...)
lf=1.0, τ′=τ, bll=false, mmp=false, sa=false, noise=false, args...)
return Parms(d, τ, s, γ, δ, blc, ter, mmpFun, lf, τ′, bll, mmp, sa, noise , args.data)
end

Expand Down Expand Up @@ -321,13 +321,16 @@ abstract type AbstractACTR end
ACTR model object
- `declarative`: declarative memory module
- `imaginal`: imaginal memory module
- `visual`: visual module
- `goal`: goal module
- `visual_location`: visual location module
- `parms`: model parameters
- `scheduler`: event scheduler
- `scheduler`: event scheduler
Constructor
````julia
ACTR(;T=Parms, declarative=Declarative(), imaginal=Imaginal(),
scheduler=nothing, parms...)
ACTR(;declarative=Declarative(), imaginal=Imaginal(), goal = Goal(),
scheduler=nothing, visual=nothing, visual_location=nothing, parms...)
````
"""
mutable struct ACTR{T1,T2,T3,T4,T5,T6,T7} <: AbstractACTR
Expand All @@ -338,14 +341,12 @@ mutable struct ACTR{T1,T2,T3,T4,T5,T6,T7} <: AbstractACTR
goal::T5
parms::T6
scheduler::T7
time::Float64
end

Broadcast.broadcastable(x::ACTR) = Ref(x)

function ACTR(;declarative=Declarative(), imaginal=Imaginal(),
goal = Goal(), scheduler=nothing, visual=nothing, visual_location=nothing,
time = 0.0, parms...)
function ACTR(;declarative=Declarative(), imaginal=Imaginal(), goal = Goal(),
scheduler=nothing, visual=nothing, visual_location=nothing, parms...)
parms′ = Parms(;parms...)
ACTR(declarative, imaginal, visual, visual_location, goal, parms′, scheduler, time)
ACTR(declarative, imaginal, visual, visual_location, goal, parms′, scheduler)
end
7 changes: 4 additions & 3 deletions src/Utilities/Printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ print_memory(actr::AbstractACTR; fields=(:slots,:act_blc,:act_bll,:act_pm,:act_s
````
"""
function print_memory(actr::AbstractACTR; fields=(:slots,:act_blc,:act_bll,
:act_pm,:act_sa,:act_noise,:act))
return print_memory(actr.declarative; fields=fields)
:act_pm,:act_sa,:act_noise,:act), kwargs...)
memory = retrieval_request(actr; kwargs...)
return print_memory(memory; fields=fields)
end

"""
Expand Down Expand Up @@ -49,7 +50,7 @@ print_memory(chunks; fields=(:slots,:act_blc,:act_bll,:act_pm,:act_sa,:act_noise
````
"""
function print_memory(chunks; fields=(:slots,:act_blc,:act_bll,
:act_pm,:act_sa,:act_noise,:act))
:act_pm,:act_sa,:act_noise,:act), kwargs...)
df = DataFrame(chunks)
slots = map(x->x.slots, chunks)
df_slots = DataFrame()
Expand Down

0 comments on commit 98c8048

Please sign in to comment.