From 98c8048aeb04809b623d66a77338ba8c890bc372 Mon Sep 17 00:00:00 2001 From: itsdfish Date: Sun, 17 Jan 2021 14:44:52 -0500 Subject: [PATCH] update printing and docs --- Project.toml | 2 +- src/MemoryFunctions.jl | 8 +------- src/Structs.jl | 19 ++++++++++--------- src/Utilities/Printing.jl | 7 ++++--- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Project.toml b/Project.toml index 368c908..e8ce089 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/MemoryFunctions.jl b/src/MemoryFunctions.jl index 846cfee..644d4f3 100644 --- a/src/MemoryFunctions.jl +++ b/src/MemoryFunctions.jl @@ -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 @@ -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 diff --git a/src/Structs.jl b/src/Structs.jl index 67c8be9..58430e2 100644 --- a/src/Structs.jl +++ b/src/Structs.jl @@ -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 @@ -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 @@ -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 diff --git a/src/Utilities/Printing.jl b/src/Utilities/Printing.jl index dc17bf7..4a8e855 100644 --- a/src/Utilities/Printing.jl +++ b/src/Utilities/Printing.jl @@ -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 """ @@ -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()