#] #] ********************* #] loaddefs link d_QNial_mine 'MindCode/code develop/fire develop.ndf' www.BillHowell.ca 27Mar2020 : 14Mar2020 initial 'fire tests.ndf' moved here /home/bill/PROJECTS/Qnial/MY_NDFS/MindCode/code develop/fire develop.txt *********** 03Apr2020 problem with fireL - it accumulates with each run!!??!! Seems like fireL is loaded multiple times? NYET - it's fireStdL that is the problem! OK - the problem was obscure (????), but works. *********** 03Apr2020 Old code IDres := EACH nmID_to_ID (name EACHBOTH pair IDsub) ; % (eg nmID_to_ID "intg00_str 0) ; write 'IDres=' IDres ; # EACH intg_to_spikes 0 23 55 40 3 -126 oooooooo ooololll oollolll oololooo ooooooll lllllllo EACH intg_to_spikes 0 23 95 -83 oooooooo ooololll ololllll llolooll EACH real_to_spikes 0 7 126.2 2965.7 -5.76 -2965.7 oooooooo ooollloo oolloool olllollo loololoo llllollo EACH real_to_spikes 0 133.2 2959.94 -5.76 oooooooo oollolol olllollo loololoo # Old version fire_test01 IS { LOCAL i n_rows n_cols table titles OKRes ID inr trgrPat histPat Twait name IDsub IDstd histPatDat fireStd IDres fireRes ; NONLOCAL cycle_max fireL histPatL IDL inL nowFireL sensIDL trgrPatL TwaitL ; % ; cycle_max := 1 ; % ; % input test data ; 'IDres' 'fireRes' 'nowFireRes' EACHLEFT assign null ; table := 'name' 'IDsub' 'IDstd' 'histPatDat' 'fireStd' "intg00_str 0 6 (sol 0) (intg_to_spikes 0) "intg00_str 1 7 (sol (1 2)) (intg_to_spikes 1) "intg00_str 2 8 (sol (2 3)) (intg_to_spikes 78) "intg00_str 3 9 (sol (3 4 5)) (intg_to_spikes 178) "intg00_mot 0 10 6 0 "intg00_mot 1 11 7 1 "intg00_mot 2 12 8 78 "intg00_mot 3 13 9 178 "real00_str 0 20 (sol 14) (real_to_spikes 0. ) "real00_str 1 21 (sol (15 16)) (real_to_spikes 1. ) "real00_str 2 22 (sol (17 18)) (real_to_spikes 126.2 ) "real00_str 3 23 (sol (17 18 19)) (real_to_spikes 2965.7 ) "real00_mot 0 24 20 0. "real00_mot 1 25 21 1. "real00_mot 2 26 22 126.2 "real00_mot 3 27 23 2965.7 ; n_cols := 5 ; n_rows := floor ((gage shape table) / n_cols) ; table := n_rows n_cols reshape table ; titles := table|[0,] ; titles EACHBOTH assign (cols table|[count (n_rows - 1),]) ; % ; % pre-load histPatDat into histPatL, this minimises [screen output, cycle_max] to see effects (eg one_step) ; % as loaddefs of MindCode re-initialises all data, that is the safest way to avoid "reminant data" ; IDres := EACH nmID_to_ID (name EACHBOTH pair IDsub) ; % (eg nmID_to_ID "intg00_str 0) ; write 'IDres=' IDres ; FOR i WITH (tell (n_rows - 1)) DO IF (= null histPatDat@i) THEN histPatL@(IDres@i) := solitary null ; ELSE histPatL@(IDres@i) := histPatDat@i ; ENDIF ; ENDFOR ; % ; % calculations, final results ; MindCode_cycle ; ID := IDL#IDres ; inr := inL#IDres ; trgrPat := trgrPatL#IDres ; histPat := histPatL#IDres ; Twait := TwaitL#IDres ; fireRes := fireL#IDres ; OKres := fireStd EACHBOTH = fireRes ; write EACH (gage shape) ID IDres name IDsub IDstd inr trgrPat histPatDat histPat Twait fireStd fireRes OKRes ; % ; % write test results ; write '' ; write 'fire_test01 : ' ; titles := 'ID' 'IDres' 'name' 'IDsub' 'IDstd' 'inr' 'trgrPat' 'histPatDat' 'histPat' 'Twait' 'fireStd' 'fireRes' 'OKRes' ; write transpose mix ((EACH solitary titles) EACHBOTH link (EACH execute titles)) ; write '' ; } # old code FOR i WITH (gage shape IDres) DO histPatL@(IDres@i) := histPatDat@i ENDFOR ; histPatL@netID := link (solitary null) (front histPatL@netID) ; write 'uncomment last output in fire_test01 to see name IDsub IDstd IDres fireStd fireRes OKRes' ; # # None will fire? apply trgrTypL@6 (trgrPatL@6 histPatL@6 ) apply trgrTypL@7 (trgrPatL@7 histPatL@7 ) apply trgrTypL@8 (trgrPatL@8 histPatL@8 ) apply trgrTypL@9 (trgrPatL@9 histPatL@9 ) apply trgrTypL@20 (trgrPatL@20 histPatL@20) apply trgrTypL@21 (trgrPatL@21 histPatL@21) apply trgrTypL@22 (trgrPatL@22 histPatL@22) apply trgrTypL@23 (trgrPatL@23 histPatL@23) spikes_to_intg EACHRIGHT apply (EACH first fires) # old code IF (apply trgrTypL@netID (trgrPatL@netID histPatL@netID)) THEN fires := fireL#(inL@netID) ; IF (= 'bool' typeL@netID) THEN fireL@netID := opL@netID EACHRIGHT apply fires ; nowFireL := link nowFireL netID ; ELSEIF (= 'intg' typeL@netID) THEN fireL@netID := intg_to_spikes ( opL@netID EACHRIGHT apply (spikes_to_intg EACHRIGHT apply fires) ) ; nowFireL := link nowFireL netID ; ELSEIF (= 'real' typeL@netID) THEN fireL@netID := real_to_spikes ( opL@netID EACHRIGHT apply (spikes_to_real EACHRIGHT apply fires) ) ; nowFireL := link nowFireL netID ; ELSE write fault '?E_base01' ; ENDIF ; ENDIF ; *********** 27Mar2020 old code fire_test IS { NONLOCAL flag_cycle_output flag_stop_output ; flag_cycle_output := l ; net_start link d_QNial_mine 'MindCode/code develop_test/MindCode [arith, trig] tests.ndf' ; net_cycle ; net_stop ; } # old code : t_cols := 8 ; t_rows := floor ((gage shape test_matrix) / t_cols) ; test_matrix := t_rows t_cols reshape test_matrix ; titles := test_matrix|[0,] ; test_matrix := test_matrix|[1 + tell (t_rows - 1), tell t_cols] ; tstNum := test_matrix|[,0] ; trigPat := test_matrix|[,1] ; histPat := test_matrix|[,2] ; nowStd := test_matrix|[,3] ; cumStd := test_matrix|[,4] ; seqStd := test_matrix|[,5] ; timStd := test_matrix|[,6] ; comment := test_matrix|[,7] ; nowRes := trigPat EACHBOTH nowTrig histPat ; cumRes := trigPat EACHBOTH cumTrig histPat ; seqRes := trigPat EACHBOTH seqTrig histPat ; timRes := trigPat EACHBOTH timTrig histPat ; nulCol := (t_rows - 1) reshape ' ' ; lenOK := (EACH (gage shape) trigPat) EACHBOTH <= (EACH (gage shape) histPat) ; OKRes := (AND (EACHBOTH = nowStd nowRes) (EACHBOTH = cumStd cumRes) (EACHBOTH = seqStd seqRes) (EACHBOTH = timStd timRes) ) ; write 'tst' 'trigPat..' 'histPat..........' 'now......' 'cum......' 'seq......' 'tim......' 'OK' 'OK?' ; titleRow := 'tst' 'trigPat' 'histPat' 'Std' 'Res' '' 'Std' 'Res' '' 'Std' 'Res' '' 'Std' 'Res' '' 'OK' 'OK?' 'comment' ; table_write titleRow (tstNum trigPat histPat nowStd nowRes nulCol cumStd cumRes nulCol seqStd seqRes nulCol timStd timRes nulCol lenOK OKRes comment) ; notes := '' 'Comments expanded : ' ' n/c = no commm' ' OKsol = OK use of sol' ' err: nullInList = err: null in sub-list ' ' err: shape = NOT >= EACH (gage shape) trigPat histPat)' ' redundantSol = redundant use of sol trigPat' '' '+-----+' 'Quick [note, warning]s : ' '13Mar2020 [now, cum, seq, tim, mix]Trig are probably incorrect in some cases - future work needed' '(gage shape trigPatL@netID) MUST be <= (gage shape histPatL@netID)!! ' ' i.e. histPatL@netID should be a list! ' ' use (sol 0 1 2 6) and NOT (sol (0 1 2 6))!' ' use (n 3) and NOT (sol n 3) (nulls are handled carefully) ' ' use ((0 1 2 6) 9 10 11) and NOT ((sol 0 1 2 6) 9 10 11)' 'avoid "double-nesting" - which implies nested time-steps : ' ' some nulls give appearance of doub-nesting, but are OK' 'Test for special treament of [null, atom]s?' ' nulls - are REQUIRED to keep time-steps when there is no spiking activity' ' nulls must NOT appear in sub-lists!!' ' atoms (single integer) - dont match a list, so use (sol 6), not 6' 'simple list : trigPat histPat' ' nowTrig separate tSteps separate tSteps' ' cumTrig pooled pooled' ' seqTrig ordered pool ordered pool' ' timTrig separate tSteps separate tSteps' ; EACH write notes ; } # enddoc