id
int64
0
45.1k
file_name
stringlengths
4
68
file_path
stringlengths
14
193
content
stringlengths
32
9.62M
size
int64
32
9.62M
language
stringclasses
1 value
extension
stringclasses
6 values
total_lines
int64
1
136k
avg_line_length
float64
3
903k
max_line_length
int64
3
4.51M
alphanum_fraction
float64
0
1
repo_name
stringclasses
779 values
repo_stars
int64
0
882
repo_forks
int64
0
108
repo_open_issues
int64
0
90
repo_license
stringclasses
8 values
repo_extraction_date
stringclasses
146 values
sha
stringlengths
64
64
__index_level_0__
int64
0
45.1k
exdup_ids_cmlisp_stkv2
sequencelengths
1
47
1,404
sdiffile.opat
cac-t-u-s_om-sharp/help-patches/SDIF/sdiffile.opat
(:patch (:name "sdiffile") (:doc "") (:info (:created "2019/09/23 11:18:05") (:modified "2022/04/24 21:36:02") (:by "om-sharp") (:version 1.06)) (:window (:size (1024 475)) (:position (144 148))) (:grid nil) (:lock nil) (:boxes (:comment (:x 37) (:y 280) (:w 416) (:h 50) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "- Eval the box (v) to load a file - Lock the box (b) if you want to store this file in the box - Double-click to open and visualize the file contents") (:id 0)) (:box (:type :object) (:reference sdiffile) (:group-id nil) (:name "SDIFFILE") (:x 181) (:y 189) (:w 78) (:h 72) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname t) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value :choose-file) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil))) (:window (:size (425 216)) (:position (102 83))) (:edition-params) (:value (:object (:class sdiffile) (:add-slots ((:file-map nil) (:file-pathname nil))))) (:id 1)) (:comment (:x 162) (:y 108) (:w 415) (:h 50) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Load a file using a (valid) pathname connected to the box. If the <self> input defaults to :choose-file, a file chooser dialog opens to select an SDIF file") (:id 2)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "aux") (:x 44) (:y 108) (:w 89) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "file01.sdif") (:id 3)) (:box (:type :function) (:reference infile) (:group-id nil) (:name "infile") (:x 51) (:y 148) (:w 74) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "NAME") (:value "") (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :object) (:reference sdiffile) (:group-id nil) (:name nil) (:x 49) (:y 187) (:w 78) (:h 72) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname t) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value :choose-file) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil))) (:window (:size (367 186)) (:position (73 54))) (:edition-params) (:value (:object (:class sdiffile) (:add-slots ((:file-map nil) (:file-pathname nil))))) (:id 5)) (:comment (:x 30) (:y 55) (:w 490) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "The SDIFFILE object is a pointer to an SDIF file (Sound Description Interchange Format) in the patch.") (:id 6)) (:comment (:x 33) (:y 23) (:w 87) (:h 29) (:fgcolor (:color 6/85 14/85 106/255 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Consolas") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "SDIFFile") (:id 7)) (:comment (:x 544) (:y 392) (:w 161) (:h 22) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Consolas") (:size 12) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "SDIF to text conversion") (:id 8)) (:box (:type :object) (:reference textbuffer) (:group-id nil) (:name "TEXTFILE") (:x 562) (:y 328) (:w 132) (:h 58) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CONTENTS") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "CONTENTS") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:output-mode :list)) (:value (:object (:class textbuffer) (:slots ((:contents (:list "SDIF" "" "1NVT" "{" "BufferSize 512;" "NumberOfChannels 1;" "EndTime 1.696;" "SdifTypesVersion 1.01.ppc;" "ChantLibraryVersion 1.01.ppc;" "Author DIPHONE;" "SamplingRate 44100.000;" "}" "" "1IDS" "{" " 0 Chant:Patch0/1/FOB/1/35/0.000000/1.696054;" "}" "" "" "SDFC" "" "1FOB 3 0 0" " 1FQ0 0x0004 1 1" " 0.294802" " 1FOF 0x0004 35 7" " 49.3655 0.000111216 0.719891 0.002 1.52645 0.169605 0" " 161.284 0.000339959 0.139965 0.002 1.52645 0.169605 0" " 266.654 0.000283425 1.11932 0.002 1.52645 0.169605 0" " 271.768 0.000272263 2.09772 0.002 1.15697 0.539089 0" " 299.709 0.00118343 0.455665 0.002 1.52645 0.169605 0" " 315.145 0.0146066 0.00257313 0.002 1.52645 0.169605 0" " 320.654 0.00326005 0.150761 0.002 1.52645 0.169605 0" " 323.794 0.00468206 1.55356 0.002 1.56222 0.133839 0" " 329.453 0.0085899 0.311545 0.002 1.52645 0.169605 0" " 347.735 0.00103451 0.464687 0.002 1.52645 0.169605 0" " 363.867 0.00294196 3.85345 0.002 0.629823 1.06623 0" " 367.941 0.000208699 0.259842 0.002 1.52645 0.169605 0" " 369.3 0.000345811 1.13904 0.002 1.52645 0.169605 0" " 374.09 0.000308146 0.810446 0.002 1.52645 0.169605 0" " 389.36 0.025583 3.63404 0.002 0.66785 1.0282 0" " 391.661 0.0184221 0.252235 0.002 1.52645 0.169605 0" " 413.85 0.000235326 1.32729 0.002 1.52645 0.169605 0" " 429.582 0.000163539 0.188297 0.002 1.52645 0.169605 0" " 453.096 0.000536226 0.961745 0.002 1.52645 0.169605 0" " 462.459 0.000853075 0.246895 0.002 1.52645 0.169605 0" " 469.57 0.000524189 0.955544 0.002 1.52645 0.169605 0" " 485.581 0.00308735 0.457775 0.002 1.52645 0.169605 0" " 490.499 0.00421743 6.86256 0.002 0.353657 1.3424 0" " 503.753 0.000322173 0.822604 0.002 1.52645 0.169605 0" " 507.611 0.000320495 2.17116 0.002 1.11783 0.578224 0" " 515.898 0.000273332 1.40095 0.002 1.52645 0.169605 0" " 630.436 0.00636245 1.63731 0.002 1.4823 0.213753 0" " 783.106 0.00101509 2.04645 0.002 1.18595 0.510101 0" " 943.987 0.000244713 1.01127 0.002 1.52645 0.169605 0" " 1160.82 0.00016276 0.832355 0.002 1.52645 0.169605 0" " 1172.88 0.000551225 0.395935 0.002 1.52645 0.169605 0" " 1177.02 0.0013944 0.66034 0.002 1.52645 0.169605 0" " 1576.43 0.000240996 0.509589 0.002 1.52645 0.169605 0" " 1577.8 0.000196247 1.23795 0.002 1.52645 0.169605 0" " 1889.7 0.000336046 1.12846 0.002 1.52645 0.169605 0" " 1CHA 0x0004 35 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" " 1" "" "ENDC" "ENDF")))) (:add-slots ((:input-mode :lines-cols))))) (:id 9)) (:box (:type :function) (:reference sdif->text) (:group-id nil) (:name "sdif->text") (:x 546) (:y 288) (:w 98) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 10)) (:box (:type :object) (:reference sdiffile) (:group-id nil) (:name nil) (:x 525) (:y 220) (:w 141) (:h 51) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value :choose-file) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil))) (:window (:size (500 500)) (:position (247 228))) (:edition-params) (:value (:object (:class sdiffile) (:add-slots ((:file-map (:list (:fstream-desc (:id 0) (:fsig "1FOB") (:tmin 0.0D0) (:tmax 0.0D0) (:nf 1) (:matrices (:list (:mstream-desc (:msig "1FQ0") (:fields ("??????x1")) (:rmax 1) (:tmin 0.0D0) (:tmax 0.0D0) (:nf 1)) (:mstream-desc (:msig "1FOF") (:fields ("??????x1" "??????x2" "??????x3" "??????x4" "??????x5" "??????x6" "??????x7")) (:rmax 35) (:tmin 0.0D0) (:tmax 0.0D0) (:nf 1)) (:mstream-desc (:msig "1CHA") (:fields ("??????x1")) (:rmax 35) (:tmin 0.0D0) (:tmax 0.0D0) (:nf 1))))))) (:file-pathname (:pathname (:directory (:relative :up :up :up :up "OM" "OM6" "OPENMUSIC" "resources" "online" "in-files")) (:device :unspecific) (:host :unspecific) (:name "tenor.FOF") (:type "sdif"))))))) (:id 11))) (:connections (:connection (:from (:box 3 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 10 :out 0)) (:to (:box 9 :in 0))) (:connection (:from (:box 11 :out 0)) (:to (:box 10 :in 0)))))
11,330
Common Lisp
.l
464
17.971983
108
0.502025
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9fd052106a8970a2745559b895bd1c71aa1d4681c0327153e3280af33f2ac8eb
1,404
[ -1 ]
1,406
sdif-write-loop.opat
cac-t-u-s_om-sharp/help-patches/SDIF/sdif-write-loop.opat
(:patch (:name "sdif-write-loop") (:doc "") (:info (:created "2019/09/23 12:34:45") (:modified "2022/05/15 17:47:48") (:by "om-sharp") (:version 1.06)) (:window (:size (599 531)) (:position (146 86))) (:grid nil) (:lock nil) (:boxes (:comment (:x 132) (:y 438) (:w 82) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "SDIFFILE (eval here)") (:id 0)) (:comment (:x 47) (:y 35) (:w 454) (:h 29) (:fgcolor (:color 0.19215687 0.2627451 0.42352942 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Consolas") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "Write an SDIF File with a dynamic file stream") (:id 1)) (:comment (:x 49) (:y 130) (:w 148) (:h 22) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Example data to write") (:id 2)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "aux") (:x 275) (:y 178) (:w 97) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "mydata.sdif") (:id 3)) (:box (:type :function) (:reference outfile) (:group-id nil) (:name "outfile") (:x 283) (:y 213) (:w 80) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "NAME") (:value "") (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :object) (:reference collection) (:group-id nil) (:name "BPF-LIB1") (:x 52) (:y 154) (:w 129) (:h 96) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "OBJ-LIST") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "OBJ-LIST") (:reactive nil))) (:window (:size (917 875)) (:position (73 54))) (:edition-params) (:value (:object (:class collection) (:slots ((:obj-list (:list (:object (:class bpf) (:slots ((:onset 0) (:duration 100) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 76 78 80 82 84 86 88 90 92 94 96 98 100)) (:y-points (:list 0 11 21 27 33 40 44 47 49 51 52 51 50 47 45 40 38 35 32 30 29 27 26 25 24 23 23 23 23 24 24 25 26 26 27 27 28 28 28 28 28 28 28 27 28 32 35 45 59 88)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 99) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99)) (:y-points (:list 0 11 20 26 32 38 43 46 48 50 50 50 48 46 44 40 38 35 32 31 29 27 26 25 24 23 23 23 23 24 24 24 25 26 26 27 27 27 27 27 27 27 27 27 28 31 34 43 57 85)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 99) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 75 77 79 81 83 85 87 89 91 93 95 97 99)) (:y-points (:list 0 10 20 25 31 37 42 44 46 48 49 49 47 46 43 39 38 34 32 31 30 28 26 25 24 23 23 23 23 24 23 24 25 25 26 26 27 27 27 27 27 27 27 26 27 30 33 42 55 81)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 98) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98)) (:y-points (:list 0 10 19 24 30 36 40 43 45 47 48 47 46 45 42 39 37 34 32 31 30 28 27 26 25 23 23 23 23 23 23 24 24 25 25 25 26 26 26 26 26 26 26 25 26 29 32 40 52 78)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 73 75 77 79 81 83 85 87 89 91 93 95 97)) (:y-points (:list 0 10 18 23 29 34 39 41 43 45 46 46 45 44 42 38 37 34 32 31 30 28 27 26 25 24 23 23 23 23 23 23 24 24 25 25 25 25 25 25 25 25 25 25 26 28 31 39 50 74)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97)) (:y-points (:list 0 9 17 22 28 33 37 40 42 44 45 45 44 43 41 38 37 34 32 31 30 29 28 26 25 24 23 23 23 23 23 23 23 24 24 24 25 25 25 25 25 25 25 24 25 27 30 37 48 71)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 96) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 72 74 76 78 80 82 84 86 88 90 92 94 96)) (:y-points (:list 0 9 17 21 26 32 36 38 40 42 43 43 43 42 40 38 36 34 32 31 31 29 28 27 26 24 23 23 23 23 22 22 23 23 24 24 24 24 24 24 24 24 24 24 24 27 29 36 46 67)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 95) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 89 91 93 95)) (:y-points (:list 0 8 16 20 25 30 35 37 39 41 42 42 41 41 39 37 36 34 33 32 31 29 28 27 26 24 23 23 22 22 22 22 22 23 23 23 23 23 23 23 23 23 23 23 24 26 28 35 44 64)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 95) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 44 46 48 50 52 54 56 58 60 62 64 66 68 70 71 73 75 77 79 81 83 85 87 89 91 93 95)) (:y-points (:list 0 8 15 19 24 29 33 35 37 39 41 41 40 40 38 37 36 34 33 32 31 30 29 28 26 24 23 22 22 22 22 22 22 22 22 22 23 23 23 23 23 23 23 22 23 25 27 33 42 60)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 94) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 13 15 17 19 21 23 25 27 29 31 33 35 36 38 40 42 44 46 48 50 52 54 56 58 59 61 63 65 67 69 71 73 75 77 79 81 82 84 86 88 90 92 94)) (:y-points (:list 0 7 14 18 23 28 32 34 36 38 39 39 39 39 38 36 35 34 33 32 31 30 29 28 27 24 23 22 22 22 21 21 22 22 22 22 22 22 22 22 22 22 22 22 22 24 26 32 40 57)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 93) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 11 13 15 17 19 21 23 25 27 29 30 32 34 36 38 40 42 44 46 48 50 51 53 55 57 59 61 63 65 67 69 70 72 74 76 78 80 82 84 86 88 90 91 93)) (:y-points (:list 0 7 13 17 22 27 30 33 34 36 38 38 38 38 37 36 35 34 33 32 31 30 29 28 27 25 23 22 22 22 21 21 21 21 21 21 21 21 21 21 21 21 21 21 22 23 25 30 38 53)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 93) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 9 11 13 15 17 19 21 23 25 26 28 30 32 34 36 38 40 42 43 45 47 49 51 53 55 57 59 61 62 64 66 68 70 72 74 76 78 79 81 83 85 87 89 91 93)) (:y-points (:list 0 7 13 17 21 25 29 31 33 35 36 37 37 37 36 35 35 33 33 32 32 31 30 29 27 25 23 22 22 21 21 20 21 21 21 21 21 21 21 21 21 21 21 20 21 22 24 29 36 50)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 92) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 9 11 13 15 17 19 21 23 24 26 28 30 32 34 36 38 39 41 43 45 47 49 51 53 54 56 58 60 62 64 66 68 69 71 73 75 77 79 81 83 84 86 88 90 92)) (:y-points (:list 0 6 12 16 20 24 27 30 31 33 35 35 36 36 35 35 34 33 33 32 32 31 30 29 28 25 23 22 22 21 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 23 28 34 46)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 19 21 22 24 26 28 30 32 34 35 37 39 41 43 45 47 48 50 52 54 56 58 60 62 63 65 67 69 71 73 75 76 78 80 82 84 86 88 89 91)) (:y-points (:list 0 6 11 15 19 23 26 28 30 32 34 34 34 35 35 34 34 33 33 32 32 31 30 30 28 25 23 22 22 21 20 20 20 20 20 19 19 19 19 19 19 19 19 19 19 21 22 26 32 43)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 19 20 22 24 26 28 30 31 33 35 37 39 41 43 44 46 48 50 52 54 56 57 59 61 63 65 67 68 70 72 74 76 78 80 81 83 85 87 89 91)) (:y-points (:list 0 5 10 14 17 21 25 27 28 31 32 33 33 34 34 34 34 33 33 33 32 32 31 30 28 25 23 22 21 21 20 19 19 19 19 19 19 19 19 19 19 19 19 18 19 20 21 25 30 39)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 90) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 18 20 22 24 26 28 29 31 33 35 37 39 40 42 44 46 48 50 51 53 55 57 59 61 62 64 66 68 70 72 73 75 77 79 81 83 84 86 88 90)) (:y-points (:list 0 5 9 13 16 20 23 25 27 29 31 31 32 33 33 33 33 33 33 33 33 32 31 30 29 25 24 22 21 21 19 19 19 19 18 18 18 18 18 18 18 18 18 18 18 19 20 23 27 36)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 89) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 15 16 18 20 22 24 26 27 29 31 33 35 36 38 40 42 44 46 47 49 51 53 55 57 58 60 62 64 66 67 69 71 73 75 77 78 80 82 84 86 88 89)) (:y-points (:list 0 4 9 12 15 19 22 24 25 28 29 30 31 32 32 33 33 33 33 33 33 32 32 31 29 25 24 22 21 20 19 19 18 18 18 18 17 17 17 17 17 17 17 17 17 18 19 22 25 32)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 89) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 14 16 18 20 22 24 25 27 29 31 33 34 36 38 40 42 43 45 47 49 51 52 54 56 58 60 62 63 65 67 69 71 72 74 76 78 80 81 83 85 87 89)) (:y-points (:list 0 4 8 11 14 17 20 22 24 26 28 29 30 31 32 32 33 33 33 33 33 33 32 31 29 26 24 22 21 20 19 18 18 18 17 17 17 17 17 17 17 17 17 17 17 17 18 20 23 29)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 88) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 14 16 18 20 22 23 25 27 29 31 32 34 36 38 40 41 43 45 47 48 50 52 54 56 57 59 61 63 65 66 68 70 72 74 75 77 79 81 83 84 86 88)) (:y-points (:list 0 4 7 10 13 16 19 21 23 25 27 27 29 30 31 32 33 33 33 33 33 33 32 31 30 26 24 22 21 20 19 18 17 17 17 16 16 16 16 16 16 16 16 16 16 17 17 19 21 25)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 87) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 20 21 23 25 27 29 30 32 34 36 37 39 41 43 45 46 48 50 52 53 55 57 59 61 62 64 66 68 70 71 73 75 77 78 80 82 84 86 87)) (:y-points (:list 0 3 6 9 12 15 17 19 21 23 25 26 27 29 30 31 32 33 33 33 34 33 33 32 30 26 24 22 21 20 18 17 17 17 16 16 15 15 15 15 15 15 15 15 15 16 16 18 19 22)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 86) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 19 21 23 25 26 28 30 32 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 68 70 72 74 75 77 79 81 82 84 86)) (:y-points (:list 0 2 5 7 10 12 15 16 18 20 22 24 25 27 29 30 32 32 33 34 34 34 33 33 31 26 24 22 20 19 18 17 16 16 15 15 14 14 14 14 14 14 14 14 14 14 14 15 15 15)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 102) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 4 6 8 10 12 14 16 18 20 22 24 26 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 78 80 82 84 86 88 90 92 94 96 98 100 102)) (:y-points (:list 103 101 100 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 55 53 51 49 46 45 43 40 38 36 34 31 29 26 24 22 19 17 15 13 11 8 7 5 2 0)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 101) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101)) (:y-points (:list 98 97 95 94 92 90 88 86 84 83 81 79 77 75 74 72 70 69 67 65 63 61 59 57 54 52 50 48 45 43 42 39 37 35 33 30 28 26 24 21 19 17 15 13 11 9 7 6 3 1)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 100) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100)) (:y-points (:list 93 92 91 89 88 86 84 83 81 79 78 76 74 73 72 70 68 67 65 63 61 59 58 56 53 50 48 46 43 42 40 38 36 34 32 29 27 25 23 21 19 17 15 13 11 9 7 6 3 1)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 100) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100)) (:y-points (:list 88 87 86 85 84 82 81 79 78 76 75 73 72 70 69 68 67 65 63 62 60 58 56 54 52 49 47 45 42 41 39 37 35 33 31 29 26 25 23 21 19 17 15 13 12 9 8 6 4 2)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 99) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 4 6 8 10 12 14 16 18 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99)) (:y-points (:list 83 83 82 81 79 78 77 76 74 73 72 71 69 68 67 66 65 63 62 60 58 57 55 53 50 48 46 44 41 40 38 36 34 32 30 28 26 24 22 20 18 17 15 13 12 9 8 7 5 3)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 98) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 76 78 80 82 84 86 88 90 92 94 96 98)) (:y-points (:list 78 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 61 60 58 57 55 54 52 49 47 44 42 40 38 37 35 33 31 29 27 25 24 22 20 18 17 15 13 12 10 8 7 5 4)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 95 97)) (:y-points (:list 74 73 73 72 71 70 70 69 68 67 66 65 64 63 63 62 61 59 58 57 56 54 52 51 48 45 43 41 39 37 36 33 31 30 28 26 24 23 21 19 18 16 15 13 12 10 9 8 6 4)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97)) (:y-points (:list 69 68 68 68 67 67 66 65 64 64 63 62 61 61 60 60 59 58 57 55 54 53 51 50 47 44 42 40 37 36 34 32 30 29 27 25 24 22 21 19 18 16 15 13 12 10 9 8 6 5)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 96) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 11 13 15 17 19 21 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 80 82 84 86 88 90 92 94 96)) (:y-points (:list 64 64 64 63 63 63 62 62 61 61 60 59 59 58 58 58 57 56 55 54 53 51 50 48 46 43 41 38 36 35 33 31 29 28 27 25 23 22 20 19 17 16 15 14 12 10 9 9 7 6)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 95) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 11 13 15 16 18 20 22 24 26 28 30 32 34 36 38 40 41 43 45 47 49 51 53 55 57 59 61 63 64 66 68 70 72 74 76 78 80 82 84 86 87 89 91 93 95)) (:y-points (:list 59 59 59 59 59 59 59 58 58 58 57 57 56 56 56 56 55 54 53 52 51 50 49 47 45 42 39 37 35 34 32 30 28 27 26 24 22 21 20 18 17 16 15 14 12 11 10 9 8 6)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 94) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 11 12 14 16 18 20 22 24 26 28 30 32 33 35 37 39 41 43 45 47 49 51 52 54 56 58 60 62 64 66 68 70 72 73 75 77 79 81 83 85 87 89 91 92 94)) (:y-points (:list 54 54 55 55 55 55 55 55 55 54 54 54 54 53 54 53 53 52 51 51 50 49 47 46 43 40 38 36 34 32 31 29 27 26 25 23 22 21 19 18 17 16 15 14 13 11 10 10 8 7)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 94) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 7 9 10 12 14 16 18 20 22 24 26 27 29 31 33 35 37 39 41 43 44 46 48 50 52 54 56 58 60 61 63 65 67 69 71 73 75 77 78 80 82 84 86 88 90 92 94)) (:y-points (:list 49 50 50 50 51 51 51 51 51 51 52 51 51 51 51 51 51 50 50 49 48 47 46 45 42 39 37 35 33 31 30 28 26 25 24 22 21 20 19 18 17 16 15 14 13 11 10 10 9 8)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 93) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 5 6 8 10 12 14 16 18 20 22 23 25 27 29 31 33 35 37 38 40 42 44 46 48 50 52 53 55 57 59 61 63 65 67 68 70 72 74 76 78 80 82 83 85 87 89 91 93)) (:y-points (:list 44 45 46 46 47 47 48 48 48 48 49 48 48 49 49 49 49 49 48 48 47 46 45 44 41 38 35 33 31 30 28 27 25 24 23 22 20 19 18 17 16 15 15 14 13 12 11 11 9 9)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 92) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 4 6 8 10 12 14 16 18 19 21 23 25 27 29 31 32 34 36 38 40 42 44 45 47 49 51 53 55 57 59 60 62 64 66 68 70 72 73 75 77 79 81 83 85 87 88 90 92)) (:y-points (:list 39 40 41 42 43 43 44 44 45 45 46 46 46 46 47 47 47 47 46 46 45 45 44 42 40 36 34 32 30 29 27 26 24 23 22 21 20 19 18 17 16 15 14 14 13 12 11 11 10 9)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 3 4 6 8 10 12 14 15 17 19 21 23 25 27 28 30 32 34 36 38 40 41 43 45 47 49 51 52 54 56 58 60 62 64 65 67 69 71 73 75 77 78 80 82 84 86 88 89 91)) (:y-points (:list 34 35 36 38 38 39 40 41 41 42 43 43 43 44 44 45 45 45 45 45 44 43 42 41 39 35 33 31 29 28 26 24 23 22 21 20 19 18 17 17 16 15 14 14 13 12 12 12 11 10)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 1 2 4 6 8 10 12 13 15 17 19 21 23 24 26 28 30 32 34 35 37 39 41 43 45 46 48 50 52 54 56 58 59 61 63 65 67 69 70 72 74 76 78 80 81 83 85 87 89 91)) (:y-points (:list 29 31 32 33 34 35 37 37 38 39 40 40 41 41 42 43 43 43 43 43 43 42 41 40 38 34 32 29 28 26 25 23 22 21 20 19 18 18 17 16 16 15 14 14 13 12 12 12 11 11)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 90) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 11 13 15 17 19 21 22 24 26 28 30 31 33 35 37 39 41 42 44 46 48 50 52 53 55 57 59 61 62 64 66 68 70 72 73 75 77 79 81 83 84 86 88 90)) (:y-points (:list 25 26 27 29 30 32 33 34 35 36 37 37 38 39 40 41 41 41 41 41 41 41 40 39 37 33 30 28 26 25 24 22 21 20 19 18 17 17 16 16 15 15 14 14 13 13 12 12 12 11)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 89) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 9 11 13 15 17 18 20 22 24 26 28 29 31 33 35 37 38 40 42 44 46 47 49 51 53 55 56 58 60 62 64 66 67 69 71 73 75 76 78 80 82 84 85 87 89)) (:y-points (:list 20 21 23 25 26 28 29 30 31 33 34 35 35 37 38 39 39 40 40 40 40 39 38 37 35 31 29 27 25 24 22 21 20 19 19 18 17 16 16 15 15 15 14 14 13 13 13 13 13 12)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 88) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 16 18 20 22 24 25 27 29 31 33 34 36 38 40 42 43 45 47 49 51 52 54 56 58 60 61 63 65 67 69 70 72 74 76 78 79 81 83 85 86 88)) (:y-points (:list 15 17 18 20 22 24 26 27 28 30 31 32 33 34 35 37 37 38 38 38 38 38 37 36 34 30 28 26 24 23 21 20 19 18 18 17 16 16 15 15 15 14 14 14 14 13 13 13 13 13)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 88) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 14 16 18 20 22 23 25 27 29 30 32 34 36 38 39 41 43 45 47 48 50 52 54 55 57 59 61 63 64 66 68 70 71 73 75 77 79 80 82 84 86 88)) (:y-points (:list 10 12 14 16 18 20 22 23 25 26 28 29 30 32 33 35 35 36 36 37 37 37 36 35 33 29 26 24 23 22 20 19 18 17 17 16 15 15 15 15 15 14 14 14 14 13 13 14 14 14)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 100) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 76 78 80 82 84 86 88 90 92 94 96 98 100)) (:y-points (:list 0 2 4 6 8 10 11 13 16 18 20 22 24 26 28 30 32 34 36 38 40 41 43 46 47 49 51 53 55 57 59 61 63 65 67 69 71 74 76 78 80 83 85 87 89 91 93 96 97 100)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 99) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99)) (:y-points (:list 0 2 4 6 8 10 11 13 16 18 20 22 24 26 28 30 32 34 36 38 40 41 42 45 46 48 50 52 53 55 57 59 61 63 64 67 69 71 73 75 77 79 81 83 85 87 90 92 93 96)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 99) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 75 77 79 81 83 85 87 89 91 93 95 97 99)) (:y-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 35 37 39 41 42 45 45 47 48 50 52 54 55 57 59 60 62 64 66 68 70 72 73 76 78 80 82 84 86 88 89 92)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 98) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98)) (:y-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 35 37 39 40 42 44 45 46 47 49 50 52 53 55 57 58 59 62 63 65 67 69 70 73 75 76 78 80 82 84 85 88)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 73 75 77 79 81 83 85 87 89 91 93 95 97)) (:y-points (:list 0 2 4 6 8 10 12 14 16 18 20 23 24 26 28 30 32 33 35 37 39 40 41 43 44 45 46 47 49 50 51 53 54 56 57 59 61 62 64 65 67 69 71 73 75 76 78 80 81 84)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 97) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97)) (:y-points (:list 0 2 4 6 9 10 12 14 16 18 20 23 24 26 28 30 32 33 35 37 38 40 41 43 43 44 45 46 47 48 49 51 52 53 54 56 58 59 61 62 64 66 68 69 71 73 74 76 77 80)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 96) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 20 22 24 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 72 74 76 78 80 82 84 86 88 90 92 94 96)) (:y-points (:list 0 2 4 6 9 10 12 14 17 19 20 23 24 26 28 30 32 33 35 37 38 39 40 42 42 43 43 44 45 46 47 49 50 51 52 54 55 57 58 59 61 63 65 66 67 69 71 73 74 76)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 95) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 16 18 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 89 91 93 95)) (:y-points (:list 0 2 4 7 9 11 12 14 17 19 21 23 24 26 28 30 32 33 35 36 38 39 40 41 42 41 42 43 44 44 45 46 48 49 50 51 52 54 55 56 58 60 61 63 64 65 67 69 70 72)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 95) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 14 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 44 46 48 50 52 54 56 58 60 62 64 66 68 70 71 73 75 77 79 81 83 85 87 89 91 93 95)) (:y-points (:list 0 2 4 7 9 11 12 14 17 19 21 23 24 26 28 30 32 33 35 36 38 39 39 41 41 40 41 41 42 43 43 44 45 46 47 49 50 51 52 53 55 56 58 59 60 62 63 65 66 68)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 94) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 12 13 15 17 19 21 23 25 27 29 31 33 35 36 38 40 42 44 46 48 50 52 54 56 58 59 61 63 65 67 69 71 73 75 77 79 81 82 84 86 88 90 92 94)) (:y-points (:list 0 2 4 7 9 11 13 15 17 19 21 23 24 27 28 30 32 33 35 36 37 38 39 40 40 39 39 40 40 41 41 42 43 44 45 46 47 48 49 50 52 53 54 56 57 58 59 61 62 64)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 93) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 10 11 13 15 17 19 21 23 25 27 29 30 32 34 36 38 40 42 44 46 48 50 51 53 55 57 59 61 63 65 67 69 70 72 74 76 78 80 82 84 86 88 90 91 93)) (:y-points (:list 0 2 4 7 9 11 13 15 17 19 21 23 24 27 28 30 32 33 34 36 37 38 38 40 39 38 38 38 39 39 39 40 41 42 42 43 44 45 46 47 48 50 51 52 53 54 56 57 58 60)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 93) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 9 11 13 15 17 19 21 23 25 26 28 30 32 34 36 38 40 42 43 45 47 49 51 53 55 57 59 61 62 64 66 68 70 72 74 76 78 79 81 83 85 87 89 91 93)) (:y-points (:list 0 2 4 7 9 11 13 15 17 19 21 23 24 27 28 30 32 33 34 36 37 38 38 39 38 37 37 37 37 37 37 38 39 39 40 41 41 42 43 44 45 47 48 49 50 51 52 53 54 55)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 92) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 8 9 11 13 15 17 19 21 23 24 26 28 30 32 34 36 38 39 41 43 45 47 49 51 53 54 56 58 60 62 64 66 68 69 71 73 75 77 79 81 83 84 86 88 90 92)) (:y-points (:list 0 2 4 7 9 11 13 15 17 19 21 23 24 27 28 30 32 33 34 35 36 37 37 38 38 36 35 35 35 35 35 36 36 37 37 38 39 40 40 41 42 43 44 45 46 47 48 49 50 51)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 19 21 22 24 26 28 30 32 34 35 37 39 41 43 45 47 48 50 52 54 56 58 60 62 63 65 67 69 71 73 75 76 78 80 82 84 86 88 89 91)) (:y-points (:list 0 2 5 7 9 11 13 15 17 19 21 23 25 27 28 30 32 33 34 35 36 37 37 38 37 35 34 34 34 34 33 34 34 34 35 35 36 37 37 38 39 40 41 42 42 43 44 46 46 47)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 91) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 19 20 22 24 26 28 30 31 33 35 37 39 41 43 44 46 48 50 52 54 56 57 59 61 63 65 67 68 70 72 74 76 78 80 81 83 85 87 89 91)) (:y-points (:list 0 2 5 7 9 11 13 15 17 19 21 23 25 27 28 30 32 33 34 35 36 36 37 37 36 34 33 32 32 32 32 31 32 32 32 33 33 34 35 35 36 37 38 38 39 40 40 42 42 43)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 90) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 6 7 9 11 13 15 17 18 20 22 24 26 28 29 31 33 35 37 39 40 42 44 46 48 50 51 53 55 57 59 61 62 64 66 68 70 72 73 75 77 79 81 83 84 86 88 90)) (:y-points (:list 0 2 5 7 9 11 14 15 17 20 22 23 25 27 28 30 32 33 34 35 36 36 36 36 35 33 32 31 30 30 30 29 30 30 30 30 30 31 32 32 33 34 34 35 35 36 37 38 38 39)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 89) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 15 16 18 20 22 24 26 27 29 31 33 35 36 38 40 42 44 46 47 49 51 53 55 57 58 60 62 64 66 67 69 71 73 75 77 78 80 82 84 86 88 89)) (:y-points (:list 0 2 5 7 9 12 14 16 18 20 22 23 25 27 28 30 32 33 34 35 35 36 36 36 35 32 30 29 29 28 28 27 27 27 27 28 28 28 29 29 30 30 31 31 32 32 33 34 35 35)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 89) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 14 16 18 20 22 24 25 27 29 31 33 34 36 38 40 42 43 45 47 49 51 52 54 56 58 60 62 63 65 67 69 71 72 74 76 78 80 81 83 85 87 89)) (:y-points (:list 0 2 5 7 9 12 14 16 18 20 22 23 25 27 28 30 32 33 34 34 35 35 35 35 34 31 29 28 27 26 26 25 25 25 25 25 25 25 26 26 27 27 27 28 28 29 29 30 31 31)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 88) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 13 14 16 18 20 22 23 25 27 29 31 32 34 36 38 40 41 43 45 47 48 50 52 54 56 57 59 61 63 65 66 68 70 72 74 75 77 79 81 83 84 86 88)) (:y-points (:list 0 2 5 7 9 12 14 16 18 20 22 23 25 27 28 30 32 33 33 34 35 35 35 35 33 29 28 26 25 25 24 23 23 23 22 22 22 23 23 23 23 24 24 24 25 25 25 26 27 27)))) (:add-slots ((:name nil)))) (:object (:class bpf) (:slots ((:onset 0) (:duration 87) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0 0 0 1.0)) (:decimals 0) (:x-points (:list 0 2 4 5 7 9 11 12 14 16 18 20 21 23 25 27 29 30 32 34 36 37 39 41 43 45 46 48 50 52 53 55 57 59 61 62 64 66 68 70 71 73 75 77 78 80 82 84 86 87)) (:y-points (:list 0 2 5 7 10 12 14 16 18 20 22 23 25 27 29 30 32 33 33 34 35 35 34 34 32 28 26 25 24 23 22 21 21 20 20 20 19 20 20 20 20 21 21 21 21 21 22 22 23 23)))) (:add-slots ((:name nil)))))))))) (:id 5)) (:box (:type :object) (:reference sdiffile) (:group-id nil) (:name "") (:x 216) (:y 436) (:w 121) (:h 61) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value :choose-file) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil))) (:window (:size (754 278)) (:position (745 289))) (:edition-params) (:value (:object (:class sdiffile) (:add-slots ((:file-map (:list (:fstream-desc (:id 0) (:fsig "XFRA") (:tmin 0.0D0) (:tmax 79.0D0) (:nf 80) (:matrices (:list (:mstream-desc (:msig "XMAT") (:fields ("par1")) (:rmax 50) (:tmin 0.0D0) (:tmax 79.0D0) (:nf 80))))))) (:file-pathname (:pathname (:directory (:relative :up :up :up :up :up "Documents" "OM#" "out-files")) (:device :unspecific) (:host :unspecific) (:name "mydata") (:type "sdif"))))))) (:id 6)) (:box (:type :abstraction) (:reference (:patch (:name "WRITE-LOOP") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (878 668)) (:position (688 81))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "BPFs") (:doc "no documentation"))) (:group-id nil) (:name "BPFs") (:x 425) (:y 39) (:w 56) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 0)) (:box (:type :io) (:reference (:in (:type omin) (:index 2) (:name "file-pointer") (:doc "no documentation"))) (:group-id nil) (:name "file-pointer") (:x 531) (:y 50) (:w 95) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :io) (:reference (:out (:type omout) (:name "output 1") (:index 1) (:doc ""))) (:group-id nil) (:name "output 1") (:x 672) (:y 116) (:w 70) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 2)) (:comment (:x 44) (:y 49) (:w 124) (:h 22) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Type declarations") (:id 3)) (:box (:type :function) (:reference sdif-write-frame) (:group-id nil) (:name "sdif-write-frame") (:x 480) (:y 512) (:w 135) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FSTREAM") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:comment (:x 346) (:y 566) (:w 180) (:h 50) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "At each iteration: - Write the frame - Increment the counter") (:id 5)) (:comment (:x 43) (:y 395) (:w 207) (:h 50) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Here the time tags of the frames are set and incremented by the loop counter") (:id 6)) (:comment (:x 589) (:y 380) (:w 177) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Create an SDIF Frame with the matrix (or matrices)") (:id 7)) (:comment (:x 558) (:y 542) (:w 140) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Writes a Frame in an SDIF file stream") (:id 8)) (:comment (:x 590) (:y 285) (:w 183) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Create an SDIF Matrix with each BPF from the list") (:id 9)) (:comment (:x 638) (:y 157) (:w 162) (:h 36) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "END OF THE LOOP: Return the file pointer") (:id 10)) (:comment (:x 2) (:y 270) (:w 176) (:h 64) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "Before to start the loop: Write file header with type declarations (optionnaly also NVTs)") (:id 11)) (:box (:type :function) (:reference float) (:group-id nil) (:name "float") (:x 432) (:y 393) (:w 68) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "N") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 12)) (:box (:type :special) (:reference accum) (:group-id nil) (:name "accum") (:x 304) (:y 340) (:w 56) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "data-in") (:value t) (:reactive nil)) (:input (:type :standard) (:name "accum-function") (:value om-1+) (:reactive nil)) (:input (:type :standard) (:name "init") (:value 0) (:reactive nil))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive nil)) (:output (:name "init") (:reactive nil))) (:id 13)) (:box (:type :object) (:reference sdifframe) (:group-id nil) (:name "SDIFFRAME") (:x 405) (:y 435) (:w 122) (:h 51) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FRAMETYPE") (:value "XFRA") (:reactive nil)) (:input (:type :standard) (:name "FTIME") (:value 0.0) (:reactive nil)) (:input (:type :standard) (:name "STREAMID") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "LMATRIX") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "FRAMETYPE") (:reactive nil)) (:output (:name "FTIME") (:reactive nil)) (:output (:name "STREAMID") (:reactive nil)) (:output (:name "LMATRIX") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class sdifframe) (:slots ((:onset 0) (:item-internal-time nil) (:item-type nil) (:attributes nil) (:frametype nil) (:ftime 0.0) (:streamid 0) (:lmatrix nil))))) (:id 14)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 480) (:y 345) (:w 62) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 15)) (:box (:type :object) (:reference sdifmatrix) (:group-id nil) (:name "SDIFMATRIX") (:x 354) (:y 277) (:w 191) (:h 50) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "MATRIXTYPE") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "MATRIXTYPE") (:reactive nil)) (:output (:name "DATA") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class sdifmatrix) (:slots ((:field-names nil) (:data nil) (:matrixtype nil))))) (:id 16)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 86) (:y 177) (:w 62) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 17)) (:box (:type :object) (:reference sdiftype) (:group-id nil) (:name "SDIFTYPE") (:x 110) (:y 109) (:w 70) (:h 50) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "STRUCT") (:value f) (:reactive nil)) (:input (:type :standard) (:name "SIGNATURE") (:value "XFRA") (:reactive nil)) (:input (:type :standard) (:name "DESCRIPTION") (:value (:list (:list "XMAT" "datamat"))) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "STRUCT") (:reactive nil)) (:output (:name "SIGNATURE") (:reactive nil)) (:output (:name "DESCRIPTION") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class sdiftype) (:slots ((:struct f) (:signature "XFRA") (:description (:list (:list "XNFO" "InfoMat") (:list "XMAT" "datamat"))))))) (:id 18)) (:box (:type :object) (:reference sdiftype) (:group-id nil) (:name "SDIFTYPE") (:x 29) (:y 109) (:w 70) (:h 50) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "STRUCT") (:value m) (:reactive nil)) (:input (:type :standard) (:name "SIGNATURE") (:value "XMAT") (:reactive nil)) (:input (:type :standard) (:name "DESCRIPTION") (:value (:list "par1")) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "STRUCT") (:reactive nil)) (:output (:name "SIGNATURE") (:reactive nil)) (:output (:name "DESCRIPTION") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class sdiftype) (:slots ((:struct m) (:signature "XMAT") (:description (:list "par1" "par2" "par3")))))) (:id 19)) (:box (:type :function) (:reference sdif-write-header) (:group-id nil) (:name "sdif-write-header") (:x 138) (:y 233) (:w 141) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "FSTREAM") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "types") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "nvts") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "sids") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 20)) (:box (:type :special) (:reference init-do) (:group-id nil) (:name "init-do") (:x 172) (:y 287) (:w 64) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 21)) (:box (:type :special) (:reference iterate) (:group-id nil) (:name "iterate") (:x 279) (:y 566) (:w 64) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 22)) (:box (:type :special) (:reference loop-list) (:group-id nil) (:name "list-loop") (:x 415) (:y 107) (:w 76) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "list") (:value nil) (:reactive nil))) (:outputs (:output (:name "i") (:reactive nil))) (:id 23)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 416) (:y 237) (:w 57) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "XMAT") (:id 24)) (:box (:type :slots) (:reference bpf) (:group-id nil) (:name "BPF SLOTS") (:x 436) (:y 170) (:w 93) (:h 30) (:color (:color 0.9 0.88 0.81 1.0)) (:border nil) (:roundness nil) (:text-font nil) (:align :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "X-POINTS") (:value (:list 0 2000)) (:reactive nil)) (:input (:type :standard) (:name "Y-POINTS") (:value (:list 0 100)) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "X-POINTS") (:reactive nil)) (:output (:name "Y-POINTS") (:reactive nil))) (:id 25)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 471) (:y 207) (:w 62) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 26)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 301) (:y 297) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value t) (:id 27)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 43) (:y 74) (:w 57) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "XMAT") (:id 28)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 126) (:y 74) (:w 53) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "XFRA") (:id 29)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 378) (:y 393) (:w 53) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "XFRA") (:id 30)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 238) (:y 112) (:w 145) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list (:list 0 "test" "/a/b/c"))) (:id 31))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 23 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 20 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 22 :in 0))) (:connection (:from (:box 12 :out 0)) (:to (:box 14 :in 2))) (:connection (:from (:box 13 :out 0)) (:to (:box 22 :in 1))) (:connection (:from (:box 13 :out 1)) (:to (:box 12 :in 0))) (:connection (:from (:box 14 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 15 :out 0)) (:to (:box 14 :in 4))) (:connection (:from (:box 16 :out 0)) (:to (:box 15 :in 0))) (:connection (:from (:box 17 :out 0)) (:to (:box 20 :in 1))) (:connection (:from (:box 18 :out 0)) (:to (:box 17 :in 1))) (:connection (:from (:box 19 :out 0)) (:to (:box 17 :in 0))) (:connection (:from (:box 20 :out 0)) (:to (:box 21 :in 0))) (:connection (:from (:box 23 :out 0)) (:to (:box 25 :in 0))) (:connection (:from (:box 24 :out 0)) (:to (:box 16 :in 1))) (:connection (:from (:box 25 :out 2)) (:to (:box 26 :in 0))) (:connection (:from (:box 26 :out 0)) (:to (:box 16 :in 2))) (:connection (:from (:box 27 :out 0)) (:to (:box 13 :in 0))) (:connection (:from (:box 28 :out 0)) (:to (:box 19 :in 2))) (:connection (:from (:box 29 :out 0)) (:to (:box 18 :in 2))) (:connection (:from (:box 30 :out 0)) (:to (:box 14 :in 1))) (:connection (:from (:box 31 :out 0)) (:to (:box 20 :in 3)))))) (:group-id nil) (:name "WRITE-LOOP") (:x 223) (:y 306) (:w 106) (:h 75) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:pre-delay 0) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "BPFs") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "file-pointer") (:value nil) (:reactive nil))) (:outputs (:output (:name "output 1") (:reactive nil))) (:id 7)) (:box (:type :function) (:reference open-sdif-stream) (:group-id nil) (:name "open-sdif-stream") (:x 289) (:y 255) (:w 135) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "PATH") (:value nil) (:reactive nil)) (:input (:type :key) (:name "direction") (:value :output) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :function) (:reference close-file-stream) (:group-id nil) (:name "close-file-stream") (:x 206) (:y 390) (:w 141) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 9)) (:comment (:x 360) (:y 284) (:w 134) (:h 22) (:fgcolor (:color 0 0 0 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "direction = :output") (:id 10))) (:connections (:connection (:from (:box 3 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 5 :out 1)) (:to (:box 7 :in 0))) (:connection (:from (:box 7 :out 0)) (:to (:box 9 :in 0))) (:connection (:from (:box 8 :out 0)) (:to (:box 7 :in 1))) (:connection (:from (:box 9 :out 0)) (:to (:box 6 :in 0)))))
197,545
Common Lisp
.l
10,375
5.216096
87
0.2124
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
b996af13755251ed4d0ee919a864482b885e87df9fd94874f6442b4318f42d80
1,406
[ -1 ]
1,407
07-filtertree.opat
cac-t-u-s_om-sharp/help-patches/Score/Trees/07-filtertree.opat
(:patch (:name "07-filtertree") (:doc "") (:info (:created "2019/09/24 1:37:53") (:modified "2020/01/02 8:47:47") (:by "om-sharp") (:version 1.0)) (:window (:size (681 462)) (:position (253 230))) (:grid nil) (:lock nil) (:boxes (:comment (:x 96) (:y 36) (:w 419) (:h 51) (:fgcolor (:color 167/255 28/255 2/17 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 18) (:style :plain))) (:align nil) (:text "filtertree replaces expressed notes in given places <places> with rests ") (:id 0)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 68) (:y 322) (:w 451) (:h 72) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7) (:list 500 11.75) (:list 1000 16.0) (:list 2000 20.25) (:list 2750 24.0) (:list 3000 28.125) (:list 3250 31.25) (:list 4000 42.125) (:list 4250 46.25) (:list 4500 49.375) (:list 5000 54.125) (:list 6000 59.625) (:list 7000 65.125) (:list 7500 70.625))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 7999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 2 (:list (:list (:list 4 4) (:list (:list 1 (:list -2 2)) 1.0 (:list 1 (:list 3.0 -1)) (:list 1 (:list 1 -3)))) (:list (:list 4 4) (:list (:list 1 (:list -1 1 -2)) 1 1 (:list 1 (:list 2.0 2))))))) (:lmidic (:list 6000)) (:lonset (:list 500 3000 4250 5000 6000 7500 8000)) (:ldur (:list (:list 2249) (:list 249) (:list 249) (:list 999) (:list 1499) (:list 499))) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 1)) (:comment (:x 308) (:y 201) (:w 174) (:h 82) (:fgcolor (:color 37/51 46/255 2/17 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Helvetica") (:size 12) (:style :plain))) (:align nil) (:text "Removes beats and replaces them with rests according to the given positions <places>. (First beat starting with 0)") (:id 2)) (:box (:type :function) (:reference filtertree) (:group-id nil) (:name "filtertree") (:x 208) (:y 235) (:w 81) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "PLACES") (:value (:list 0 1)) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 3)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "aux") (:x 235) (:y 199) (:w 62) (:h 31) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 0 2 4 6)) (:id 4)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 64) (:y 100) (:w 451) (:h 69) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 500 11.75) (:list 1000 16.0) (:list 2000 20.25) (:list 2750 24.5) (:list 3000 28.125) (:list 3250 31.75) (:list 4000 42.625) (:list 4250 47.5) (:list 4500 51.125) (:list 5000 55.375) (:list 6000 60.875) (:list 7000 66.375) (:list 7500 71.875))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 7999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 2 (:list (:list (:list 4 4) (:list (:list 1 (:list 2 2)) 1.0 (:list 1 (:list 3.0 1)) (:list 1 (:list 1 3)))) (:list (:list 4 4) (:list (:list 1 (:list 1.0 1 2)) 1 1 (:list 1 (:list 2.0 2))))))) (:lmidic (:list 6000)) (:lonset (:list 0 500 2750 3000 3250 4250 4500 5000 6000 7500 8000)) (:ldur (:list (:list 499) (:list 2249) (:list 249) (:list 249) (:list 999) (:list 249) (:list 499) (:list 999) (:list 1499) (:list 499))) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 5))) (:connections (:connection (:from (:box 3 :out 0)) (:to (:box 1 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 3 :in 1))) (:connection (:from (:box 5 :out 1)) (:to (:box 3 :in 0)))))
7,789
Common Lisp
.l
342
16.578947
79
0.480596
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
92f1b3dd5ad3f875cbca1577892a595ddb792748007773c6b6aa1df853a56d6c
1,407
[ -1 ]
1,408
01-pulsemaker.opat
cac-t-u-s_om-sharp/help-patches/Score/Trees/01-pulsemaker.opat
(:patch (:name "01-pulsemaker") (:doc "") (:info (:created "2019/09/24 1:37:53") (:modified "2020/01/02 8:47:47") (:by "om-sharp") (:version 1.0)) (:window (:size (1193 440)) (:position (274 253))) (:grid nil) (:lock nil) (:boxes (:box (:type :value) (:reference cons) (:group-id nil) (:name "list") (:x 761) (:y 83) (:w 140) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 3 2 3 5 3 6 2 4 4 1 3 4)) (:id 0)) (:box (:type :abstraction) (:reference (:patch (:name "OMLOOP") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (355 398)) (:position (169 115))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "input0") (:doc "no documentation"))) (:group-id nil) (:name "input0") (:x 167) (:y 0) (:w 56) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 0)) (:box (:type :io) (:reference (:out (:type omout) (:name "output 1") (:index 1) (:doc ""))) (:group-id nil) (:name "output 1") (:x 190) (:y 254) (:w 68) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 1)) (:box (:type :special) (:reference collect) (:group-id nil) (:name "collect") (:x 93) (:y 186) (:w 57) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "data-in") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "push") (:value t) (:reactive nil)) (:input (:type :standard) (:name "init") (:value nil) (:reactive nil))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive nil)) (:output (:name "init") (:reactive nil))) (:id 2)) (:box (:type :special) (:reference repeat-n) (:group-id nil) (:name "repeat-n") (:x 66) (:y 115) (:w 90) (:h 28) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :left) (:lock nil) (:inputs (:input (:type :standard) (:name "self") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "num") (:value 0) (:reactive nil))) (:outputs (:output (:name "collected results") (:reactive nil))) (:id 3)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "aux") (:x 72) (:y 64) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 4)) (:box (:type :special) (:reference iterate) (:group-id nil) (:name "iterate") (:x 24) (:y 257) (:w 57) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 5)) (:box (:type :special) (:reference loop-list) (:group-id nil) (:name "list-loop") (:x 137) (:y 52) (:w 65) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "list") (:value nil) (:reactive nil))) (:outputs (:output (:name "i") (:reactive nil))) (:id 6))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 6 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 2 :out 1)) (:to (:box 1 :in 0))) (:connection (:from (:box 3 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 3 :in 1)))))) (:group-id nil) (:name "OMLOOP") (:x 894) (:y 160) (:w 83) (:h 48) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs (:input (:type :standard) (:name "input0") (:value nil) (:reactive nil))) (:outputs (:output (:name "output 1") (:reactive nil))) (:id 1)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "aux") (:x 813) (:y 178) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 4) (:id 2)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 672) (:y 293) (:w 369) (:h 89) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 250 11.125) (:list 500 14.75) (:list 750 18.375) (:list 1000 22.0) (:list 1250 25.625) (:list 1500 29.25) (:list 1750 32.875) (:list 2000 36.5) (:list 2250 40.125) (:list 2500 43.75) (:list 2750 47.375) (:list 3000 61.0) (:list 3250 64.625) (:list 3500 68.25) (:list 3750 71.875) (:list 4000 75.5) (:list 4250 79.125) (:list 4500 82.75) (:list 4750 86.375) (:list 5000 100.0) (:list 5250 103.625) (:list 5500 107.25) (:list 5750 110.875) (:list 6000 114.5) (:list 6250 118.125) (:list 6500 121.75) (:list 6750 125.375) (:list 7000 129.0) (:list 7250 132.625) (:list 7500 136.25) (:list 7750 139.875) (:list 8000 153.5) (:list 8250 157.125) (:list 8500 160.75) (:list 8750 164.375) (:list 9000 168.0) (:list 9250 171.625) (:list 9500 175.25) (:list 9750 178.875) (:list 10000 182.5) (:list 10250 186.125) (:list 10500 189.75) (:list 10750 193.375) (:list 11000 197.0) (:list 11250 200.625) (:list 11500 204.25) (:list 11750 207.875) (:list 12000 211.5) (:list 12250 215.125) (:list 12500 218.75) (:list 12750 222.375) (:list 13000 236.0) (:list 13250 239.625) (:list 13500 243.25) (:list 13750 246.875) (:list 14000 250.5) (:list 14250 254.125) (:list 14500 257.75) (:list 14750 261.375) (:list 15000 265.0) (:list 15250 268.625) (:list 15500 272.25) (:list 15750 275.875) (:list 16000 289.5) (:list 16250 293.125) (:list 16500 296.75) (:list 16750 300.375) (:list 17000 304.0) (:list 17250 307.625) (:list 17500 311.25) (:list 17750 314.875) (:list 18000 318.5) (:list 18250 322.125) (:list 18500 325.75) (:list 18750 329.375) (:list 19000 333.0) (:list 19250 336.625) (:list 19500 340.25) (:list 19750 343.875) (:list 20000 347.5) (:list 20250 351.125) (:list 20500 354.75) (:list 20750 358.375) (:list 21000 362.0) (:list 21250 365.625) (:list 21500 369.25) (:list 21750 372.875) (:list 22000 386.5) (:list 22250 390.125) (:list 22500 393.75) (:list 22750 397.375) (:list 23000 401.0) (:list 23250 404.625) (:list 23500 408.25) (:list 23750 411.875) (:list 24000 425.5) (:list 24250 429.125) (:list 24500 432.75) (:list 24750 436.375) (:list 25000 440.0) (:list 25250 443.625) (:list 25500 447.25) (:list 25750 450.875) (:list 26000 454.5) (:list 26250 458.125) (:list 26500 461.75) (:list 26750 465.375) (:list 27000 469.0) (:list 27250 472.625) (:list 27500 476.25) (:list 27750 479.875) (:list 28000 489.5) (:list 28250 493.125) (:list 28500 496.75) (:list 28750 500.375) (:list 29000 504.0) (:list 29250 507.625) (:list 29500 511.25) (:list 29750 514.875) (:list 30000 518.5) (:list 30250 522.125) (:list 30500 525.75) (:list 30750 529.375) (:list 31000 533.0) (:list 31250 536.625) (:list 31500 540.25) (:list 31750 543.875) (:list 32000 557.5) (:list 32250 561.125) (:list 32500 564.75) (:list 32750 568.375) (:list 33000 582.0) (:list 33250 585.625) (:list 33500 589.25) (:list 33750 592.875) (:list 34000 596.5) (:list 34250 600.125) (:list 34500 603.75) (:list 34750 607.375) (:list 35000 611.0) (:list 35250 614.625) (:list 35500 618.25) (:list 35750 621.875) (:list 36000 635.5) (:list 36250 639.125) (:list 36500 642.75) (:list 36750 646.375) (:list 37000 650.0) (:list 37250 653.625) (:list 37500 657.25) (:list 37750 660.875) (:list 38000 664.5) (:list 38250 668.125) (:list 38500 671.75) (:list 38750 675.375) (:list 39000 679.0) (:list 39250 682.625) (:list 39500 686.25) (:list 39750 689.875))) (:staff :g)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 39999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 12 (:list (:list (:list 3 4) (:list (:list 3 (:list 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 2 4) (:list (:list 2 (:list 1 1 1 1 1 1 1 1)))) (:list (:list 3 4) (:list (:list 3 (:list 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 5 4) (:list (:list 5 (:list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 3 4) (:list (:list 3 (:list 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 6 4) (:list (:list 6 (:list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 2 4) (:list (:list 2 (:list 1 1 1 1 1 1 1 1)))) (:list (:list 4 4) (:list (:list 4 (:list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 4 4) (:list (:list 4 (:list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 1 4) (:list (:list 1 (:list 1 1 1 1)))) (:list (:list 3 4) (:list (:list 3 (:list 1 1 1 1 1 1 1 1 1 1 1 1)))) (:list (:list 4 4) (:list (:list 4 (:list 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))))))) (:lmidic (:list 6000)) (:lonset (:list 0 250 500 750 1000 1250 1500 1750 2000 2250 2500 2750 3000 3250 3500 3750 4000 4250 4500 4750 5000 5250 5500 5750 6000 6250 6500 6750 7000 7250 7500 7750 8000 8250 8500 8750 9000 9250 9500 9750 10000 10250 10500 10750 11000 11250 11500 11750 12000 12250 12500 12750 13000 13250 13500 13750 14000 14250 14500 14750 15000 15250 15500 15750 16000 16250 16500 16750 17000 17250 17500 17750 18000 18250 18500 18750 19000 19250 19500 19750 20000 20250 20500 20750 21000 21250 21500 21750 22000 22250 22500 22750 23000 23250 23500 23750 24000 24250 24500 24750 25000 25250 25500 25750 26000 26250 26500 26750 27000 27250 27500 27750 28000 28250 28500 28750 29000 29250 29500 29750 30000 30250 30500 30750 31000 31250 31500 31750 32000 32250 32500 32750 33000 33250 33500 33750 34000 34250 34500 34750 35000 35250 35500 35750 36000 36250 36500 36750 37000 37250 37500 37750 38000 38250 38500 38750 39000 39250 39500 39750 40000)) (:ldur (:list 249)) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 3)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 906) (:y 119) (:w 60) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 4) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :function) (:reference pulsemaker) (:group-id nil) (:name "pulsemaker") (:x 733) (:y 218) (:w 193) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "MEASURES") (:value (:list 4 4)) (:reactive nil)) (:input (:type :standard) (:name "BEAT-UNIT") (:value (:list 8 8)) (:reactive nil)) (:input (:type :standard) (:name "N-PULSES") (:value (:list 4 (:list 1 1 1 1))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 5)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "aux1") (:x 932) (:y 83) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 4) (:id 6)) (:box (:type :function) (:reference pulsemaker) (:group-id nil) (:name "pulsemaker") (:x 224) (:y 211) (:w 95) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "MEASURES") (:value (:list 4 4)) (:reactive nil)) (:input (:type :standard) (:name "BEAT-UNIT") (:value (:list 4 4)) (:reactive nil)) (:input (:type :standard) (:name "N-PULSES") (:value (:list 4 (:list 1 1 1 1))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 7)) (:comment (:x 90) (:y 22) (:w 457) (:h 96) (:fgcolor (:color 64/85 1/15 2/51 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 18) (:style :plain))) (:align nil) (:text "Constructs a tree starting with a list of measures numerators <measures-num> and measures denominators <beat-unit> filling these measures with n-beats <npulses>") (:id 8)) (:comment (:x 333) (:y 130) (:w 90) (:h 40) (:fgcolor (:color 194/255 7/85 2/51 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "Pulses frequencies") (:id 9)) (:comment (:x 235) (:y 130) (:w 90) (:h 40) (:fgcolor (:color 194/255 7/85 2/51 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "Measures denominators") (:id 10)) (:comment (:x 136) (:y 130) (:w 80) (:h 40) (:fgcolor (:color 194/255 7/85 2/51 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "Measures numerators") (:id 11)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "aux1") (:x 333) (:y 170) (:w 74) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 2 3 4 5 6 7)) (:id 12)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "aux") (:x 235) (:y 170) (:w 74) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 8 8 8 8 8 8)) (:id 13)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 10) (:y 300) (:w 550) (:h 84) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 500 11.75) (:list 1000 22.0) (:list 1333 25.833334) (:list 1667 29.666668) (:list 2000 43.5) (:list 2375 47.4375) (:list 2750 51.375) (:list 3125 55.3125) (:list 3500 69.25) (:list 3900 73.25) (:list 4300 77.25) (:list 4700 81.25) (:list 5100 85.25) (:list 5500 99.25) (:list 5917 103.291664) (:list 6333 107.33333) (:list 6750 111.37499) (:list 7167 115.41666) (:list 7583 119.45832) (:list 8000 133.49999) (:list 8071 136.67856) (:list 8143 139.85713) (:list 8214 143.0357) (:list 8286 146.21428) (:list 8357 149.39286) (:list 8429 152.57143))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 8499) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 6 (:list (:list (:list 2 8) (:list (:list 2 (:list 1 1)))) (:list (:list 2 8) (:list (:list 2 (:list 1 1 1)))) (:list (:list 3 8) (:list (:list 3 (:list 1 1 1 1)))) (:list (:list 4 8) (:list (:list 4 (:list 1 1 1 1 1)))) (:list (:list 5 8) (:list (:list 5 (:list 1 1 1 1 1 1)))) (:list (:list 1 8) (:list (:list 1 (:list 1 1 1 1 1 1 1))))))) (:lmidic (:list 6000)) (:lonset (:list 0 500 1000 1333 1667 2000 2375 2750 3125 3500 3900 4300 4700 5100 5500 5917 6333 6750 7167 7583 8000 8071 8143 8214 8286 8357 8429 8500)) (:ldur (:list (:list 499) (:list 499) (:list 332) (:list 333) (:list 332) (:list 374) (:list 374) (:list 374) (:list 374) (:list 399) (:list 399) (:list 399) (:list 399) (:list 399) (:list 416) (:list 415) (:list 416) (:list 416) (:list 415) (:list 416) (:list 70) (:list 71) (:list 70) (:list 71) (:list 70) (:list 71) (:list 70))) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 14)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "aux3") (:x 136) (:y 140) (:w 81) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 2 2 3 4 5 1)) (:id 15))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 0 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 5 :in 2))) (:connection (:from (:box 2 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 1 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 3 :in 1))) (:connection (:from (:box 6 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 7 :out 0)) (:to (:box 14 :in 1))) (:connection (:from (:box 12 :out 0)) (:to (:box 7 :in 2))) (:connection (:from (:box 13 :out 0)) (:to (:box 7 :in 1))) (:connection (:from (:box 15 :out 0)) (:to (:box 7 :in 0)))))
25,934
Common Lisp
.l
1,150
15.506087
85
0.468044
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
659b2e6064be1e8c8f9fe2d5bfcd701b40bbf9049e0ca0da7b3d1caf071ba95f
1,408
[ -1 ]
1,409
11-pulse_and_rests_pos.opat
cac-t-u-s_om-sharp/help-patches/Score/Trees/11-pulse_and_rests_pos.opat
(:patch (:name "11-pulse_and_rests_pos") (:doc "") (:info (:created "2019/09/24 1:37:56") (:modified "2020/01/02 8:47:47") (:by "om-sharp") (:version 1.0)) (:window (:size (869 583)) (:position (685 74))) (:grid nil) (:lock nil) (:boxes (:comment (:x 44) (:y 308) (:w 212) (:h 40) (:fgcolor (:color 26/255 41/255 2/3 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "Outputs a list of positions of pulses in the tree. (0 being first position)") (:id 0)) (:box (:type :function) (:reference length) (:group-id nil) (:name "length") (:x 455) (:y 238) (:w 69) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SEQUENCE") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :function) (:reference arithm-ser) (:group-id nil) (:name "arithm-ser") (:x 481) (:y 287) (:w 89) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "BEGIN") (:value 1) (:reactive nil)) (:input (:type :standard) (:name "END") (:value 10) (:reactive nil)) (:input (:type :standard) (:name "STEP") (:value 1) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:comment (:x 588) (:y 272) (:w 208) (:h 87) (:fgcolor (:color 26/255 41/255 2/3 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "Here as an example we augment rests progressively using the ratio rhythm notation") (:id 3)) (:comment (:x 569) (:y 30) (:w 222) (:h 163) (:fgcolor (:color 191/255 2/15 2/17 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 18) (:style :plain))) (:align nil) (:text "get-pulse-places : Returns the nth position of pulses in a tree get-rest-places tree: Returns the nth position of rests in a tree") (:id 4)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "list") (:x 86) (:y 245) (:w 128) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs (:input (:type :optional) (:name "in") (:value nil) (:reactive nil))) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 0 2 4 6 8 10 12 14 16)) (:id 5)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 43) (:y 459) (:w 690) (:h 73) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 250 10.625) (:list 500 14.75) (:list 1000 19.0) (:list 1750 22.75) (:list 2000 26.375) (:list 2250 30.5) (:list 3000 34.875) (:list 3750 40.25) (:list 4000 49.375) (:list 5000 55.375) (:list 5750 59.75) (:list 6000 63.375) (:list 7000 69.375) (:list 7250 72.5) (:list 8000 83.375) (:list 8750 88.75) (:list 9000 92.375) (:list 9500 95.5) (:list 10000 99.75) (:list 11000 105.25) (:list 11250 109.375) (:list 12000 120.25) (:list 12500 124.625) (:list 13000 128.875) (:list 14000 134.375) (:list 14500 139.125) (:list 15000 142.875))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 14999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 4 (:list (:list (:list 4 4) (:list (:list 1 (:list 1 -1 2)) (:list 1 (:list 3.0 -1)) (:list 1 (:list -1 3)) (:list 1 (:list -3 1)))) (:list (:list 4 4) (:list -1 (:list 1 (:list 3 -1)) -1 (:list 1 (:list 1 -3)))) (:list (:list 4 4) (:list (:list 1 (:list -3 1)) (:list 1 (:list 1.0 -1)) -1 (:list 1 (:list -1 3)))) (:list (:list 4 4) (:list (:list 1 (:list 1.0 -1)) -1 (:list 1 (:list -1 1)) -1))))) (:lmidic (:list 6000)) (:lonset (:list 0 500 2250 3750 5000 7000 8750 11250 14500 16000)) (:ldur (:list (:list 249) (:list 1249) (:list 749) (:list 249) (:list 749) (:list 249) (:list 749) (:list 1249) (:list 499))) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 6)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 388) (:y 344) (:w 106) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 7)) (:box (:type :function) (:reference posn-match) (:group-id nil) (:name "posn-match") (:x 312) (:y 287) (:w 96) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "LIST") (:value (:list 10 20 30 40 50 60 70 80 90)) (:reactive nil)) (:input (:type :standard) (:name "POSITIONS") (:value (:list (:list 0 1) 4 (:list 6))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :function) (:reference subs-posn) (:group-id nil) (:name "subs-posn") (:x 191) (:y 391) (:w 304) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "LIS1") (:value (:list 0 1 2 3)) (:reactive nil)) (:input (:type :standard) (:name "POSN") (:value (:list 1 3)) (:reactive nil)) (:input (:type :standard) (:name "VAL") (:value (:list a b)) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 9)) (:box (:type :function) (:reference tree2ratio) (:group-id nil) (:name "tree2ratio") (:x 242) (:y 196) (:w 87) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TREE") (:value ?) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 10)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 19) (:y 34) (:w 537) (:h 111) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 -2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 250 10.625) (:list 500 14.75) (:list 1000 19.0) (:list 1750 22.75) (:list 2000 26.875) (:list 2750 31.25) (:list 3000 35.375) (:list 3250 38.5) (:list 3500 42.625) (:list 4000 52.875) (:list 4250 56.625) (:list 4500 60.75) (:list 4750 63.875) (:list 5000 68.0) (:list 5750 72.375) (:list 6000 76.5) (:list 7000 82.0) (:list 7250 87.0) (:list 7500 91.125))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 7999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 2 (:list (:list (:list 4 4) (:list (:list 1 (:list 1 -1 2)) (:list 1 (:list 3.0 -1)) (:list 1 (:list 3 -1)) (:list 1 (:list 1 -1 2)))) (:list (:list 4 4) (:list (:list 1 (:list 1.0 -1 1 -1)) (:list 1 (:list 3 -1)) 1 (:list 1 (:list 1.0 -1 2))))))) (:lmidic (:list 6000)) (:lonset (:list 0 500 2000 3000 3500 4500 5000 6000 7500 8000)) (:ldur (:list (:list 249) (:list 1249) (:list 749) (:list 249) (:list 749) (:list 249) (:list 749) (:list 1249) (:list 499))) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 11)) (:box (:type :function) (:reference get-rest-places) (:group-id nil) (:name "get-rest-places") (:x 358) (:y 196) (:w 110) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value (:list ? (:list (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2 1 1)) 1 1)) (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 12)) (:box (:type :function) (:reference get-pulse-places) (:group-id nil) (:name "get-pulse-places") (:x 91) (:y 196) (:w 118) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value (:list ? (:list (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2 1 1)) 1 1)) (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 13))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 2 :in 1))) (:connection (:from (:box 2 :out 0)) (:to (:box 7 :in 1))) (:connection (:from (:box 7 :out 0)) (:to (:box 9 :in 2))) (:connection (:from (:box 8 :out 0)) (:to (:box 7 :in 0))) (:connection (:from (:box 9 :out 0)) (:to (:box 6 :in 1))) (:connection (:from (:box 10 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 10 :out 0)) (:to (:box 9 :in 0))) (:connection (:from (:box 11 :out 1)) (:to (:box 10 :in 0))) (:connection (:from (:box 11 :out 1)) (:to (:box 12 :in 0))) (:connection (:from (:box 11 :out 1)) (:to (:box 13 :in 0))) (:connection (:from (:box 12 :out 0)) (:to (:box 1 :in 0))) (:connection (:from (:box 12 :out 0)) (:to (:box 8 :in 1))) (:connection (:from (:box 12 :out 0)) (:to (:box 9 :in 1))) (:connection (:from (:box 13 :out 0)) (:to (:box 5 :in 0)))))
13,831
Common Lisp
.l
612
16.937908
71
0.492208
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
21ebb614047aab791018da80232c10c7b7516217564a418e0bc55bedd393d860
1,409
[ -1 ]
1,410
10-n-pulses_group-pulses.opat
cac-t-u-s_om-sharp/help-patches/Score/Trees/10-n-pulses_group-pulses.opat
(:patch (:name "10-n-pulses_group-pulses") (:doc "") (:info (:created "2019/09/24 1:37:54") (:modified "2020/01/02 8:47:47") (:by "om-sharp") (:version 1.0)) (:window (:size (470 470)) (:position (295 276))) (:grid nil) (:lock nil) (:boxes (:comment (:x 64) (:y 40) (:w 353) (:h 137) (:fgcolor (:color 40/51 10/51 2/17 1.0)) (:bgcolor nil) (:border 0) (:roundness nil) (:text-font (:font (:face "Arial") (:size 12) (:style :plain))) (:align nil) (:text "n-pulses : Returns the number of pulses in a tree (pulses meaning expressed notes meaning all but rests and tied notes) group-pulses : Returns a list of list where each list \"groups\" all expressed notes with potential tied notes and rests") (:id 0)) (:box (:type :function) (:reference group-pulses) (:group-id nil) (:name "group-pulses") (:x 232) (:y 331) (:w 101) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2.0 1.0 1)) 1 1)) (:list (:list 4 4) (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :object) (:reference voice) (:group-id nil) (:name "VOICE") (:x 28) (:y 183) (:w 387) (:h 77) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 1 1 1))))) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "TEMPO") (:value 60) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "TREE") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "TEMPO") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params (:time-map (:list (:list -1000 0) (:list 0 7.5) (:list 1000 13.0) (:list 4000 24.5) (:list 4444 28.61111) (:list 4889 32.72222) (:list 5333 36.833332) (:list 5778 40.444443) (:list 6222 45.055554) (:list 6667 49.166665) (:list 8000 61.499997))) (:staff :empty)) (:value (:object (:class voice) (:slots ((:onset 0) (:duration 11999) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "VOICE") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:tree (:list 3 (:list (:list (:list 4 4) (:list 1 3.0)) (:list (:list 4 4) (:list (:list 4 (:list (:list 1 (:list 1 1 1)) (:list 1 (:list 1.0 -1 1)) 1)))) (:list (:list 4 4) (:list 4))))) (:lmidic (:list (:list 6200) (:list 6000) (:list 6000) (:list 6000) (:list 6000) (:list 6000) (:list 6000))) (:lonset (:list 0 4000 4444 4889 6222 6667 8000 12000)) (:ldur (:list (:list 3999) (:list 443) (:list 444) (:list 888) (:list 444) (:list 1332) (:list 3999))) (:lvel (:list (:list 100) (:list 80) (:list 80) (:list 80) (:list 80) (:list 80) (:list 80))) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil) (:tempo 60))))) (:id 2)) (:box (:type :function) (:reference n-pulses) (:group-id nil) (:name "n-pulses") (:x 100) (:y 331) (:w 79) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TREE") (:value (:list ? (:list (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) 1 1)) (:list |4//4| (:list 1 (:list 1 (:list 1 2 1 1)) -1 1))))) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 3))) (:connections (:connection (:from (:box 2 :out 1)) (:to (:box 1 :in 0)) (:attributes (:color (:color 1.0 0.0 0.0 1.0) :style nil :modif nil))) (:connection (:from (:box 2 :out 1)) (:to (:box 3 :in 0)) (:attributes (:color (:color 1.0 0.0 0.0 1.0) :style nil :modif nil)))))
5,218
Common Lisp
.l
224
16.875
73
0.481875
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
11f8af47f7371c37434642744dbf6480ad257f99d940814b1b34f731fe307235
1,410
[ -1 ]
1,411
osc-bundles.opat
cac-t-u-s_om-sharp/help-patches/OSC/osc-bundles.opat
(:patch (:name "osc-bundles") (:doc "") (:info (:created "2019/09/15 10:06:59") (:modified "2022/03/27 23:40:08") (:by "om-sharp") (:version 1.06)) (:window (:size (928 502)) (:position (93 170))) (:grid nil) (:lock nil) (:boxes (:box (:type :object) (:reference osc-bundle) (:group-id nil) (:name nil) (:x 110) (:y 114) (:w 114) (:h 63) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ONSET") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "MESSAGES") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "ONSET") (:reactive nil)) (:output (:name "MESSAGES") (:reactive nil))) (:window (:size (210 216)) (:position (346 447))) (:edition-params) (:value (:object (:class osc-bundle) (:slots ((:onset 0) (:item-internal-time nil) (:item-type nil) (:attributes nil) (:messages (:list (:list "/foo" 5 6 7) (:list "/test" 999))))))) (:id 0)) (:box (:type :function) (:reference osc-set) (:group-id nil) (:name "osc-set") (:x 250) (:y 194) (:w 80) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "VALUE") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 264) (:y 156) (:w 51) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/test") (:id 2)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 322) (:y 156) (:w 36) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 111) (:id 3)) (:box (:type :object) (:reference osc-bundle) (:group-id nil) (:name nil) (:x 120) (:y 234) (:w 113) (:h 81) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ONSET") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "MESSAGES") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "ONSET") (:reactive nil)) (:output (:name "MESSAGES") (:reactive nil))) (:window (:size (336 307)) (:position (149 138))) (:edition-params) (:value (:object (:class osc-bundle) (:slots ((:onset 0) (:item-internal-time nil) (:item-type nil) (:attributes nil) (:messages (:list (:list "/foo" 5 6 7) (:list "/test" 111))))))) (:id 4)) (:box (:type :function) (:reference osc-get) (:group-id nil) (:name "osc-get") (:x 242) (:y 370) (:w 80) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 5)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 274) (:y 334) (:w 51) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/test") (:id 6)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 259) (:y 416) (:w 46) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "in") (:value nil) (:reactive nil))) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 111)) (:id 7)) (:box (:type :function) (:reference osc-send) (:group-id nil) (:name "osc-send") (:x 124) (:y 370) (:w 88) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "BUNDLE") (:value (:list "/test" 0)) (:reactive nil)) (:input (:type :standard) (:name "HOST") (:value "127.0.0.1") (:reactive nil)) (:input (:type :standard) (:name "PORT") (:value 3000) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:comment (:x 21) (:y 118) (:w 85) (:h 22) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "OSC-BUNDLE") (:id 9)) (:comment (:x 110) (:y 12) (:w 118) (:h 29) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Consolas") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "OSC-BUNDLE ") (:id 10)) (:comment (:x 265) (:y 266) (:w 85) (:h 36) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "get/set utilities") (:id 11)) (:comment (:x 112) (:y 410) (:w 126) (:h 36) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "OSC-SEND also sends OSC bundles") (:id 12)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 102) (:y 79) (:w 199) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list (:list "/foo" 5 6 7) (:list "/test" 999))) (:id 13)) (:box (:type :object) (:reference osc-bundle) (:group-id nil) (:name nil) (:x 520) (:y 223) (:w 114) (:h 63) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ONSET") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "MESSAGES") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "ONSET") (:reactive nil)) (:output (:name "MESSAGES") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params) (:value (:object (:class osc-bundle) (:slots ((:onset 0) (:item-internal-time nil) (:item-type nil) (:attributes nil) (:messages (:list (:list "/foo" 5 6 7) (:list "/test" 999))))))) (:id 14)) (:box (:type :function) (:reference osc-msg) (:group-id nil) (:name "osc-msg") (:x 515) (:y 135) (:w 85) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 15)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 512) (:y 105) (:w 54) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/foo") (:id 16)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 546) (:y 73) (:w 60) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 5 6 7)) (:id 17)) (:box (:type :function) (:reference osc-msg) (:group-id nil) (:name "osc-msg") (:x 624) (:y 136) (:w 85) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 18)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id nil) (:name "value box") (:x 618) (:y 72) (:w 60) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/test") (:id 19)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 661) (:y 102) (:w 49) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 999) (:id 20)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 586) (:y 177) (:w 62) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 21)) (:comment (:x 719) (:y 142) (:w 137) (:h 36) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "<= utility to format OSC messages") (:id 22))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 1 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 1 :in 1))) (:connection (:from (:box 3 :out 0)) (:to (:box 1 :in 2))) (:connection (:from (:box 4 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 7 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 13 :out 0)) (:to (:box 0 :in 2))) (:connection (:from (:box 15 :out 0)) (:to (:box 21 :in 0))) (:connection (:from (:box 16 :out 0)) (:to (:box 15 :in 0))) (:connection (:from (:box 17 :out 0)) (:to (:box 15 :in 1))) (:connection (:from (:box 18 :out 0)) (:to (:box 21 :in 1))) (:connection (:from (:box 19 :out 0)) (:to (:box 18 :in 0))) (:connection (:from (:box 20 :out 0)) (:to (:box 18 :in 1))) (:connection (:from (:box 21 :out 0)) (:to (:box 14 :in 2)))))
13,445
Common Lisp
.l
636
16.761006
71
0.526583
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
47870635e65c0da10d15da021f8d1b8b507b43582578e4ba707b317a90db61fa
1,411
[ -1 ]
1,412
osc-bundle-data-track.opat
cac-t-u-s_om-sharp/help-patches/OSC/osc-bundle-data-track.opat
(:patch (:name "osc-bundle-data-track") (:doc "") (:info (:created "2019/09/15 10:06:59") (:modified "2022/04/15 10:15:16") (:by "om-sharp") (:version 1.06)) (:window (:size (637 564)) (:position (525 188))) (:grid nil) (:lock nil) (:boxes (:comment (:x 90) (:y 20) (:w 266) (:h 29) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Consolas") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "OSC-BUNDLEs in DATA-TRACK") (:id 0)) (:box (:type :object) (:reference bpc) (:group-id 0) (:name "BPC") (:x 183) (:y 118) (:w 181) (:h 63) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font (:font (:face "Verdana") (:size 10) (:style :italic))) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "X-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Y-POINTS") (:value nil) (:reactive nil)) (:input (:type :key) (:name "times") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "X-POINTS") (:reactive nil)) (:output (:name "Y-POINTS") (:reactive nil)) (:output (:name "times") (:reactive nil))) (:window (:size (791 558)) (:position (106 92))) (:edition-params (:show-timeline t)) (:value (:object (:class bpc) (:slots ((:times (:list 0 233 263 277 311 328 340 354 373 390 401 416 452 490 500 515 534 546 563 575 600 628 631 663 668 694 696 729 734 762 764 780 801 810 824 856 891 905 921 935 953 964 990 998 1021 1027 1053 1059 1084 1090 1122 1125 1155 1158 1183 1184 1234 1281 1332 1377 1420 1451 1481 1520 1546 1578 1605 1612 1638 1643 1673 1674 1702 1703 1736)) (:onset 0) (:duration 1736) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color nil) (:decimals 2) (:x-points (:list -4.21 -4.21 -4.21 -4.21 -4.21 -4.19 -4.19 -4.14 -4.09 -4.04 -3.99 -3.92 -3.74 -3.52 -3.35 -3.23 -3.03 -2.83 -2.53 -2.36 -2.19 -1.99 -1.89 -1.84 -1.79 -1.77 -1.75 -1.75 -1.75 -1.75 -1.75 -1.75 -1.72 -1.7 -1.67 -1.55 -1.28 -1.1 -0.88 -0.59 -0.27 0.13 0.77 1.04 1.66 2.15 2.62 3.11 3.31 3.68 3.95 4.05 4.2 4.3 4.37 4.37 4.37 4.27 4.13 4.03 4.03 4.05 4.22 4.42 4.62 4.79 4.87 4.96 5.04 5.16 5.24 5.33 5.43 5.53 5.75)) (:y-points (:list 0.94 1.29 1.79 2.19 2.72 3.15 3.44 3.76 4.01 4.23 4.44 4.62 4.91 5.12 5.19 5.23 5.26 5.26 5.26 5.12 4.94 4.58 4.37 4.12 3.91 3.69 3.44 3.23 3.01 2.8 2.55 2.33 2.15 1.97 1.79 1.51 1.22 1.11 1.04 1.01 0.97 0.97 1.01 1.15 1.47 1.87 2.3 2.87 3.12 3.62 4.12 4.33 4.69 4.98 5.23 5.44 5.73 5.87 5.87 5.66 5.37 5.16 4.94 4.76 4.55 4.33 4.16 3.98 3.8 3.4 3.12 2.76 2.4 1.94 1.04)))) (:add-slots ((:name "BPC"))))) (:id 1)) (:box (:type :abstraction) (:reference (:patch (:name "make-osc-bundle") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (386 328)) (:position (127 115))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 1) (:doc ""))) (:group-id 0) (:name "out") (:x 82) (:y 266) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 0)) (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "X") (:doc ""))) (:group-id 0) (:name "X") (:x 177) (:y 0) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "Y") (:doc ""))) (:group-id 0) (:name "Y") (:x 267) (:y 0) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "DATE") (:doc ""))) (:group-id 0) (:name "DATE") (:x 88) (:y 130) (:w 52) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:reactive nil) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 3)) (:box (:type :object) (:reference osc-bundle) (:group-id 0) (:name "OSC-BUNDLE") (:x 56) (:y 187) (:w 163) (:h 62) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font (:font (:face "Verdana") (:size 10) (:style :italic))) (:align :center) (:display :hidden) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "ONSET") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "MESSAGES") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "ONSET") (:reactive nil)) (:output (:name "MESSAGES") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class osc-bundle) (:slots ((:onset 0) (:item-internal-time nil) (:item-type nil) (:attributes nil) (:messages nil))))) (:id 4)) (:box (:type :function) (:reference osc-msg) (:group-id 0) (:name "osc-msg") (:x 136) (:y 75) (:w 85) (:h 29) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 5)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id 0) (:name "vb") (:x 142) (:y 40) (:w 37) (:h 30) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/x") (:id 6)) (:box (:type :function) (:reference osc-msg) (:group-id 0) (:name "osc-msg") (:x 226) (:y 75) (:w 85) (:h 29) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ADDRESS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 7)) (:box (:type :value) (:reference (:symbol "SIMPLE-TEXT-STRING" "LISPWORKS")) (:group-id 0) (:name "vb") (:x 231) (:y 40) (:w 38) (:h 30) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "/y") (:id 8)) (:box (:type :function) (:reference list) (:group-id 0) (:name "list") (:x 162) (:y 120) (:w 62) (:h 29) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 9)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 292) (:y 40) (:w 56) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 10) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 10))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 5 :in 1)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 2 :out 0)) (:to (:box 10 :in 1))) (:connection (:from (:box 3 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 0 :in 0)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 5 :out 0)) (:to (:box 9 :in 0)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 0)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 7 :out 0)) (:to (:box 9 :in 1)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 8 :out 0)) (:to (:box 7 :in 0)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 9 :out 0)) (:to (:box 4 :in 2))) (:connection (:from (:box 10 :out 0)) (:to (:box 7 :in 1)))))) (:group-id 0) (:name "make-osc-bundle") (:x 90) (:y 204) (:w 141) (:h 28) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:pre-delay 0) (:lock nil) (:lambda :lambda) (:reactive nil) (:inputs (:input (:type :standard) (:name "X") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Y") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATE") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:box (:type :function) (:reference mapcar) (:group-id 0) (:name "mapcar") (:x 183) (:y 247) (:w 181.19091796875D0) (:h 29) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font nil) (:align :left) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "FUNCTION") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LIST") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "more-lists") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "more-lists") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 3)) (:box (:type :object) (:reference data-track) (:group-id 0) (:name "DATA-TRACK") (:x 113) (:y 312) (:w 312) (:h 74) (:color (:color 0.9 0.9 0.9 1.0)) (:border 1.5) (:roundness nil) (:text-font (:font (:face "Verdana") (:size 10) (:style :italic))) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FRAMES") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "FRAMES") (:reactive nil))) (:window (:size (1093 638)) (:position (462 221))) (:edition-params (:show-timeline t) (:display-mode :bubbles)) (:value (:object (:class data-track) (:slots ((:onset 0) (:duration 1852) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:default-frame-type osc-bundle) (:frames (:list (:object (:class osc-bundle) (:slots ((:onset 0) (:item-internal-time 0) (:item-type :master) (:attributes (:list :color (:color 0.7103362 0.09244549 0.8304206 0.4))) (:messages (:list (:list "/x" -4.21) (:list "/y" 9.400001)))))) (:object (:class osc-bundle) (:slots ((:onset 233) (:item-internal-time 233) (:item-type 233) (:attributes (:list :color (:color 0.91161907 0.5072539 0.8425404 0.4))) (:messages (:list (:list "/x" -4.21) (:list "/y" 12.9)))))) (:object (:class osc-bundle) (:slots ((:onset 263) (:item-internal-time 263) (:item-type 263) (:attributes (:list :color (:color 0.4120891 0.8118981 0.21595311 0.4))) (:messages (:list (:list "/x" -4.21) (:list "/y" 17.9)))))) (:object (:class osc-bundle) (:slots ((:onset 277) (:item-internal-time 277) (:item-type 277) (:attributes (:list :color (:color 0.18855453 0.038866997 0.13399446 0.4))) (:messages (:list (:list "/x" -4.21) (:list "/y" 21.900002)))))) (:object (:class osc-bundle) (:slots ((:onset 311) (:item-internal-time 311) (:item-type 311) (:attributes (:list :color (:color 0.21155203 0.35869277 0.4170823 0.4))) (:messages (:list (:list "/x" -4.21) (:list "/y" 27.2)))))) (:object (:class osc-bundle) (:slots ((:onset 328) (:item-internal-time 328) (:item-type 328) (:attributes (:list :color (:color 0.32878077 0.36451232 0.24246216 0.4))) (:messages (:list (:list "/x" -4.19) (:list "/y" 31.5)))))) (:object (:class osc-bundle) (:slots ((:onset 340) (:item-internal-time 340) (:item-type 340) (:attributes (:list :color (:color 0.323887 0.24507177 0.97548867 0.4))) (:messages (:list (:list "/x" -4.19) (:list "/y" 34.4)))))) (:object (:class osc-bundle) (:slots ((:onset 354) (:item-internal-time 354) (:item-type 354) (:attributes (:list :color (:color 0.13770664 0.7153096 0.695402 0.4))) (:messages (:list (:list "/x" -4.14) (:list "/y" 37.6)))))) (:object (:class osc-bundle) (:slots ((:onset 373) (:item-internal-time 373) (:item-type 373) (:attributes (:list :color (:color 0.2636739 0.60708225 0.31360137 0.4))) (:messages (:list (:list "/x" -4.09) (:list "/y" 40.100003)))))) (:object (:class osc-bundle) (:slots ((:onset 390) (:item-internal-time 390) (:item-type 390) (:attributes (:list :color (:color 0.06074238 0.8443891 0.8955841 0.4))) (:messages (:list (:list "/x" -4.04) (:list "/y" 42.3)))))) (:object (:class osc-bundle) (:slots ((:onset 401) (:item-internal-time 401) (:item-type 401) (:attributes (:list :color (:color 0.62878824 0.20871938 0.08935416 0.4))) (:messages (:list (:list "/x" -3.99) (:list "/y" 44.4)))))) (:object (:class osc-bundle) (:slots ((:onset 416) (:item-internal-time 416) (:item-type 416) (:attributes (:list :color (:color 0.35760605 0.80237806 0.38352144 0.4))) (:messages (:list (:list "/x" -3.92) (:list "/y" 46.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 452) (:item-internal-time 452) (:item-type 452) (:attributes (:list :color (:color 0.86983407 0.38996136 0.0877341 0.4))) (:messages (:list (:list "/x" -3.74) (:list "/y" 49.1)))))) (:object (:class osc-bundle) (:slots ((:onset 490) (:item-internal-time 490) (:item-type 490) (:attributes (:list :color (:color 0.6077608 0.9512862 0.29630828 0.4))) (:messages (:list (:list "/x" -3.52) (:list "/y" 51.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 500) (:item-internal-time 500) (:item-type 500) (:attributes (:list :color (:color 0.51841796 0.19540978 0.043109656 0.4))) (:messages (:list (:list "/x" -3.35) (:list "/y" 51.9)))))) (:object (:class osc-bundle) (:slots ((:onset 515) (:item-internal-time 515) (:item-type 515) (:attributes (:list :color (:color 0.5493443 0.49105358 0.13313329 0.4))) (:messages (:list (:list "/x" -3.23) (:list "/y" 52.3)))))) (:object (:class osc-bundle) (:slots ((:onset 534) (:item-internal-time 534) (:item-type 534) (:attributes (:list :color (:color 0.70353747 0.65872324 0.5660064 0.4))) (:messages (:list (:list "/x" -3.03) (:list "/y" 52.600003)))))) (:object (:class osc-bundle) (:slots ((:onset 546) (:item-internal-time 546) (:item-type 546) (:attributes (:list :color (:color 0.26538205 0.63433695 0.34550285 0.4))) (:messages (:list (:list "/x" -2.83) (:list "/y" 52.600003)))))) (:object (:class osc-bundle) (:slots ((:onset 563) (:item-internal-time 563) (:item-type 563) (:attributes (:list :color (:color 0.9190558 0.18179965 0.18802667 0.4))) (:messages (:list (:list "/x" -2.53) (:list "/y" 52.600003)))))) (:object (:class osc-bundle) (:slots ((:onset 600) (:item-internal-time 600) (:item-type 600) (:attributes (:list :color (:color 0.7139971 0.89077557 0.71237445 0.4))) (:messages (:list (:list "/x" -2.36) (:list "/y" 51.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 661) (:item-internal-time 661) (:item-type 661) (:attributes (:list :color (:color 0.13984096 0.3351755 0.6524124 0.4))) (:messages (:list (:list "/x" -1.99) (:list "/y" 45.8)))))) (:object (:class osc-bundle) (:slots ((:onset 662) (:item-internal-time 662) (:item-type 662) (:attributes (:list :color (:color 0.8020507 0.8996322 0.82371414 0.4))) (:messages (:list (:list "/x" -2.19) (:list "/y" 49.4)))))) (:object (:class osc-bundle) (:slots ((:onset 673) (:item-internal-time 673) (:item-type 673) (:attributes (:list :color (:color 0.40696204 0.40180266 0.96642685 0.4))) (:messages (:list (:list "/x" -1.89) (:list "/y" 43.699997)))))) (:object (:class osc-bundle) (:slots ((:onset 677) (:item-internal-time 677) (:item-type 677) (:attributes (:list :color (:color 0.81983436 0.49764562 0.9459996 0.4))) (:messages (:list (:list "/x" -1.84) (:list "/y" 41.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 694) (:item-internal-time 694) (:item-type 694) (:attributes (:list :color (:color 0.7720436 0.06081271 0.6144581 0.4))) (:messages (:list (:list "/x" -1.77) (:list "/y" 36.9)))))) (:object (:class osc-bundle) (:slots ((:onset 696) (:item-internal-time 696) (:item-type 696) (:attributes (:list :color (:color 0.44547355 0.79510916 0.0275985 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 34.4)))))) (:object (:class osc-bundle) (:slots ((:onset 725) (:item-internal-time 725) (:item-type 725) (:attributes (:list :color (:color 0.9826102 0.8110784 0.24087072 0.4))) (:messages (:list (:list "/x" -1.79) (:list "/y" 39.100003)))))) (:object (:class osc-bundle) (:slots ((:onset 729) (:item-internal-time 729) (:item-type 729) (:attributes (:list :color (:color 0.9515182 0.55676377 0.6976348 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 32.3)))))) (:object (:class osc-bundle) (:slots ((:onset 734) (:item-internal-time 734) (:item-type 734) (:attributes (:list :color (:color 0.5284207 0.03243351 0.22919512 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 30.1)))))) (:object (:class osc-bundle) (:slots ((:onset 762) (:item-internal-time 762) (:item-type 762) (:attributes (:list :color (:color 0.69278157 0.45479047 0.7904835 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 28.0)))))) (:object (:class osc-bundle) (:slots ((:onset 764) (:item-internal-time 764) (:item-type 764) (:attributes (:list :color (:color 0.27163696 0.35638845 0.90756846 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 25.5)))))) (:object (:class osc-bundle) (:slots ((:onset 780) (:item-internal-time 780) (:item-type 780) (:attributes (:list :color (:color 0.10540664 0.89728606 0.27891874 0.4))) (:messages (:list (:list "/x" -1.75) (:list "/y" 23.3)))))) (:object (:class osc-bundle) (:slots ((:onset 801) (:item-internal-time 801) (:item-type 801) (:attributes (:list :color (:color 0.32949638 0.43628073 0.8151535 0.4))) (:messages (:list (:list "/x" -1.72) (:list "/y" 21.5)))))) (:object (:class osc-bundle) (:slots ((:onset 810) (:item-internal-time 810) (:item-type 810) (:attributes (:list :color (:color 0.61015726 0.105511666 0.5786071 0.4))) (:messages (:list (:list "/x" -1.7) (:list "/y" 19.7)))))) (:object (:class osc-bundle) (:slots ((:onset 824) (:item-internal-time 824) (:item-type 824) (:attributes (:list :color (:color 0.49864662 0.686322 0.51752484 0.4))) (:messages (:list (:list "/x" -1.67) (:list "/y" 17.9)))))) (:object (:class osc-bundle) (:slots ((:onset 856) (:item-internal-time 856) (:item-type 856) (:attributes (:list :color (:color 0.8221458 0.331972 0.87392354 0.4))) (:messages (:list (:list "/x" -1.55) (:list "/y" 15.1)))))) (:object (:class osc-bundle) (:slots ((:onset 891) (:item-internal-time 891) (:item-type 891) (:attributes (:list :color (:color 0.95148957 0.410995 0.88080824 0.4))) (:messages (:list (:list "/x" -1.28) (:list "/y" 12.200001)))))) (:object (:class osc-bundle) (:slots ((:onset 905) (:item-internal-time 905) (:item-type 905) (:attributes (:list :color (:color 0.1687876 0.6812593 0.9840114 0.4))) (:messages (:list (:list "/x" -1.1) (:list "/y" 11.1)))))) (:object (:class osc-bundle) (:slots ((:onset 921) (:item-internal-time 921) (:item-type 921) (:attributes (:list :color (:color 0.15843916 0.8072007 0.9291208 0.4))) (:messages (:list (:list "/x" -0.88) (:list "/y" 10.4)))))) (:object (:class osc-bundle) (:slots ((:onset 935) (:item-internal-time 935) (:item-type 935) (:attributes (:list :color (:color 0.037127018 0.61409426 0.9819088 0.4))) (:messages (:list (:list "/x" -0.59) (:list "/y" 10.1)))))) (:object (:class osc-bundle) (:slots ((:onset 953) (:item-internal-time 953) (:item-type 953) (:attributes (:list :color (:color 0.84324277 0.21695638 0.57658434 0.4))) (:messages (:list (:list "/x" -0.27) (:list "/y" 9.700001)))))) (:object (:class osc-bundle) (:slots ((:onset 964) (:item-internal-time 964) (:item-type 964) (:attributes (:list :color (:color 0.925346 0.07625294 0.44464648 0.4))) (:messages (:list (:list "/x" 0.13) (:list "/y" 9.700001)))))) (:object (:class osc-bundle) (:slots ((:onset 990) (:item-internal-time 990) (:item-type 990) (:attributes (:list :color (:color 0.66893244 0.32860327 0.06301677 0.4))) (:messages (:list (:list "/x" 0.77) (:list "/y" 10.1)))))) (:object (:class osc-bundle) (:slots ((:onset 998) (:item-internal-time 998) (:item-type 998) (:attributes (:list :color (:color 0.10401559 0.9347365 0.56594766 0.4))) (:messages (:list (:list "/x" 1.04) (:list "/y" 11.5)))))) (:object (:class osc-bundle) (:slots ((:onset 1021) (:item-internal-time 1021) (:item-type 1021) (:attributes (:list :color (:color 0.8564688 0.6759176 0.19638634 0.4))) (:messages (:list (:list "/x" 1.66) (:list "/y" 14.700001)))))) (:object (:class osc-bundle) (:slots ((:onset 1027) (:item-internal-time 1027) (:item-type 1027) (:attributes (:list :color (:color 0.63277746 0.5407754 0.8560742 0.4))) (:messages (:list (:list "/x" 2.15) (:list "/y" 18.7)))))) (:object (:class osc-bundle) (:slots ((:onset 1053) (:item-internal-time 1053) (:item-type 1053) (:attributes (:list :color (:color 0.33562136 0.9615545 0.26632237 0.4))) (:messages (:list (:list "/x" 2.62) (:list "/y" 23.0)))))) (:object (:class osc-bundle) (:slots ((:onset 1059) (:item-internal-time 1059) (:item-type 1059) (:attributes (:list :color (:color 0.30687583 0.43669927 0.6337265 0.4))) (:messages (:list (:list "/x" 3.11) (:list "/y" 28.699999)))))) (:object (:class osc-bundle) (:slots ((:onset 1077) (:item-internal-time 1077) (:item-type 1077) (:attributes (:list :color (:color 0.48859334 0.9329728 0.8329145 0.4))) (:messages (:list (:list "/x" 3.31) (:list "/y" 31.199999)))))) (:object (:class osc-bundle) (:slots ((:onset 1090) (:item-internal-time 1090) (:item-type 1090) (:attributes (:list :color (:color 0.18165958 0.34193254 0.9478512 0.4))) (:messages (:list (:list "/x" 3.68) (:list "/y" 36.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 1122) (:item-internal-time 1122) (:item-type 1122) (:attributes (:list :color (:color 0.65809966 0.49929774 0.9191693 0.4))) (:messages (:list (:list "/x" 3.95) (:list "/y" 41.199997)))))) (:object (:class osc-bundle) (:slots ((:onset 1125) (:item-internal-time 1125) (:item-type 1125) (:attributes (:list :color (:color 0.54489375 0.6714593 0.43507612 0.4))) (:messages (:list (:list "/x" 4.05) (:list "/y" 43.3)))))) (:object (:class osc-bundle) (:slots ((:onset 1155) (:item-internal-time 1155) (:item-type 1155) (:attributes (:list :color (:color 0.17456424 0.8827083 0.15030229 0.4))) (:messages (:list (:list "/x" 4.2) (:list "/y" 46.9)))))) (:object (:class osc-bundle) (:slots ((:onset 1158) (:item-internal-time 1158) (:item-type 1158) (:attributes (:list :color (:color 0.36292148 0.18804622 0.20954514 0.4))) (:messages (:list (:list "/x" 4.3) (:list "/y" 49.8)))))) (:object (:class osc-bundle) (:slots ((:onset 1183) (:item-internal-time 1183) (:item-type 1183) (:attributes (:list :color (:color 0.9130441 0.6773176 0.1876843 0.4))) (:messages (:list (:list "/x" 4.37) (:list "/y" 52.3)))))) (:object (:class osc-bundle) (:slots ((:onset 1184) (:item-internal-time 1184) (:item-type 1184) (:attributes (:list :color (:color 0.6054871 0.31498575 0.47260475 0.4))) (:messages (:list (:list "/x" 4.37) (:list "/y" 54.4)))))) (:object (:class osc-bundle) (:slots ((:onset 1234) (:item-internal-time 1234) (:item-type 1234) (:attributes (:list :color (:color 0.09141219 0.6401154 0.1107806 0.4))) (:messages (:list (:list "/x" 4.37) (:list "/y" 57.3)))))) (:object (:class osc-bundle) (:slots ((:onset 1281) (:item-internal-time 1281) (:item-type 1281) (:attributes (:list :color (:color 0.3790598 0.5619457 0.64000845 0.4))) (:messages (:list (:list "/x" 4.27) (:list "/y" 58.699997)))))) (:object (:class osc-bundle) (:slots ((:onset 1332) (:item-internal-time 1332) (:item-type 1332) (:attributes (:list :color (:color 0.34254074 0.13612569 0.12147832 0.4))) (:messages (:list (:list "/x" 4.13) (:list "/y" 58.699997)))))) (:object (:class osc-bundle) (:slots ((:onset 1377) (:item-internal-time 1377) (:item-type 1377) (:attributes (:list :color (:color 0.59680534 0.51132906 0.61921096 0.4))) (:messages (:list (:list "/x" 4.03) (:list "/y" 56.6)))))) (:object (:class osc-bundle) (:slots ((:onset 1420) (:item-internal-time 1420) (:item-type 1420) (:attributes (:list :color (:color 0.551641 0.47890556 0.42593825 0.4))) (:messages (:list (:list "/x" 4.03) (:list "/y" 53.699997)))))) (:object (:class osc-bundle) (:slots ((:onset 1451) (:item-internal-time 1451) (:item-type 1451) (:attributes (:list :color (:color 0.29206204 0.14428187 0.478992 0.4))) (:messages (:list (:list "/x" 4.05) (:list "/y" 51.6)))))) (:object (:class osc-bundle) (:slots ((:onset 1481) (:item-internal-time 1481) (:item-type 1481) (:attributes (:list :color (:color 0.5337864 0.86360217 0.80187345 0.4))) (:messages (:list (:list "/x" 4.22) (:list "/y" 49.4)))))) (:object (:class osc-bundle) (:slots ((:onset 1520) (:item-internal-time 1520) (:item-type 1520) (:attributes (:list :color (:color 0.94776345 0.013380408 0.9474864 0.4))) (:messages (:list (:list "/x" 4.42) (:list "/y" 47.600003)))))) (:object (:class osc-bundle) (:slots ((:onset 1546) (:item-internal-time 1546) (:item-type 1546) (:attributes (:list :color (:color 0.975737 0.07233536 0.64538217 0.4))) (:messages (:list (:list "/x" 4.62) (:list "/y" 45.5)))))) (:object (:class osc-bundle) (:slots ((:onset 1578) (:item-internal-time 1578) (:item-type 1578) (:attributes (:list :color (:color 0.86882174 0.07670796 0.9762672 0.4))) (:messages (:list (:list "/x" 4.79) (:list "/y" 43.3)))))) (:object (:class osc-bundle) (:slots ((:onset 1605) (:item-internal-time 1605) (:item-type 1605) (:attributes (:list :color (:color 0.624719 0.054451347 0.42972004 0.4))) (:messages (:list (:list "/x" 4.87) (:list "/y" 41.6)))))) (:object (:class osc-bundle) (:slots ((:onset 1612) (:item-internal-time 1612) (:item-type 1612) (:attributes (:list :color (:color 0.6929889 0.9611435 0.49949217 0.4))) (:messages (:list (:list "/x" 4.96) (:list "/y" 39.8)))))) (:object (:class osc-bundle) (:slots ((:onset 1638) (:item-internal-time 1638) (:item-type 1638) (:attributes (:list :color (:color 0.13700545 0.9252362 0.21123135 0.4))) (:messages (:list (:list "/x" 5.04) (:list "/y" 38.0)))))) (:object (:class osc-bundle) (:slots ((:onset 1643) (:item-internal-time 1643) (:item-type 1643) (:attributes (:list :color (:color 0.68917585 0.1504513 0.96886254 0.4))) (:messages (:list (:list "/x" 5.16) (:list "/y" 34.0)))))) (:object (:class osc-bundle) (:slots ((:onset 1673) (:item-internal-time 1673) (:item-type 1673) (:attributes (:list :color (:color 0.038166404 0.684582 0.098065734 0.4))) (:messages (:list (:list "/x" 5.24) (:list "/y" 31.199999)))))) (:object (:class osc-bundle) (:slots ((:onset 1674) (:item-internal-time 1674) (:item-type 1674) (:attributes (:list :color (:color 0.37630188 0.13553262 0.18528235 0.4))) (:messages (:list (:list "/x" 5.33) (:list "/y" 27.6)))))) (:object (:class osc-bundle) (:slots ((:onset 1684) (:item-internal-time 1684) (:item-type 1684) (:attributes (:list :color (:color 0.9853797 0.3226998 0.056506276 0.4))) (:messages (:list (:list "/x" 5.43) (:list "/y" 24.0)))))) (:object (:class osc-bundle) (:slots ((:onset 1703) (:item-internal-time 1703) (:item-type 1703) (:attributes (:list :color (:color 0.6821953 0.2912532 0.09732401 0.4))) (:messages (:list (:list "/x" 5.53) (:list "/y" 19.400002)))))) (:object (:class osc-bundle) (:slots ((:onset 1768) (:item-internal-time 1768) (:item-type 1768) (:attributes (:list :color (:color 0.061438084 0.77701414 0.26777697 0.4) :posy 60)) (:messages nil)))) (:object (:class osc-bundle) (:slots ((:onset 1852) (:item-internal-time 1852) (:item-type :master) (:attributes (:list :color (:color 0.14586354 0.069835425 0.80376947 0.4))) (:messages (:list (:list "/x" 5.75) (:list "/y" 10.4)))))))))))) (:id 4)) (:comment (:x 371) (:y 247) (:w 117) (:h 36) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "<= output a list of OSC-BUNDLEs") (:id 5)) (:comment (:x 109) (:y 395) (:w 320) (:h 78) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font nil) (:t-or-nil nil))) (:align nil) (:text "OSC-BUNDLEs can be sequenced in a DATA-TRACK object. The default action (when the DATA-TRACK is played) is to OSC-SEND the bundles.") (:id 6))) (:connections (:connection (:from (:box 1 :out 1)) (:to (:box 3 :in 1)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 1 :out 2)) (:to (:box 3 :in 2)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 1 :out 3)) (:to (:box 3 :in 3))) (:connection (:from (:box 2 :out 0)) (:to (:box 3 :in 0)) (:attributes (:color (:color 0.3 0.3 0.3 1.0) :style nil :modif nil))) (:connection (:from (:box 3 :out 0)) (:to (:box 4 :in 1)))))
45,397
Common Lisp
.l
1,689
16.633511
80
0.421214
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
b9b5314963321eb80324bf5937480073da732251cc94f89efd2d8e521f9cd8b3
1,412
[ -1 ]
1,413
3d-model.opat
cac-t-u-s_om-sharp/help-patches/3D/3d-model.opat
(:patch (:name "3d-model") (:doc "") (:info (:created "2020/10/16 22:56:54") (:modified "2021/08/12 19:56:28") (:by "om-sharp") (:version 1.0301)) (:window (:size (1101 509)) (:position (100 108))) (:grid nil) (:lock nil) (:boxes (:box (:type :object) (:reference 3d-cube) (:group-id nil) (:name nil) (:x 26) (:y 200) (:w 98) (:h 80) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CENTER") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "SIZE") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "COLOR") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FILLED") (:value t) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "CENTER") (:reactive nil)) (:output (:name "SIZE") (:reactive nil)) (:output (:name "COLOR") (:reactive nil)) (:output (:name "FILLED") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params) (:value (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color nil) (:points (:list (:list -0.5 -0.5 0.5) (:list 0.5 -0.5 0.5) (:list 0.5 -0.5 1.5) (:list -0.5 -0.5 1.5) (:list -0.5 0.5 0.5) (:list 0.5 0.5 0.5) (:list 0.5 0.5 1.5) (:list -0.5 0.5 1.5))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 0 0 1)) (:size 1) (:filled t))))) (:id 0)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 92) (:y 157) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 1)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 31) (:y 157) (:w 53) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 0 0 1)) (:id 2)) (:box (:type :object) (:reference 3d-model) (:group-id nil) (:name nil) (:x 121) (:y 370) (:w 183) (:h 57) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:showname nil) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil)) (:input (:type :key) (:name "scaler-x") (:value 1) (:reactive nil)) (:input (:type :key) (:name "scaler-y") (:value 1) (:reactive nil)) (:input (:type :key) (:name "scaler-z") (:value 1) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "DATA") (:reactive nil)) (:output (:name "scaler-x") (:reactive nil)) (:output (:name "scaler-y") (:reactive nil)) (:output (:name "scaler-z") (:reactive nil))) (:window (:size (638 440)) (:position (532 137))) (:edition-params (:filter-off-grid nil) (:y-grid (:list -0.5 2.25)) (:x-grid (:list -0.5 2.25))) (:value (:object (:class 3d-model) (:slots ((:data (:list (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color nil) (:points (:list (:list -0.5 -0.5 0.5) (:list 0.5 -0.5 0.5) (:list 0.5 -0.5 1.5) (:list -0.5 -0.5 1.5) (:list -0.5 0.5 0.5) (:list 0.5 0.5 0.5) (:list 0.5 0.5 1.5) (:list -0.5 0.5 1.5))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 0 0 1)) (:size 1) (:filled t)))) (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color (:color 0.5 0.7 0.7 1.0)) (:points (:list (:list 1.75 1.75 0.75) (:list 2.25 1.75 0.75) (:list 2.25 1.75 1.25) (:list 1.75 1.75 1.25) (:list 1.75 2.25 0.75) (:list 2.25 2.25 0.75) (:list 2.25 2.25 1.25) (:list 1.75 2.25 1.25))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 2 2 1)) (:size 0.5) (:filled t)))))))) (:add-slots ((:scaler-x 1) (:scaler-y 1) (:scaler-z 1) (:center (:list 0.0 0.0 0.0)) (:rotation-x 0) (:rotation-y 0) (:rotation-z 0))))) (:id 3)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 153) (:y 304) (:w 54) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :object) (:reference 3d-cube) (:group-id nil) (:name nil) (:x 209) (:y 200) (:w 102) (:h 77) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CENTER") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "SIZE") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "COLOR") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FILLED") (:value t) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "CENTER") (:reactive nil)) (:output (:name "SIZE") (:reactive nil)) (:output (:name "COLOR") (:reactive nil)) (:output (:name "FILLED") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params) (:value (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color (:color 0.5 0.7 0.7 1.0)) (:points (:list (:list 1.75 1.75 0.75) (:list 2.25 1.75 0.75) (:list 2.25 1.75 1.25) (:list 1.75 1.75 1.25) (:list 1.75 2.25 0.75) (:list 2.25 2.25 0.75) (:list 2.25 2.25 1.25) (:list 1.75 2.25 1.25))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 2 2 1)) (:size 0.5) (:filled t))))) (:id 5)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 242) (:y 157) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.5) (:id 6)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 182) (:y 157) (:w 53) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 2 2 1)) (:id 7)) (:box (:type :function) (:reference (:symbol "OM-MAKE-COLOR" "OM-API")) (:group-id nil) (:name "om-make-color") (:x 289) (:y 157) (:w 123) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "R") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "G") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "B") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 293) (:y 91) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.5) (:id 9)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 327) (:y 122) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.7) (:id 10)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 362) (:y 122) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.7) (:id 11)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 191) (:y 335) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 12)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 224) (:y 335) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 13)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 257) (:y 335) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 14)) (:box (:type :object) (:reference 3d-model) (:group-id nil) (:name nil) (:x 755) (:y 348) (:w 183) (:h 85) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "DATA") (:value nil) (:reactive nil)) (:input (:type :key) (:name "scaler-x") (:value 1) (:reactive nil)) (:input (:type :key) (:name "scaler-y") (:value 1) (:reactive nil)) (:input (:type :key) (:name "scaler-z") (:value 1) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "DATA") (:reactive nil)) (:output (:name "scaler-x") (:reactive nil)) (:output (:name "scaler-y") (:reactive nil)) (:output (:name "scaler-z") (:reactive nil))) (:window (:size (638 432)) (:position (700 148))) (:edition-params (:filter-off-grid nil) (:y-grid (:list -1.57 1.25)) (:x-grid (:list -1.75 1.27))) (:value (:object (:class 3d-model) (:slots ((:data (:list (:object (:class 3d-lines) (:slots ((:name nil) (:use-display-list t) (:color nil) (:points (:list (:list 0.07 0.37 0.0 0.0) (:list 0.03 0.41 0.0 72) (:list -0.06 0.47 0.0 210) (:list -0.11 0.51 0.0 291) (:list -0.19 0.55 0.0 405) (:list -0.26 0.59 0.0 507) (:list -0.32 0.61 0.0 588) (:list -0.41 0.65 0.0 713) (:list -0.55 0.67 0.0 893) (:list -0.64 0.67 0.0 1008) (:list -0.79 0.67 0.0 1199) (:list -0.92 0.59 0.0 1393) (:list -1.0 0.52 0.0 1528) (:list -1.04 0.43 0.0 1653) (:list -1.08 0.39 0.0 1725) (:list -1.1 0.29 0.0 1855) (:list -1.14 0.2 0.0 1980) (:list -1.16 0.12 0.0 2085) (:list -1.16 0.02 0.0 2213) (:list -1.17 -0.05 0.0 2302) (:list -1.17 -0.12 0.0 2392) (:list -1.17 -0.2 0.0 2493) (:list -1.17 -0.28 0.0 2595) (:list -1.17 -0.36 0.0 2697) (:list -1.16 -0.45 0.0 2812) (:list -1.11 -0.55 0.0 2954) (:list -1.07 -0.63 0.0 3068) (:list -1.03 -0.7 0.0 3171) (:list -0.96 -0.77 0.0 3297) (:list -0.89 -0.84 0.0 3423) (:list -0.8 -0.9 0.0 3560) (:list -0.7 -0.96 0.0 3709) (:list -0.59 -1.0 0.0 3858) (:list -0.48 -1.04 0.0 4007) (:list -0.38 -1.06 0.0 4136) (:list -0.26 -1.06 0.0 4289) (:list -0.14 -1.07 0.0 4442) (:list -0.03 -1.07 0.0 4582) (:list 0.06 -1.06 0.0 4697) (:list 0.16 -1.01 0.0 4840) (:list 0.25 -0.94 0.0 4985) (:list 0.34 -0.83 0.0 5166) (:list 0.4 -0.73 0.0 5314) (:list 0.44 -0.65 0.0 5428) (:list 0.48 -0.55 0.0 5565) (:list 0.51 -0.47 0.0 5673) (:list 0.52 -0.37 0.0 5801) (:list 0.53 -0.3 0.0 5891) (:list 0.54 -0.2 0.0 6019) (:list 0.54 -0.12 0.0 6121) (:list 0.54 0.01 0.0 6286) (:list 0.52 0.07 0.0 6367) (:list 0.48 0.17 0.0 6504) (:list 0.43 0.24 0.0 6613) (:list 0.37 0.29 0.0 6713) (:list 0.31 0.31 0.0 6793) (:list 0.24 0.34 0.0 6890) (:list 0.17 0.34 0.0 6979) (:list 0.12 0.34 0.0 7043) (:list 0.06 0.34 0.0 7119) (:list 0.01 0.31 0.0 7193) (:list -0.03 0.29 0.0 7250) (:list -0.13 0.22 0.0 7406) (:list -0.19 0.14 0.0 7533) (:list -0.26 0.06 0.0 7668) (:list -0.3 -0.01 0.0 7771) (:list -0.32 -0.07 0.0 7851) (:list -0.32 -0.13 0.0 7927) (:list -0.33 -0.2 0.0 8017) (:list -0.33 -0.29 0.0 8132) (:list -0.27 -0.39 0.0 8280) (:list -0.23 -0.43 0.0 8352) (:list -0.18 -0.47 0.0 8434) (:list -0.11 -0.51 0.0 8536) (:list -0.02 -0.53 0.0 8654) (:list 0.03 -0.54 0.0 8718) (:list 0.13 -0.54 0.0 8846) (:list 0.19 -0.53 0.0 8923) (:list 0.23 -0.47 0.0 9015) (:list 0.25 -0.41 0.0 9095) (:list 0.25 -0.34 0.0 9184) (:list 0.24 -0.28 0.0 9262) (:list 0.21 -0.22 0.0 9347) (:list 0.15 -0.16 0.0 9455) (:list 0.09 -0.11 0.0 9554) (:list 0.02 -0.08 0.0 9651) (:list -0.06 -0.08 0.0 9753) (:list -0.14 -0.08 0.0 9855) (:list -0.21 -0.17 0.0 10000))) (:glvertexes (:array (:dimensions (:list 89)) (:content-as-list (:list nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)))) (:line-width 2) (:draw-style :lines)))) (:object (:class 3d-lines) (:slots ((:name nil) (:use-display-list t) (:color (:color 0.326895 0.17384196 0.66149545 1.0)) (:points (:list (:list -1.75 -0.02 0.0) (:list -1.72 0.14 0.0) (:list -1.66 0.3 0.0) (:list -1.56 0.41 0.0) (:list -1.45 0.5 0.0) (:list -1.33 0.54 0.0) (:list -1.24 0.57 -0.1) (:list -1.13 0.57 -0.1) (:list -1.05 0.5 -0.1) (:list -0.98 0.39 -0.1) (:list -0.95 0.23 -0.1) (:list -0.89 0.03 -0.1) (:list -0.87 -0.09 -0.1) (:list -0.82 -0.29 -0.1) (:list -0.8 -0.43 -0.1) (:list -0.79 -0.54 -0.1) (:list -0.77 -0.65 -0.1) (:list -0.72 -0.88 -0.1) (:list -0.71 -0.99 -0.1) (:list -0.66 -1.15 -0.1) (:list -0.6 -1.33 -0.1) (:list -0.52 -1.44 -0.1) (:list -0.42 -1.51 -0.1) (:list -0.29 -1.55 -0.1) (:list -0.15 -1.57 -0.1) (:list 0.0 -1.57 -0.1) (:list 0.08 -1.55 -0.1) (:list 0.22 -1.46 -0.1) (:list 0.34 -1.37 0.0) (:list 0.42 -1.3 0.0) (:list 0.5 -1.24 0.0) (:list 0.62 -1.15 0.0) (:list 0.74 -1.1 0.0) (:list 0.83 -1.08 0.0) (:list 0.98 -1.08 0.0) (:list 1.15 -1.12 0.0) (:list 1.27 -1.21 0.0))) (:glvertexes (:array (:dimensions (:list 37)) (:content-as-list (:list nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)))) (:line-width 2.0) (:draw-style :default)))) (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color (:color 0.5 0.7 0.7 1.0)) (:points (:list (:list -0.25 0.75 -0.25) (:list 0.25 0.75 -0.25) (:list 0.25 0.75 0.25) (:list -0.25 0.75 0.25) (:list -0.25 1.25 -0.25) (:list 0.25 1.25 -0.25) (:list 0.25 1.25 0.25) (:list -0.25 1.25 0.25))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 0 1 0)) (:size 0.5) (:filled t)))))))) (:add-slots ((:scaler-x 1) (:scaler-y 1) (:scaler-z 1) (:center (:list 0.0 0.0 0.0)) (:rotation-x 0) (:rotation-y 0) (:rotation-z 0))))) (:id 15)) (:box (:type :function) (:reference list) (:group-id nil) (:name "list") (:x 787) (:y 280) (:w 54) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "x") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 16)) (:box (:type :object) (:reference 3d-cube) (:group-id nil) (:name nil) (:x 843) (:y 176) (:w 102) (:h 77) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CENTER") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "SIZE") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "COLOR") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "FILLED") (:value t) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "CENTER") (:reactive nil)) (:output (:name "SIZE") (:reactive nil)) (:output (:name "COLOR") (:reactive nil)) (:output (:name "FILLED") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params) (:value (:object (:class 3d-cube) (:slots ((:name nil) (:use-display-list nil) (:color (:color 0.5 0.7 0.7 1.0)) (:points (:list (:list -0.25 0.75 -0.25) (:list 0.25 0.75 -0.25) (:list 0.25 0.75 0.25) (:list -0.25 0.75 0.25) (:list -0.25 1.25 -0.25) (:list 0.25 1.25 -0.25) (:list 0.25 1.25 0.25) (:list -0.25 1.25 0.25))) (:glvertexes (:array (:dimensions (:list 8)) (:content-as-list (:list nil nil nil nil nil nil nil nil)))) (:center (:list 0 1 0)) (:size 0.5) (:filled t))))) (:id 17)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 876) (:y 133) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.5) (:id 18)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 816) (:y 133) (:w 53) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 0 1 0)) (:id 19)) (:box (:type :function) (:reference (:symbol "OM-MAKE-COLOR" "OM-API")) (:group-id nil) (:name "om-make-color") (:x 923) (:y 133) (:w 123) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "R") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "G") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "B") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 20)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 927) (:y 77) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.5) (:id 21)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 961) (:y 98) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.7) (:id 22)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 996) (:y 98) (:w 35) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.7) (:id 23)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 825) (:y 311) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 24)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 858) (:y 311) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 25)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 891) (:y 311) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 26)) (:box (:type :object) (:reference 3dc) (:group-id nil) (:name nil) (:x 539) (:y 78) (:w 118) (:h 67) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "X-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Y-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Z-POINTS") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "X-POINTS") (:reactive nil)) (:output (:name "Y-POINTS") (:reactive nil)) (:output (:name "Z-POINTS") (:reactive nil))) (:window (:size (800 600)) (:position (140 138))) (:edition-params) (:value (:object (:class 3dc) (:slots ((:times (:list 0.0 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 10000.0)) (:onset 0) (:duration 10000.0) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0.0 0.0 0.0 1.0)) (:decimals 2) (:x-points (:list 0.07 0.03 -0.06 -0.11 -0.19 -0.26 -0.32 -0.41 -0.55 -0.64 -0.79 -0.92 -1.0 -1.04 -1.08 -1.1 -1.14 -1.16 -1.16 -1.17 -1.17 -1.17 -1.17 -1.17 -1.16 -1.11 -1.07 -1.03 -0.96 -0.89 -0.8 -0.7 -0.59 -0.48 -0.38 -0.26 -0.14 -0.03 0.06 0.16 0.25 0.34 0.4 0.44 0.48 0.51 0.52 0.53 0.54 0.54 0.54 0.52 0.48 0.43 0.37 0.31 0.24 0.17 0.12 0.06 0.01 -0.03 -0.13 -0.19 -0.26 -0.3 -0.32 -0.32 -0.33 -0.33 -0.27 -0.23 -0.18 -0.11 -0.02 0.03 0.13 0.19 0.23 0.25 0.25 0.24 0.21 0.15 0.09 0.02 -0.06 -0.14 -0.21)) (:y-points (:list 0.37 0.41 0.47 0.51 0.55 0.59 0.61 0.65 0.67 0.67 0.67 0.59 0.52 0.43 0.39 0.29 0.2 0.12 0.02 -0.05 -0.12 -0.2 -0.28 -0.36 -0.45 -0.55 -0.63 -0.7 -0.77 -0.84 -0.9 -0.96 -1.0 -1.04 -1.06 -1.06 -1.07 -1.07 -1.06 -1.01 -0.94 -0.83 -0.73 -0.65 -0.55 -0.47 -0.37 -0.3 -0.2 -0.12 0.01 0.07 0.17 0.24 0.29 0.31 0.34 0.34 0.34 0.34 0.31 0.29 0.22 0.14 0.06 -0.01 -0.07 -0.13 -0.2 -0.29 -0.39 -0.43 -0.47 -0.51 -0.53 -0.54 -0.54 -0.53 -0.47 -0.41 -0.34 -0.28 -0.22 -0.16 -0.11 -0.08 -0.08 -0.08 -0.17)) (:z-points (:list 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)))) (:add-slots ((:name "3DC"))))) (:id 27)) (:box (:type :function) (:reference point-pairs) (:group-id nil) (:name "point-pairs") (:x 507) (:y 151) (:w 98) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 28)) (:box (:type :object) (:reference 3dc) (:group-id nil) (:name nil) (:x 674) (:y 139) (:w 118) (:h 67) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock :locked) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "X-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Y-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Z-POINTS") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "X-POINTS") (:reactive nil)) (:output (:name "Y-POINTS") (:reactive nil)) (:output (:name "Z-POINTS") (:reactive nil))) (:window (:size (800 600)) (:position (182 184))) (:edition-params) (:value (:object (:class 3dc) (:slots ((:times (:list 0.0 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 10000.0)) (:onset 0) (:duration 10000.0) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0.0 0.0 0.0 1.0)) (:decimals 2) (:x-points (:list -1.75 -1.72 -1.66 -1.56 -1.45 -1.33 -1.24 -1.13 -1.05 -0.98 -0.95 -0.89 -0.87 -0.82 -0.8 -0.79 -0.77 -0.72 -0.71 -0.66 -0.6 -0.52 -0.42 -0.29 -0.15 0.0 0.08 0.22 0.34 0.42 0.5 0.62 0.74 0.83 0.98 1.15 1.27)) (:y-points (:list -0.02 0.14 0.3 0.41 0.5 0.54 0.57 0.57 0.5 0.39 0.23 0.03 -0.09 -0.29 -0.43 -0.54 -0.65 -0.88 -0.99 -1.15 -1.33 -1.44 -1.51 -1.55 -1.57 -1.57 -1.55 -1.46 -1.37 -1.3 -1.24 -1.15 -1.1 -1.08 -1.08 -1.12 -1.21)) (:z-points (:list 0.0 0.0 0.0 0.0 0.0 0.0 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)))) (:add-slots ((:name "3DC"))))) (:id 29)) (:box (:type :function) (:reference point-pairs) (:group-id nil) (:name "point-pairs") (:x 642) (:y 212) (:w 98) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 30)) (:comment (:x 78) (:y 25) (:w 112) (:h 29) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "3D-MODEL") (:id 31)) (:box (:type :object) (:reference 3d-lines) (:group-id nil) (:name nil) (:x 530) (:y 215) (:w 80) (:h 50) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :text) (:showname nil) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "COLOR") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LINE-WIDTH") (:value 1) (:reactive nil)) (:input (:type :standard) (:name "DRAW-STYLE") (:value :lines) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "POINTS") (:reactive nil)) (:output (:name "COLOR") (:reactive nil)) (:output (:name "LINE-WIDTH") (:reactive nil)) (:output (:name "DRAW-STYLE") (:reactive nil))) (:window (:size nil) (:position nil)) (:edition-params) (:value (:object (:class 3d-lines) (:slots ((:name nil) (:use-display-list t) (:color nil) (:points (:list (:list 0.07 0.37 0.0 0.0) (:list 0.03 0.41 0.0 72) (:list -0.06 0.47 0.0 210) (:list -0.11 0.51 0.0 291) (:list -0.19 0.55 0.0 405) (:list -0.26 0.59 0.0 507) (:list -0.32 0.61 0.0 588) (:list -0.41 0.65 0.0 713) (:list -0.55 0.67 0.0 893) (:list -0.64 0.67 0.0 1008) (:list -0.79 0.67 0.0 1199) (:list -0.92 0.59 0.0 1393) (:list -1.0 0.52 0.0 1528) (:list -1.04 0.43 0.0 1653) (:list -1.08 0.39 0.0 1725) (:list -1.1 0.29 0.0 1855) (:list -1.14 0.2 0.0 1980) (:list -1.16 0.12 0.0 2085) (:list -1.16 0.02 0.0 2213) (:list -1.17 -0.05 0.0 2302) (:list -1.17 -0.12 0.0 2392) (:list -1.17 -0.2 0.0 2493) (:list -1.17 -0.28 0.0 2595) (:list -1.17 -0.36 0.0 2697) (:list -1.16 -0.45 0.0 2812) (:list -1.11 -0.55 0.0 2954) (:list -1.07 -0.63 0.0 3068) (:list -1.03 -0.7 0.0 3171) (:list -0.96 -0.77 0.0 3297) (:list -0.89 -0.84 0.0 3423) (:list -0.8 -0.9 0.0 3560) (:list -0.7 -0.96 0.0 3709) (:list -0.59 -1.0 0.0 3858) (:list -0.48 -1.04 0.0 4007) (:list -0.38 -1.06 0.0 4136) (:list -0.26 -1.06 0.0 4289) (:list -0.14 -1.07 0.0 4442) (:list -0.03 -1.07 0.0 4582) (:list 0.06 -1.06 0.0 4697) (:list 0.16 -1.01 0.0 4840) (:list 0.25 -0.94 0.0 4985) (:list 0.34 -0.83 0.0 5166) (:list 0.4 -0.73 0.0 5314) (:list 0.44 -0.65 0.0 5428) (:list 0.48 -0.55 0.0 5565) (:list 0.51 -0.47 0.0 5673) (:list 0.52 -0.37 0.0 5801) (:list 0.53 -0.3 0.0 5891) (:list 0.54 -0.2 0.0 6019) (:list 0.54 -0.12 0.0 6121) (:list 0.54 0.01 0.0 6286) (:list 0.52 0.07 0.0 6367) (:list 0.48 0.17 0.0 6504) (:list 0.43 0.24 0.0 6613) (:list 0.37 0.29 0.0 6713) (:list 0.31 0.31 0.0 6793) (:list 0.24 0.34 0.0 6890) (:list 0.17 0.34 0.0 6979) (:list 0.12 0.34 0.0 7043) (:list 0.06 0.34 0.0 7119) (:list 0.01 0.31 0.0 7193) (:list -0.03 0.29 0.0 7250) (:list -0.13 0.22 0.0 7406) (:list -0.19 0.14 0.0 7533) (:list -0.26 0.06 0.0 7668) (:list -0.3 -0.01 0.0 7771) (:list -0.32 -0.07 0.0 7851) (:list -0.32 -0.13 0.0 7927) (:list -0.33 -0.2 0.0 8017) (:list -0.33 -0.29 0.0 8132) (:list -0.27 -0.39 0.0 8280) (:list -0.23 -0.43 0.0 8352) (:list -0.18 -0.47 0.0 8434) (:list -0.11 -0.51 0.0 8536) (:list -0.02 -0.53 0.0 8654) (:list 0.03 -0.54 0.0 8718) (:list 0.13 -0.54 0.0 8846) (:list 0.19 -0.53 0.0 8923) (:list 0.23 -0.47 0.0 9015) (:list 0.25 -0.41 0.0 9095) (:list 0.25 -0.34 0.0 9184) (:list 0.24 -0.28 0.0 9262) (:list 0.21 -0.22 0.0 9347) (:list 0.15 -0.16 0.0 9455) (:list 0.09 -0.11 0.0 9554) (:list 0.02 -0.08 0.0 9651) (:list -0.06 -0.08 0.0 9753) (:list -0.14 -0.08 0.0 9855) (:list -0.21 -0.17 0.0 10000))) (:glvertexes (:array (:dimensions (:list 89)) (:content-as-list (:list nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)))) (:line-width 2) (:draw-style :lines))))) (:id 32)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 568) (:y 180) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 2) (:id 33))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 0 :in 2))) (:connection (:from (:box 2 :out 0)) (:to (:box 0 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 3 :in 1))) (:connection (:from (:box 5 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 2))) (:connection (:from (:box 7 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 8 :out 0)) (:to (:box 5 :in 3))) (:connection (:from (:box 9 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 10 :out 0)) (:to (:box 8 :in 1))) (:connection (:from (:box 11 :out 0)) (:to (:box 8 :in 2))) (:connection (:from (:box 12 :out 0)) (:to (:box 3 :in 2))) (:connection (:from (:box 13 :out 0)) (:to (:box 3 :in 3))) (:connection (:from (:box 14 :out 0)) (:to (:box 3 :in 4))) (:connection (:from (:box 16 :out 0)) (:to (:box 15 :in 1))) (:connection (:from (:box 17 :out 0)) (:to (:box 16 :in 2))) (:connection (:from (:box 18 :out 0)) (:to (:box 17 :in 2))) (:connection (:from (:box 19 :out 0)) (:to (:box 17 :in 1))) (:connection (:from (:box 20 :out 0)) (:to (:box 17 :in 3))) (:connection (:from (:box 21 :out 0)) (:to (:box 20 :in 0))) (:connection (:from (:box 22 :out 0)) (:to (:box 20 :in 1))) (:connection (:from (:box 23 :out 0)) (:to (:box 20 :in 2))) (:connection (:from (:box 24 :out 0)) (:to (:box 15 :in 2))) (:connection (:from (:box 25 :out 0)) (:to (:box 15 :in 3))) (:connection (:from (:box 26 :out 0)) (:to (:box 15 :in 4))) (:connection (:from (:box 27 :out 0)) (:to (:box 28 :in 0))) (:connection (:from (:box 28 :out 0)) (:to (:box 32 :in 1))) (:connection (:from (:box 29 :out 0)) (:to (:box 30 :in 0))) (:connection (:from (:box 30 :out 0)) (:to (:box 16 :in 1))) (:connection (:from (:box 32 :out 0)) (:to (:box 16 :in 0))) (:connection (:from (:box 33 :out 0)) (:to (:box 32 :in 3)))))
48,956
Common Lisp
.l
2,224
13.870953
71
0.416781
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
cf52fc0d6bfc677a13810f58158ee22abb0b05982423cdb4868a3ec8e52e34ae
1,413
[ -1 ]
1,414
list-selection.opat
cac-t-u-s_om-sharp/help-patches/Interactive boxes/list-selection.opat
(:patch (:name "list-selection") (:doc "") (:info (:created "2020/07/01 22:03:46") (:modified "2022/07/12 8:01:05") (:by "om-sharp") (:version 1.07)) (:window (:size (1161 733)) (:position (364 29))) (:grid nil) (:lock nil) (:boxes (:comment (:x 58) (:y 24) (:w 219) (:h 30) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "LIST-SELECTION") (:id 0)) (:box (:type :interface) (:reference list-selection) (:group-id nil) (:name "list-selection") (:x 136) (:y 87) (:w 111) (:h 158) (:color nil) (:border nil) (:roundness nil) (:multiple-selection nil) (:cell-height 20) (:cell-font (:font (:face "Calibri") (:size 12) (:style :plain))) (:output-mode :index) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value 5) (:items (:list ionian dorian phrygian lydian mixolydian aeolian lochrian)) (:selection (:list 5)) (:id 1)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 668) (:y 144) (:w 99) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list foo bar baz)) (:id 2)) (:box (:type :function) (:reference rotate) (:group-id nil) (:name "rotate") (:x 174) (:y 412) (:w 178) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "LIST") (:value nil) (:reactive t)) (:input (:type :optional) (:name "nth") (:value 1) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 3)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 78) (:y 368) (:w 192) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 200 200 100 200 200 200 100)) (:id 4)) (:box (:type :object) (:reference chord-seq) (:group-id nil) (:name nil) (:x 53) (:y 542) (:w 325) (:h 80) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive t)) (:input (:type :standard) (:name "LONSET") (:value (:list 0 1000)) (:reactive nil)) (:input (:type :standard) (:name "LDUR") (:value (:list (:list 1000))) (:reactive nil)) (:input (:type :standard) (:name "LVEL") (:value 100) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "LONSET") (:reactive nil)) (:output (:name "LDUR") (:reactive nil)) (:output (:name "LVEL") (:reactive nil))) (:window (:size (650 300)) (:position (462 529))) (:edition-params (:font-size 40)) (:value (:object (:class chord-seq) (:slots ((:onset 0) (:duration 8000) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "nil") (:default-frame-type chord) (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:group-ids nil) (:lmidic (:list (:list 6000) (:list 6200) (:list 6300) (:list 6500) (:list 6700) (:list 6800) (:list 7000) (:list 7200))) (:lonset (:list 0 1000 2000 3000 4000 5000 6000 7000 8000)) (:ldur (:list 1000)) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil))))) (:id 5)) (:box (:type :function) (:reference dx->x) (:group-id nil) (:name "dx->x") (:x 205) (:y 483) (:w 74) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "START") (:value 6000) (:reactive nil)) (:input (:type :standard) (:name "LIST") (:value (:list 1 1)) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 6)) (:box (:type :interface) (:reference list-selection) (:group-id nil) (:name "list-selection") (:x 679) (:y 182) (:w 78) (:h 84) (:color nil) (:border nil) (:roundness nil) (:multiple-selection nil) (:cell-height 20) (:cell-font (:font (:face "Calibri") (:size 12) (:style :plain))) (:output-mode :index) (:inputs (:input (:type :key) (:name "items") (:value nil) (:reactive nil))) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:items (:list foo bar baz)) (:selection (:list 1)) (:id 7)) (:comment (:x 260) (:y 91) (:w 184) (:h 98) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "Interactively select a value out of a list of options. Use reactive mode to make evaluations instantly upon manipulation.") (:id 8)) (:comment (:x 586) (:y 278) (:w 267) (:h 83) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "Use the optional input to compose the list of options. (If you remove the box containing the options, remember to remove the optional input as well otherwise the list will get erased on evaluation!)") (:id 9)) (:comment (:x 225) (:y 253) (:w 272) (:h 53) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "In this case the output mode is \"index\". You can also output the option text itself (\"value\" mode ... see info and properties)") (:id 10)) (:comment (:x 686) (:y 437) (:w 221) (:h 53) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "Multiple selection is also possible (this is set in info and properties). Output is a list of indexes or values.") (:id 11)) (:box (:type :interface) (:reference list-selection) (:group-id nil) (:name "list-selection") (:x 619) (:y 435) (:w 57) (:h 104) (:color nil) (:border nil) (:roundness nil) (:multiple-selection t) (:cell-height 14) (:cell-font (:font (:face "Calibri") (:size 12) (:style :plain))) (:output-mode :value) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value (:list 1 4 8)) (:items (:list 1 2 4 8 16 32)) (:selection (:list 0 2 3)) (:id 12)) (:box (:type :function) (:reference apply) (:group-id nil) (:name "apply") (:x 557) (:y 547) (:w 106) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "FUNCTION") (:value nil) (:reactive t)) (:input (:type :standard) (:name "ARG") (:value nil) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 13)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 567) (:y 500) (:w 32) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value +) (:id 14)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 568) (:y 596) (:w 74) (:h 40) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Arial Unicode MS") (:size 18) (:style :plain))) (:t-or-nil t))) (:align nil) (:lock nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "in") (:value nil) (:reactive t))) (:outputs (:output (:name "value") (:reactive t))) (:value 13) (:id 15)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 174) (:y 259) (:w 47) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "in") (:value nil) (:reactive t))) (:outputs (:output (:name "value") (:reactive t))) (:value 5) (:id 16)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 202) (:y 448) (:w 47) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 6000) (:id 17)) (:box (:type :special) (:reference or) (:group-id nil) (:name "or") (:x 290) (:y 352) (:w 50) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :optional) (:name "test-forms") (:value nil) (:reactive t)) (:input (:type :optional) (:name "test-forms") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t))) (:id 18)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 310) (:y 319) (:w 32) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0) (:id 19))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 16 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 7 :in 0))) (:connection (:from (:box 3 :out 0)) (:to (:box 6 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 12 :out 0)) (:to (:box 13 :in 1))) (:connection (:from (:box 13 :out 0)) (:to (:box 15 :in 0))) (:connection (:from (:box 14 :out 0)) (:to (:box 13 :in 0))) (:connection (:from (:box 16 :out 0)) (:to (:box 18 :in 0))) (:connection (:from (:box 17 :out 0)) (:to (:box 6 :in 0))) (:connection (:from (:box 18 :out 0)) (:to (:box 3 :in 1))) (:connection (:from (:box 19 :out 0)) (:to (:box 18 :in 1)))))
12,266
Common Lisp
.l
537
18.405959
205
0.539137
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
43c6c8602165399713103bc397327dc9eb93b119a79e0b8b9c0c9cf58d03f9e6
1,414
[ -1 ]
1,415
slider.opat
cac-t-u-s_om-sharp/help-patches/Interactive boxes/slider.opat
(:patch (:name "slider") (:doc "") (:info (:created "2020/06/30 10:44:01") (:modified "2021/12/06 23:38:56") (:by "om-sharp") (:version 1.05)) (:window (:size (952 711)) (:position (255 123))) (:grid nil) (:lock t) (:boxes (:box (:type :interface) (:reference slider) (:group-id nil) (:name "slider") (:x 354) (:y 55) (:w 37) (:h 177) (:color (:color-or-nil (:color nil) (:t-or-nil nil))) (:border nil) (:roundness nil) (:min-value 20.0) (:max-value 50.0) (:increment 0.5) (:decimals 1) (:orientation :vertical) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value 33.0) (:id 0)) (:box (:type :object) (:reference 3dc) (:group-id nil) (:name nil) (:x 413) (:y 465) (:w 312) (:h 199) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive t)) (:input (:type :standard) (:name "X-POINTS") (:value nil) (:reactive t)) (:input (:type :standard) (:name "Y-POINTS") (:value nil) (:reactive t)) (:input (:type :standard) (:name "Z-POINTS") (:value nil) (:reactive t))) (:outputs (:output (:name "SELF") (:reactive t)) (:output (:name "X-POINTS") (:reactive t)) (:output (:name "Y-POINTS") (:reactive t)) (:output (:name "Z-POINTS") (:reactive t))) (:window (:size (1270 780)) (:position (141 129))) (:edition-params (:show-axes t) (:draw-style :default)) (:value (:object (:class 3dc) (:slots ((:times (:list 0.0 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 10000.0)) (:onset 0) (:duration 10000.0) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0.0 0.0 0.0 1.0)) (:decimals 2) (:x-points (:list 0.0 -0.01 -0.01 0.02 0.04 0.04 0.02 -0.02 -0.06 -0.09 -0.09 -0.07 -0.02 0.04 0.1 0.14 0.16 0.15 0.12 0.06 -0.01 -0.08 -0.15 -0.21 -0.24 -0.24 -0.22 -0.17 -0.1 -0.01 0.08 0.17 0.24 0.3 0.34 0.35 0.32 0.28 0.2 0.11 0.01 -0.1 -0.2 -0.3 -0.38 -0.43 -0.46 -0.46 -0.43 -0.37 -0.29 -0.19 -0.08 0.04 0.17 0.29 0.39 0.48 0.55 0.59 0.6 0.58 0.53 0.46 0.36 0.24 0.11 -0.03 -0.17 -0.3 -0.43 -0.54 -0.63 -0.7 -0.74 -0.75 -0.73 -0.68 -0.6 -0.5 -0.38 -0.24 -0.09 0.07 0.22 0.37 0.52 0.64 0.75 0.83 0.88 0.91 0.91 0.87 0.81 0.72 0.61 0.47 0.32 0.16 -0.01)) (:y-points (:list 0.0 0.0 -0.02 -0.03 -0.01 0.03 0.06 0.07 0.05 0.01 -0.04 -0.09 -0.12 -0.12 -0.1 -0.06 0.01 0.07 0.13 0.18 0.2 0.19 0.16 0.1 0.03 -0.06 -0.14 -0.21 -0.26 -0.29 -0.29 -0.26 -0.21 -0.13 -0.04 0.06 0.16 0.25 0.32 0.37 0.4 0.4 0.37 0.31 0.23 0.13 0.02 -0.1 -0.21 -0.32 -0.4 -0.47 -0.51 -0.53 -0.51 -0.47 -0.4 -0.31 -0.19 -0.07 0.06 0.19 0.32 0.43 0.53 0.6 0.65 0.67 0.66 0.62 0.55 0.46 0.35 0.22 0.07 -0.07 -0.22 -0.37 -0.5 -0.61 -0.7 -0.77 -0.82 -0.83 -0.81 -0.76 -0.69 -0.59 -0.47 -0.33 -0.17 -0.01 0.16 0.32 0.47 0.62 0.74 0.85 0.93 0.98 1.0)) (:z-points (:list 0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0)))) (:add-slots ((:name nil))))) (:id 1)) (:box (:type :function) (:reference arithm-ser) (:group-id nil) (:name "arithm-ser") (:x 455) (:y 84) (:w 97) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "BEGIN") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "END") (:value 100) (:reactive nil)) (:input (:type :standard) (:name "STEP") (:value 1) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 411) (:y 248) (:w 61) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive t)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 3)) (:box (:type :function) (:reference mapcar) (:group-id nil) (:name "mapcar") (:x 520) (:y 355) (:w 81) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "FUNCTION") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LIST") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 524) (:y 320) (:w 33) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value sin) (:id 5)) (:box (:type :function) (:reference mapcar) (:group-id nil) (:name "mapcar") (:x 390) (:y 355) (:w 81) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "FUNCTION") (:value cos) (:reactive t)) (:input (:type :standard) (:name "LIST") (:value nil) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 6)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 392) (:y 320) (:w 36) (:h 29) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value cos) (:id 7)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 571) (:y 412) (:w 61) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 456) (:y 412) (:w 61) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive t)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 9)) (:comment (:x 39) (:y 52) (:w 122) (:h 30) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 18) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "SLIDER") (:id 10)) (:box (:type :interface) (:reference slider) (:group-id nil) (:name "slider") (:x 637) (:y 52) (:w 183) (:h 41) (:color (:color-or-nil (:color nil) (:t-or-nil nil))) (:border nil) (:roundness nil) (:min-value 0.25) (:max-value 1.0) (:increment 0.001) (:decimals 3) (:orientation :horizontal) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value 0.525) (:id 11)) (:box (:type :function) (:reference om^) (:group-id nil) (:name "om^") (:x 576) (:y 129) (:w 62) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:reactive nil) (:inputs (:input (:type :standard) (:name "A") (:value 1) (:reactive t)) (:input (:type :standard) (:name "B") (:value 1) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 12)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 541) (:y 20) (:w 41) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.01) (:id 13)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 480) (:y 20) (:w 38) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 14)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 432) (:y 20) (:w 32) (:h 34) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:reactive nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0) (:id 15)) (:comment (:x 38) (:y 96) (:w 239) (:h 38) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "If the patch is not locked, use the CMD key to manipulate the slider.") (:id 16)) (:comment (:x 122) (:y 233) (:w 186) (:h 68) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "The reactive boxes connected below receive a notification when the sliders change and re-evaluate automatically.") (:id 17)) (:comment (:x 686) (:y 120) (:w 143) (:h 38) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Lucida Grande") (:size 12) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "Sliders can be oriented horizontally") (:id 18))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 3 :in 1))) (:connection (:from (:box 2 :out 0)) (:to (:box 12 :in 0)) (:attributes (:color nil :style nil :modif (0 -27/277)))) (:connection (:from (:box 2 :out 0)) (:to (:box 1 :in 3)) (:attributes (:color nil :style nil :modif (0 -78/433)))) (:connection (:from (:box 2 :out 0)) (:to (:box 9 :in 1))) (:connection (:from (:box 2 :out 0)) (:to (:box 8 :in 1))) (:connection (:from (:box 3 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 3 :out 0)) (:to (:box 6 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 9 :in 0))) (:connection (:from (:box 7 :out 0)) (:to (:box 6 :in 0))) (:connection (:from (:box 8 :out 0)) (:to (:box 1 :in 2))) (:connection (:from (:box 9 :out 0)) (:to (:box 1 :in 1))) (:connection (:from (:box 11 :out 0)) (:to (:box 12 :in 1))) (:connection (:from (:box 12 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 13 :out 0)) (:to (:box 2 :in 2))) (:connection (:from (:box 14 :out 0)) (:to (:box 2 :in 1))) (:connection (:from (:box 15 :out 0)) (:to (:box 2 :in 0)))))
16,895
Common Lisp
.l
920
11.555435
119
0.429171
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
5de5a65049a636f6b1cb7ef8bedb6a84449f4a655e28906533c2356816bb9bf3
1,415
[ -1 ]
1,416
file-stream.opat
cac-t-u-s_om-sharp/help-patches/Core features/file-stream.opat
(:patch (:name "file-stream") (:doc "") (:info (:created "2019/09/02 0:40:04") (:modified "2020/01/02 8:45:59") (:by "om-sharp") (:version 1.0)) (:window (:size (737 454)) (:position (714 48))) (:grid nil) (:lock nil) (:boxes (:box (:type :function) (:reference open-file-stream) (:group-id nil) (:name "open-file-stream") (:x 101) (:y 124) (:w 120) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "PATH") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 0)) (:box (:type :value) (:reference simple-base-string) (:group-id nil) (:name "value box") (:x 70) (:y 91) (:w 182) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "Users/bresson/Desktop/test.txt") (:id 1)) (:box (:type :abstraction) (:reference (:patch (:name "write-loop") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (361 415)) (:position (104 92))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "in") (:doc ""))) (:group-id nil) (:name "in") (:x 121) (:y 98) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 0)) (:box (:type :io) (:reference (:in (:type omin) (:index 2) (:name "n") (:doc ""))) (:group-id nil) (:name "n") (:x 236) (:y 70) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 1) (:doc ""))) (:group-id nil) (:name "out") (:x 70) (:y 159) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 2)) (:box (:type :special) (:reference iterate) (:group-id nil) (:name "iterate") (:x 89) (:y 310) (:w 57) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 3)) (:box (:type :special) (:reference loop-for) (:group-id nil) (:name "for") (:x 236) (:y 128) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "from") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "to") (:value 10) (:reactive nil))) (:outputs (:output (:name "i") (:reactive nil))) (:id 4)) (:box (:type :function) (:reference file-write-line) (:group-id nil) (:name "file-write-line") (:x 65) (:y 250) (:w 104) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "LINE") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "STREAM") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 5)) (:box (:type :function) (:reference format) (:group-id nil) (:name "format") (:x 166) (:y 195) (:w 72) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "DESTINATION") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CONTROL-STRING") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "format-arguments") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 6)) (:box (:type :value) (:reference simple-base-string) (:group-id nil) (:name "value box") (:x 155) (:y 152) (:w 61) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value "line ~D") (:id 7))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 0 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 6 :in 2))) (:connection (:from (:box 5 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 7 :out 0)) (:to (:box 6 :in 1)))))) (:group-id nil) (:name "write-loop") (:x 184) (:y 190) (:w 89) (:h 65) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs (:input (:type :standard) (:name "in") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "n") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:box (:type :function) (:reference close-file-stream) (:group-id nil) (:name "close-file-stream") (:x 145) (:y 279) (:w 120) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 3)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 256) (:y 127) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 20) (:id 4)) (:box (:type :object) (:reference textbuffer) (:group-id nil) (:name nil) (:x 175) (:y 324) (:w 119) (:h 70) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "CONTENTS") (:value nil) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "CONTENTS") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class textbuffer) (:slots ((:contents (:list "line 0" "line 1" "line 2" "line 3" "line 4" "line 5" "line 6" "line 7" "line 8" "line 9" "line 10" "line 11" "line 12" "line 13" "line 14" "line 15" "line 16" "line 17" "line 18" "line 19" "line 20")))) (:add-slots ((:input-mode :lines-cols))))) (:id 5)) (:comment (:x 75) (:y 12) (:w 109) (:h 25) (:fgcolor (:color-or-nil (:color nil) (:t-or-nil nil))) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 14) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "FILE STREAM I/O") (:id 6)) (:comment (:x 300) (:y 15) (:w 263) (:h 76) (:fgcolor (:color-or-nil (:color nil) (:t-or-nil nil))) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 14) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "OPEN-FILE-STREAM / CLOSE-FILE-STREAM allow opening/closing a file in order to read or write data using the FIL-WRITE / FILE-WRITE-LINE / FILE-READ-LINE functions.") (:id 7)) (:comment (:x 358) (:y 230) (:w 285) (:h 112) (:fgcolor (:color-or-nil (:color nil) (:t-or-nil nil))) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 14) (:style :plain))) (:t-or-nil t))) (:align nil) (:text "Open FILE-STREAMs are automatically closed when they are not used anymore by the Common Lisp garbage collection system, however, it is recommended to close them explicitely as soon as they are not needed in order to limit the number of streams open.") (:id 8))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 0 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 3 :out 0)) (:to (:box 5 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 2 :in 1)))))
11,336
Common Lisp
.l
482
17.074689
256
0.478994
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
8a84c46e066e4885a3935dfe6eb7ac7b37061cdfe4d67677735b305f1437e3a9
1,416
[ -1 ]
1,417
split.opat
cac-t-u-s_om-sharp/help-patches/Core features/split.opat
(:patch (:name "split") (:doc "") (:info (:created "2020/03/24 0:10:17") (:modified "2020/03/24 0:15:21") (:by "om-sharp") (:version 1.0)) (:window (:size (442 480)) (:position (583 193))) (:grid nil) (:lock nil) (:boxes (:box (:type :object) (:reference chord-seq) (:group-id nil) (:name nil) (:x 123) (:y 281) (:w 187) (:h 85) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive nil)) (:input (:type :standard) (:name "LONSET") (:value (:list 0 1000)) (:reactive nil)) (:input (:type :standard) (:name "LDUR") (:value (:list (:list 1000))) (:reactive nil)) (:input (:type :standard) (:name "LVEL") (:value 100) (:reactive nil)) (:input (:type :key) (:name "loffset") (:value 0) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "LONSET") (:reactive nil)) (:output (:name "LDUR") (:reactive nil)) (:output (:name "LVEL") (:reactive nil)) (:output (:name "loffset") (:reactive nil))) (:window (:size (650 300)) (:position (140 138))) (:edition-params) (:value (:object (:class chord-seq) (:slots ((:onset 0) (:duration 2500) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name nil) (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:lmidic (:list (:list 6000) (:list 6300) (:list 6700) (:list 7100))) (:lonset (:list 0 500 1000 1500 2500)) (:ldur (:list 1000)) (:lvel (:list 100)) (:loffset (:list 0)) (:lchan (:list 1)) (:lport (:list nil)) (:llegato nil))))) (:id 0)) (:box (:type :function) (:reference mat-trans) (:group-id nil) (:name "mat-trans") (:x 145) (:y 144) (:w 86) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "MATRIX") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :function) (:reference split) (:group-id nil) (:name "split") (:x 118) (:y 232) (:w 140) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "LIST") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil)) (:output (:name "out1") (:reactive nil))) (:id 2)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 66) (:y 106) (:w 244) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list (:list 0 6000) (:list 500 6300) (:list 1000 6700) (:list 1500 7100))) (:id 3)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 66) (:y 177) (:w 244) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs (:input (:type :optional) (:name "in") (:value nil) (:reactive nil))) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list (:list 0 500 1000 1500) (:list 6000 6300 6700 7100))) (:id 4)) (:comment (:x 116) (:y 42) (:w 172) (:h 27) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 16) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "SPLIT: easy list accessor") (:id 5))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 0 :in 2)) (:attributes (:color nil :style :curved :modif nil))) (:connection (:from (:box 2 :out 1)) (:to (:box 0 :in 1)) (:attributes (:color nil :style :curved :modif nil))) (:connection (:from (:box 3 :out 0)) (:to (:box 1 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 2 :in 0)))))
4,938
Common Lisp
.l
219
17.926941
71
0.527654
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
291f94ef0155c1b3822708372782f8658bd02230deb1d7f6427e8f8efea74c2e
1,417
[ -1 ]
1,418
factorial.opat
cac-t-u-s_om-sharp/help-patches/Core features/factorial.opat
(:patch (:name "factorial") (:doc "") (:info (:created "2018/01/18 11:54:31") (:modified "2020/08/02 17:28:38") (:by "om-sharp") (:version 1.0)) (:window (:size (884 408)) (:position (182 206))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 1) (:doc ""))) (:group-id nil) (:name "out") (:x 204) (:y 293) (:w 41) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 0)) (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "n") (:doc ""))) (:group-id nil) (:name "n") (:x 204) (:y 73) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :abstraction) (:reference (:patch-from-file (:pathname (:directory (:relative)) (:device :unspecific) (:host :unspecific) (:name "factorial") (:type "opat")))) (:group-id nil) (:name "factorial") (:x 299) (:y 161) (:w 82) (:h 52) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :hidden) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs (:input (:type :standard) (:name "n") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 2)) (:box (:type :special) (:reference if) (:group-id nil) (:name "IF") (:x 178) (:y 262) (:w 102) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TEST") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "THEN") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "else") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 3)) (:box (:type :function) (:reference om=) (:group-id nil) (:name "om=") (:x 129) (:y 227) (:w 64) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "NUM1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "NUM2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 4)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 159) (:y 182) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 5)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 270) (:y 227) (:w 60) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 6)) (:box (:type :function) (:reference 1-) (:group-id nil) (:name "1-") (:x 314) (:y 130) (:w 51) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "X") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 7)) (:box (:type :function) (:reference print) (:group-id nil) (:name "print") (:x 115) (:y 148) (:w 64) (:h 29) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SOMETHING") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :abstraction) (:reference (:patch-from-file (:pathname (:directory (:relative)) (:device :unspecific) (:host :unspecific) (:name "factorial") (:type "opat")))) (:group-id nil) (:name "factorial") (:x 611) (:y 164) (:w 150) (:h 140) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs (:input (:type :standard) (:name "n") (:value 5) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 9)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 670) (:y 113) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 4) (:id 10)) (:comment (:x 657) (:y 84) (:w 104) (:h 23) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "=> use it here !") (:id 11)) (:comment (:x 243) (:y 20) (:w 217) (:h 21) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Verdana") (:size 12) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "RECURSIVE VISUAL PROGRAM") (:id 12)) (:comment (:x 393) (:y 190) (:w 143) (:h 23) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "<= this patch is here !") (:id 13))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 3 :in 1)) (:attributes (:color (:color-or-nil (:color (:color 0.37823188304901123D0 0.6176914572715759D0 0.787287712097168D0 1.0D0)) (:t-or-nil t)) :style nil :modif nil))) (:connection (:from (:box 1 :out 0)) (:to (:box 7 :in 0))) (:connection (:from (:box 1 :out 0)) (:to (:box 6 :in 0)) (:attributes (:color nil :style nil :modif (0 0)))) (:connection (:from (:box 1 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 6 :in 1))) (:connection (:from (:box 3 :out 0)) (:to (:box 0 :in 0))) (:connection (:from (:box 4 :out 0)) (:to (:box 3 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 6 :out 0)) (:to (:box 3 :in 2))) (:connection (:from (:box 7 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 8 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 10 :out 0)) (:to (:box 9 :in 0)))))
7,613
Common Lisp
.l
376
15.882979
71
0.51596
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
f58761541a53a23b0c79081828533ab64329c36854e6b94d02057f3750cc51a7
1,418
[ -1 ]
1,419
collect.opat
cac-t-u-s_om-sharp/help-patches/Core features/collect.opat
(:patch (:name "collect") (:doc "") (:info (:created "2019/08/13 16:01:58") (:modified "2020/03/23 23:46:42") (:by "om-sharp") (:version 1.0)) (:window (:size (1148 690)) (:position (313 23))) (:grid nil) (:lock nil) (:boxes (:box (:type :interface) (:reference slider) (:group-id nil) (:name "slider") (:x 546) (:y 106) (:w 46) (:h 88) (:color nil) (:border nil) (:roundness nil) (:min-value 50) (:max-value 80) (:increment 1) (:decimals 0) (:orientation :vertical) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value 66) (:id 0)) (:box (:type :object) (:reference chord-seq) (:group-id nil) (:name nil) (:x 579) (:y 463) (:w 305) (:h 92) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "LMIDIC") (:value (:list (:list 6000))) (:reactive t)) (:input (:type :standard) (:name "LONSET") (:value (:list 0 1000)) (:reactive nil)) (:input (:type :standard) (:name "LDUR") (:value (:list (:list 1000))) (:reactive nil)) (:input (:type :standard) (:name "LVEL") (:value 100) (:reactive nil))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "LMIDIC") (:reactive nil)) (:output (:name "LONSET") (:reactive nil)) (:output (:name "LDUR") (:reactive nil)) (:output (:name "LVEL") (:reactive nil))) (:window (:size (896 383)) (:position (356 368))) (:edition-params) (:value (:object (:class chord-seq) (:slots ((:onset 0) (:duration 2347) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:name "CHORD-SEQ") (:symbolic-date nil) (:symbolic-dur nil) (:symbolic-dur-extent 0) (:extras nil) (:lmidic (:list (:list 6500) (:list 5900 6000 6400) (:list 5400 5500 5600 5700) (:list 6300 6200 5500) (:list 7900 7800 7200 7100) (:list 6200 7100 7800) (:list 5000 5100 5500 6100) (:list 6400 6200 5200 5100) (:list 8000 7600) (:list 7000 7800 7900) (:list 6600))) (:lonset (:list 0 105 209 375 477 662 766 991 1095 1239 1347 2347)) (:ldur (:list (:list 1000) (:list 1000 1000 1000) (:list 1000 1000 1000 1000) (:list 1000 1000 1000) (:list 1000 1000 1000 1000) (:list 1000 1000 1000) (:list 1000 1000 1000 1000) (:list 1000 1000 1000 1000) (:list 1000 1000) (:list 1000 1000 1000) (:list 1000))) (:lvel (:list (:list 100) (:list 100 100 100) (:list 100 100 100 100) (:list 100 100 100) (:list 100 100 100 100) (:list 100 100 100) (:list 100 100 100 100) (:list 100 100 100 100) (:list 100 100) (:list 100 100 100) (:list 100))) (:loffset (:list (:list 0) (:list 0 0 0) (:list 0 0 0 0) (:list 0 0 0) (:list 0 0 0 0) (:list 0 0 0) (:list 0 0 0 0) (:list 0 0 0 0) (:list 0 0) (:list 0 0 0) (:list 0))) (:lchan (:list (:list 1) (:list 1 1 1) (:list 1 1 1 1) (:list 1 1 1) (:list 1 1 1 1) (:list 1 1 1) (:list 1 1 1 1) (:list 1 1 1 1) (:list 1 1) (:list 1 1 1) (:list 1))) (:lport (:list (:list nil) (:list nil nil nil) (:list nil nil nil nil) (:list nil nil nil) (:list nil nil nil nil) (:list nil nil nil) (:list nil nil nil nil) (:list nil nil nil nil) (:list nil nil) (:list nil nil nil) (:list nil))) (:llegato nil))))) (:id 1)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 577) (:y 207) (:w 60) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive t)) (:input (:type :standard) (:name "ARG2") (:value 100) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t))) (:id 2)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 601) (:y 171) (:w 36) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 100) (:id 3)) (:box (:type :interface) (:reference button) (:group-id nil) (:name "button") (:x 710) (:y 193) (:w 49) (:h 36) (:color nil) (:border nil) (:roundness nil) (:send-value t) (:text "INIT") (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value nil) (:id 4)) (:box (:type :special) (:reference or) (:group-id nil) (:name "OR") (:x 642) (:y 253) (:w 64) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :optional) (:name "test-forms") (:value nil) (:reactive t)) (:input (:type :optional) (:name "test-forms") (:value nil) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 5)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 694) (:y 325) (:w 36) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 100) (:id 6)) (:comment (:x 737) (:y 340) (:w 122) (:h 52) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "<= interval max (ms) to group incoming values in a same chord") (:id 7)) (:comment (:x 95) (:y 34) (:w 472) (:h 27) (:fgcolor nil) (:bgcolor nil) (:border (:number-or-nil (:number 0.0) (:t-or-nil t))) (:roundness nil) (:text-font (:font-or-nil (:font (:font (:face "Calibri") (:size 16) (:style :bold))) (:t-or-nil t))) (:align nil) (:text "COLLECT/TCOLLECT: collect data in Loops or in reactive patches") (:id 8)) (:box (:type :interface) (:reference slider) (:group-id nil) (:name "slider") (:x 186) (:y 160) (:w 34) (:h 95) (:color nil) (:border (:number-or-nil (:number 1.5) (:t-or-nil t))) (:roundness (:number-or-nil (:number 6) (:t-or-nil t))) (:min-value 0) (:max-value 100) (:increment 1) (:decimals 0) (:orientation :vertical) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value 45) (:id 9)) (:box (:type :interface) (:reference button) (:group-id nil) (:name "button") (:x 3247/12) (:y 222) (:w 69) (:h 28) (:color (:color-or-nil (:color nil) (:t-or-nil nil))) (:border (:number-or-nil (:number 1.5) (:t-or-nil t))) (:roundness (:number-or-nil (:number 3) (:t-or-nil t))) (:send-value t) (:text "Init") (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value nil) (:id 10)) (:box (:type :object) (:reference bpf) (:group-id nil) (:name nil) (:x 87) (:y 843/2) (:w 229) (:h 73) (:color nil) (:border nil) (:roundness nil) (:text-font (:font (:face "Verdana") (:size 10) (:style :italic))) (:align :center) (:display :mini-view) (:showname nil) (:show-markers t) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SELF") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "X-POINTS") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "Y-POINTS") (:value (:list 0 100)) (:reactive t))) (:outputs (:output (:name "SELF") (:reactive nil)) (:output (:name "X-POINTS") (:reactive nil)) (:output (:name "Y-POINTS") (:reactive nil))) (:window (:size (nil nil)) (:position (nil nil))) (:edition-params) (:value (:object (:class bpf) (:slots ((:onset 0) (:duration 45.0) (:interpol (:number-or-nil (:number 50) (:t-or-nil nil))) (:action nil) (:color (:color 0.0 0.0 0.0 1.0)) (:decimals 2) (:x-points (:list 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0)) (:y-points (:list 42.0 40.0 38.0 35.0 34.0 33.0 31.0 30.0 28.0 26.0 25.0 24.0 23.0 20.0 19.0 18.0 31.0 30.0 28.0 26.0 25.0 23.0 22.0 21.0 20.0 19.0 38.0 37.0 36.0 35.0 32.0 31.0 29.0 28.0 27.0 26.0 27.0 34.0 35.0 38.0 39.0 40.0 42.0 43.0 44.0 45.0)))) (:add-slots ((:name "BPF"))))) (:id 11)) (:box (:type :special) (:reference or) (:group-id nil) (:name "OR") (:x 239) (:y 317) (:w 64) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :optional) (:name "test-forms") (:value nil) (:reactive t)) (:input (:type :optional) (:name "test-forms") (:value nil) (:reactive t))) (:outputs (:output (:name "out") (:reactive t))) (:id 12)) (:box (:type :special) (:reference collect) (:group-id nil) (:name "collect") (:x 204) (:y 715/2) (:w 125) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "data-in") (:value nil) (:reactive t)) (:input (:type :standard) (:name "push") (:value nil) (:reactive t)) (:input (:type :standard) (:name "init") (:value nil) (:reactive t))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive t)) (:output (:name "init") (:reactive nil))) (:id 13)) (:comment (:x 57) (:y 576) (:w 144) (:h 39) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "See also LOOP-patches for more details and use cases") (:id 14)) (:box (:type :abstraction) (:reference (:patch (:name "loop-with-collect") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (697 418)) (:position (781 290))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 1) (:doc ""))) (:group-id nil) (:name "out") (:x 165) (:y 336) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 0)) (:box (:type :io) (:reference (:in (:type omin) (:index 1) (:name "in") (:doc ""))) (:group-id nil) (:name "in") (:x 91) (:y 61) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :optional) (:name "internal input value") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 1)) (:box (:type :special) (:reference collect) (:group-id nil) (:name "collect") (:x 89) (:y 233) (:w 111) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "data-in") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "push") (:value t) (:reactive nil)) (:input (:type :standard) (:name "init") (:value nil) (:reactive nil))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive nil)) (:output (:name "init") (:reactive nil))) (:id 2)) (:box (:type :value) (:reference cons) (:group-id nil) (:name "value box") (:x 62) (:y 18) (:w 58) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value (:list 6 7 8 9)) (:id 3)) (:box (:type :special) (:reference iterate) (:group-id nil) (:name "iterate") (:x 83) (:y 333) (:w 57) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 4)) (:box (:type :function) (:reference om*) (:group-id nil) (:name "om*") (:x 141) (:y 168) (:w 60) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "ARG1") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "ARG2") (:value 0) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 5)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 167) (:y 133) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 2) (:id 6)) (:comment (:x 152) (:y 16) (:w 120) (:h 53) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "<= default value for the input: test your loop \"from inside\"") (:id 7)) (:comment (:x 237) (:y 219) (:w 139) (:h 64) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "PULL collect outputs to 1) collect a value 2) read the collect memory 3) reinitialize the memory ") (:id 8)) (:box (:type :special) (:reference loop-list) (:group-id nil) (:name "list-loop") (:x 79) (:y 109) (:w 65) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "list") (:value nil) (:reactive nil))) (:outputs (:output (:name "i") (:reactive nil))) (:id 9))) (:connections (:connection (:from (:box 1 :out 0)) (:to (:box 9 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 2 :out 1)) (:to (:box 0 :in 0))) (:connection (:from (:box 3 :out 0)) (:to (:box 1 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 6 :out 0)) (:to (:box 5 :in 1))) (:connection (:from (:box 9 :out 0)) (:to (:box 5 :in 0)))))) (:group-id nil) (:name "loop-with-collect") (:x 230) (:y 535) (:w 121) (:h 105) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs (:input (:type :standard) (:name "in") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 15)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 370) (:y 308) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive t))) (:value t) (:id 16)) (:box (:type :abstraction) (:reference (:patch (:name "loop-with-timed-collect") (:doc "") (:info (:created nil) (:modified nil) (:by nil) (:version nil)) (:window (:size (626 454)) (:position (110 266))) (:grid nil) (:lock nil) (:boxes (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 1) (:doc ""))) (:group-id nil) (:name "out") (:x 311) (:y 312) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 0)) (:box (:type :io) (:reference (:out (:type omout) (:name "out") (:index 2) (:doc ""))) (:group-id nil) (:name "out") (:x 357) (:y 312) (:w 40) (:h 42) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 0.0)) (:t-or-nil t))) (:border 0) (:roundness 0) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "out-value") (:value nil) (:reactive nil))) (:outputs) (:id 1)) (:box (:type :special) (:reference iterate) (:group-id nil) (:name "iterate") (:x 120) (:y 306) (:w 142) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "action") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "action") (:value nil) (:reactive nil)) (:input (:type :optional) (:name "action") (:value nil) (:reactive nil))) (:outputs) (:id 2)) (:comment (:x 397) (:y 139) (:w 141) (:h 78) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "PULL collect outputs to 1) collect a value 2) read the collect memory 3) reinitialize the memory 4) collect the lime-list") (:id 3)) (:box (:type :special) (:reference loop-for) (:group-id nil) (:name "for") (:x 43) (:y 189) (:w 66) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.85 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "from") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "to") (:value 200) (:reactive nil))) (:outputs (:output (:name "i") (:reactive nil))) (:id 4)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 65) (:y 154) (:w 36) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 10) (:id 5)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 26) (:y 154) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1) (:id 6)) (:box (:type :function) (:reference sleep) (:group-id nil) (:name "sleep") (:x 154) (:y 206) (:w 64) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "TIME") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 7)) (:box (:type :function) (:reference om-random) (:group-id nil) (:name "om-random") (:x 138) (:y 168) (:w 96) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "LOW") (:value 0) (:reactive nil)) (:input (:type :standard) (:name "HIGH") (:value 1) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 8)) (:box (:type :value) (:reference single-float) (:group-id nil) (:name "value box") (:x 192) (:y 133) (:w 33) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0.5) (:id 9)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 148) (:y 133) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 0) (:id 10)) (:box (:type :value) (:reference symbol) (:group-id nil) (:name "value box") (:x 296) (:y 80) (:w 32) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value a) (:id 11)) (:box (:type :value) (:reference fixnum) (:group-id nil) (:name "value box") (:x 347) (:y 80) (:w 42) (:h 30) (:color (:color-or-nil (:color (:color 1.0 1.0 1.0 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:lock nil) (:inputs) (:outputs (:output (:name "value") (:reactive nil))) (:value 1000) (:id 12)) (:box (:type :function) (:reference print) (:group-id nil) (:name "print") (:x 40) (:y 255) (:w 62) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "SOMETHING") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive nil))) (:id 13)) (:comment (:x 268) (:y 36) (:w 169) (:h 34) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "COLLECTS IN CHUNKS OF 1000 ms computation time-windows") (:id 14)) (:box (:type :special) (:reference tcollect) (:group-id nil) (:name "tcollect") (:x 298) (:y 148) (:w 84) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "data-in") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "push") (:value t) (:reactive nil)) (:input (:type :standard) (:name "init") (:value nil) (:reactive nil)) (:input (:type :standard) (:name "delay") (:value 0) (:reactive nil))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive nil)) (:output (:name "init") (:reactive nil)) (:output (:name "time-list") (:reactive nil))) (:id 15))) (:connections (:connection (:from (:box 4 :out 0)) (:to (:box 13 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 4 :in 1))) (:connection (:from (:box 6 :out 0)) (:to (:box 4 :in 0))) (:connection (:from (:box 7 :out 0)) (:to (:box 2 :in 1))) (:connection (:from (:box 8 :out 0)) (:to (:box 7 :in 0))) (:connection (:from (:box 9 :out 0)) (:to (:box 8 :in 1))) (:connection (:from (:box 10 :out 0)) (:to (:box 8 :in 0))) (:connection (:from (:box 11 :out 0)) (:to (:box 15 :in 0))) (:connection (:from (:box 12 :out 0)) (:to (:box 15 :in 3))) (:connection (:from (:box 13 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 15 :out 0)) (:to (:box 2 :in 2))) (:connection (:from (:box 15 :out 1)) (:to (:box 0 :in 0))) (:connection (:from (:box 15 :out 2)) (:to (:box 1 :in 0)))))) (:group-id nil) (:name "loop-with-timed-collect") (:x 919) (:y 379) (:w 153) (:h 105) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:display :mini-view) (:lock nil) (:lambda nil) (:pre-delay 0) (:inputs) (:outputs (:output (:name "out") (:reactive nil)) (:output (:name "out") (:reactive nil))) (:id 17)) (:comment (:x 610) (:y 109) (:w 126) (:h 38) (:fgcolor nil) (:bgcolor nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:text "... best with a MIDI-IN or OSC-RECEIVE...") (:id 18)) (:box (:type :function) (:reference seq) (:group-id nil) (:name "seq") (:x 291) (:y 260) (:w 55) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "OP") (:value nil) (:reactive t)) (:input (:type :optional) (:name "op+") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t)) (:output (:name "op+1") (:reactive t))) (:id 19)) (:box (:type :function) (:reference seq) (:group-id nil) (:name "seq") (:x 189) (:y 266) (:w 55) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "OP") (:value nil) (:reactive t)) (:input (:type :optional) (:name "op+") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t)) (:output (:name "op+1") (:reactive t))) (:id 20)) (:box (:type :function) (:reference seq) (:group-id nil) (:name "seq") (:x 720) (:y 237) (:w 55) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "OP") (:value nil) (:reactive t)) (:input (:type :optional) (:name "op+") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t)) (:output (:name "op+1") (:reactive t))) (:id 21)) (:box (:type :function) (:reference seq) (:group-id nil) (:name "seq") (:x 544) (:y 244) (:w 55) (:h 30) (:color nil) (:border nil) (:roundness nil) (:text-font nil) (:align nil) (:icon :left) (:lock nil) (:lambda nil) (:inputs (:input (:type :standard) (:name "OP") (:value nil) (:reactive t)) (:input (:type :optional) (:name "op+") (:value nil) (:reactive nil))) (:outputs (:output (:name "out") (:reactive t)) (:output (:name "op+1") (:reactive t))) (:id 22)) (:box (:type :special) (:reference tcollect) (:group-id nil) (:name "tcollect") (:x 631) (:y 366) (:w 97) (:h 42) (:color (:color-or-nil (:color (:color 0.82 0.7 0.7 1.0)) (:t-or-nil t))) (:border nil) (:roundness nil) (:text-font nil) (:align :center) (:icon :top) (:inputs (:input (:type :standard) (:name "data-in") (:value nil) (:reactive t)) (:input (:type :standard) (:name "push") (:value t) (:reactive t)) (:input (:type :standard) (:name "init") (:value nil) (:reactive t)) (:input (:type :standard) (:name "delay") (:value 0) (:reactive nil))) (:outputs (:output (:name "collect") (:reactive nil)) (:output (:name "data-out") (:reactive t)) (:output (:name "init") (:reactive nil)) (:output (:name "time-list") (:reactive nil))) (:id 23))) (:connections (:connection (:from (:box 0 :out 0)) (:to (:box 2 :in 0))) (:connection (:from (:box 2 :out 0)) (:to (:box 22 :in 0))) (:connection (:from (:box 3 :out 0)) (:to (:box 2 :in 1))) (:connection (:from (:box 4 :out 0)) (:to (:box 21 :in 0))) (:connection (:from (:box 5 :out 0)) (:to (:box 23 :in 1))) (:connection (:from (:box 6 :out 0)) (:to (:box 23 :in 3))) (:connection (:from (:box 9 :out 0)) (:to (:box 20 :in 0))) (:connection (:from (:box 10 :out 0)) (:to (:box 19 :in 0))) (:connection (:from (:box 12 :out 0)) (:to (:box 13 :in 1))) (:connection (:from (:box 13 :out 1)) (:to (:box 11 :in 2)) (:attributes (:color nil :style nil :modif (0 0)))) (:connection (:from (:box 19 :out 0)) (:to (:box 13 :in 2))) (:connection (:from (:box 19 :out 1)) (:to (:box 12 :in 1))) (:connection (:from (:box 20 :out 0)) (:to (:box 13 :in 0))) (:connection (:from (:box 20 :out 1)) (:to (:box 12 :in 0))) (:connection (:from (:box 21 :out 0)) (:to (:box 23 :in 2))) (:connection (:from (:box 21 :out 1)) (:to (:box 5 :in 1))) (:connection (:from (:box 22 :out 0)) (:to (:box 23 :in 0))) (:connection (:from (:box 22 :out 1)) (:to (:box 5 :in 0))) (:connection (:from (:box 23 :out 1)) (:to (:box 1 :in 1))) (:connection (:from (:box 23 :out 3)) (:to (:box 1 :in 2)))))
34,938
Common Lisp
.l
1,547
15.826115
73
0.46237
cac-t-u-s/om-sharp
167
14
31
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
312e3cf98ef1b0fa82935a785bd306f2e5a83a8021518e613b8fd70c13ca28df
1,419
[ -1 ]
1,434
package.lisp
ghollisjr_cl-ana/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana (:use :cl)) (in-package :cl-ana) (defvar *cl-ana-package-names* (list :cl-ana.pathname-utils :cl-ana.package-utils :cl-ana.generic-math :cl-ana.binary-tree :cl-ana.csv-table :cl-ana.math-functions :cl-ana.calculus :cl-ana.spline :cl-ana.tensor :cl-ana.error-propogation :cl-ana.quantity :cl-ana.file-utils :cl-ana.fitting :cl-ana.functional-utils :cl-ana.gnuplot-interface :cl-ana.gsl-cffi :cl-ana.hdf-table :cl-ana.hdf-typespec :cl-ana.hdf-utils :cl-ana.histogram :cl-ana.linear-algebra :cl-ana.list-utils :cl-ana.array-utils :cl-ana.lorentz :cl-ana.macro-utils :cl-ana.map :cl-ana.hash-table-utils :cl-ana.memoization :cl-ana.ntuple-table :cl-ana.plotting :cl-ana.reusable-table :cl-ana.statistics :cl-ana.statistical-learning :cl-ana.string-utils :cl-ana.symbol-utils :cl-ana.symbol-utils :cl-ana.table :cl-ana.table-utils :cl-ana.table-viewing :cl-ana.typed-table :cl-ana.typespec :cl-ana.int-char :cl-ana.clos-utils :cl-ana.serialization ;; makeres: :cl-ana.makeres :cl-ana.makeres-macro :cl-ana.makeres-block :cl-ana.makeres-progress :cl-ana.makeres-table :cl-ana.makeres-graphviz :cl-ana.makeres-branch :cl-ana.makeres-utils)) (loop for p in *cl-ana-package-names* do (cl-ana.package-utils:add-package-to-group p :cl-ana)) (cl-ana.package-utils:use-package-group :cl-ana)
2,603
Common Lisp
.lisp
81
25.765432
70
0.628923
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
611954f629496fdb2cca3878fe53d05fcc1efaee7730a5f7f2a5bc8f3945dcd4
1,434
[ -1 ]
1,435
install.lisp
ghollisjr_cl-ana/install.lisp
(require 'quicklisp) (ql:quickload "cffi") (ql:quickload "gsll") (ql:quickload "alexandria") (ql:quickload "iterate") (ql:quickload "antik") (ql:quickload "closer-mop") (ql:quickload "cl-csv") (ql:quickload "cl-fad") (ql:quickload "external-program")
252
Common Lisp
.lisp
10
24.1
33
0.742739
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
2f850d4e10041135834a4707a18f4ec7e56430a7edfa4cf54a47ee50156aa05a
1,435
[ -1 ]
1,436
package.lisp
ghollisjr_cl-ana/string-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.string-utils (:use :cl) (:export :lines :unlines :mkstr :lispify :string-append :words))
1,043
Common Lisp
.lisp
28
33.928571
70
0.67357
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
bb18169a7e482096a72022c22507f054dddca2e0e44907aad83f248918fe7e18
1,436
[ -1 ]
1,437
string-utils.lisp
ghollisjr_cl-ana/string-utils/string-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.string-utils) (defun lispify (symbol-or-string) "Converts symbol or string into a string and replaces all spaces and underscores with -, and convert to uppercase." (string-upcase (map 'string (lambda (c) (case c (#\Space #\-) (#\_ #\-) (otherwise c))) (string symbol-or-string)))) (defun string-append (&rest strings) (apply #'concatenate 'string strings)) ;; Working with lines: (defun lines (string) "Splits a string into a list of the lines comprising the string." (flet ((cut-newline (s) (let ((length (length s))) (if (not (zerop length)) (if (char= #\Newline (elt s (1- length))) (subseq s 0 (1- length)) s) "")))) (split-sequence:split-sequence #\Newline (cut-newline string)))) (defun unlines (lines &optional (trailing-newline-p t)) "Joins a list of lines into original string, with optional trailing newline." (if (null lines) "" (let ((result (reduce (lambda (str line) (string-append str (string #\Newline) line)) (rest lines) :initial-value (first lines)))) (if trailing-newline-p (string-append result (string #\Newline)) result)))) ;; Useful for getting the words out of a string: (defun words (string) "Returns the read words (symbols, numbers, etc.) contained in a string" (with-input-from-string (s string) (do ((w (read s nil nil) (read s nil nil)) (res nil (cons w res))) ((null w) (nreverse res))))) ;;;; From let-over-lambda: (defun mkstr (&rest args) (let ((*print-pretty* nil)) (with-output-to-string (s) (dolist (a args) (princ a s)))))
2,864
Common Lisp
.lisp
75
30.52
70
0.585971
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9928721ba512d9f5f241a0ea2140266fcbb91d3b82b74fde857382e56511548f
1,437
[ -1 ]
1,438
package.lisp
ghollisjr_cl-ana/functional-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.functional-utils (:use :cl) (:export :flip :splice :to-pair-function :lfuncall :min-by :minimum :max-by :maximum :iterate :iterate-collect :safe-funcall))
1,150
Common Lisp
.lisp
33
30.636364
70
0.657706
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
01374d90148f9a8038efaefa20d5980c843e2f12f14e8f3f936e735fa0478b78
1,438
[ -1 ]
1,439
functional-utils.lisp
ghollisjr_cl-ana/functional-utils/functional-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.functional-utils) (defun flip (f) "Takes a function of two parameters and creates a new function which takes the same parameters in reverse order; particularly useful in conjunction with reduce." (lambda (x y) (funcall f y x))) (defun splice (xsplit fn1 fn2) "Splices two functions togother at xsplit. If either function is nil, returns the other function or nil if both are nil." (cond ((and fn1 fn2) (lambda (x) (if (<= x xsplit) (funcall fn1 x) (funcall fn2 x)))) (fn1 fn1) (fn2 fn2) (t nil))) ;; (defun compose (&rest fs) ;; "Arbitrary number of functions composed" ;; (let ((f (first fs))) ;; (if (= 1 (length fs)) ;; (first fs) ;; (lambda (&rest xs) ;; (funcall f (apply (apply #'compose (rest fs)) xs)))))) (defun to-pair-function (f) "Makes f apply to a pair instead of two arguments" (lambda (x) (funcall f (car x ) (cdr x)))) (defun lfuncall (fn &rest args) "Applies a function which takes a single list argument to an arbitrary number of arguments." (funcall fn args)) ;; Didn't really know where to put these, but they are higher-order ;; functions: (defun min-by (x y &key (key #'identity)) (if (< (funcall key x) (funcall key y)) x y)) (defun minimum (xs &key (key #'identity)) (when xs (reduce (lambda (x y) (min-by x y :key key)) xs))) (defun max-by (x y &key (key #'identity)) (if (> (funcall key x) (funcall key y)) x y)) (defun maximum (xs &key (key #'identity)) (when xs (reduce (lambda (x y) (max-by x y :key key)) xs))) (defun iterate (fn initial count) "Calls a function on its own result for count iterations. Returns the final result." (do* ((i 1 (1+ i)) (fnval initial (funcall fn fnval))) ((> i count) fnval))) (defun iterate-collect (fn initial count) "Calls a function on its own result for count iterations. Returns the full list of results." (do* ((i 1 (1+ i)) (fnval initial (funcall fn fnval)) (result nil (cons fnval result))) ((> i count) (nreverse result)))) (defun safe-funcall (key-args &rest args) "Only calls a function when it is in fact a function, and returns all other objects." (if (functionp key-args) (apply key-args args) key-args))
3,229
Common Lisp
.lisp
92
31.467391
70
0.655139
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
842eb25c0d8c45983d417f34b1186bf0e0bd50c17839721b8c83767fc4244604
1,439
[ -1 ]
1,440
package.lisp
ghollisjr_cl-ana/makeres-progress/package.lisp
;;;; makeres-progress is a Common Lisp make-like tool for computations. ;;;; Copyright 2015 Gary Hollis ;;;; ;;;; This file is part of makeres-progress. ;;;; ;;;; makeres-progress is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; makeres-progress is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with makeres-progress. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis via email at ;;;; [email protected] (defpackage #:cl-ana.makeres-progress (:use :cl :cl-ana.makeres) (:export :progresstrans :*makeres-progress-results-only-p*)) (cl-ana.gmath:use-gmath :cl-ana.makeres-progress)
1,121
Common Lisp
.lisp
26
41
80
0.720952
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
66b6f2ac6be5b6b779b1b4b92cbadccc9543ae78aee8cb07bb536c03a922e468
1,440
[ -1 ]
1,441
progresstrans.lisp
ghollisjr_cl-ana/makeres-progress/progresstrans.lisp
;;;; makeres-progress is a Common Lisp make-like tool for computations. ;;;; Copyright 2014 Gary Hollis ;;;; ;;;; This file is part of makeres-progress. ;;;; ;;;; makeres-progress is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; makeres-progress is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with makeres-progress. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis via email at ;;;; [email protected] (in-package :cl-ana.makeres-progress) (defparameter *makeres-progress-results-only-p* t "Set to nil if you want progresstrans to print messages for every target in given table, not just the ones also present in the project target table (meaning that internal-use-only targets will have their strange names printed).") (defun progresstrans (target-table) "Adds status printing message to any targets present in both target-table and the project target table unless *makeres-progress-results-only-p* is nil. See *makeres-progress-results-only-p* for more details." (let ((result-table (make-hash-table :test 'equal)) (progress-ids (if *makeres-progress-results-only-p* (loop for id being the hash-keys in (target-table) collecting id) ;; subtle difference, read carefully (loop for id being the hash-keys in target-table collecting id)))) (loop for id being the hash-keys in target-table do (if (member id progress-ids :test #'equal) (let* ((target (gethash id target-table)) (expr (target-expr target))) (setf (gethash id result-table) (make-target id `(progn (let ((*print-pretty* nil)) (format t "Computing ~s~%" ',id)) ,expr) :val (target-val target) :stat (target-stat target) :timestamp (target-timestamp target)))) (setf (gethash id result-table) (if *copy-target-table-p* (copy-target (gethash id target-table)) (gethash id target-table))))) result-table))
2,883
Common Lisp
.lisp
62
35.774194
80
0.596877
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
196dbbbc711f6de53925b121d5dfe3151188906d7d1a4cdbcfeef62c42e289dd
1,441
[ -1 ]
1,442
test.lisp
ghollisjr_cl-ana/makeres-progress/test.lisp
(require 'cl-ana) (in-package :cl-ana) (in-project makeres-progress-test) (settrans (list #'progresstrans) :op :set) (defres a (list 1 2 3)) (defres b (list 2 3 4)) (defres c (+ (res a) (res b)))
213
Common Lisp
.lisp
11
16.818182
42
0.647959
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
0d6aa33140f0699162eb98ad828a73c21b16abb561f06407e16e2bc4ee555dcc
1,442
[ -1 ]
1,443
package.lisp
ghollisjr_cl-ana/serialization/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.serialization (:use :cl :cffi :cl-ana.histogram :cl-ana.int-char :cl-ana.hdf-utils :cl-ana.error-propogation :cl-ana.macro-utils :cl-ana.typespec :cl-ana.table :cl-ana.hdf-table) (:export :write-histogram :read-histogram))
1,204
Common Lisp
.lisp
33
32.69697
70
0.671795
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
5824c075c996d33030eaa193b972b300db056ae435d4bac033ca27cd42595182
1,443
[ -1 ]
1,444
test.lisp
ghollisjr_cl-ana/serialization/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana) (in-package :cl-ana) (defun write-histogram-test () (with-open-hdf-file (file "/home/ghollisjr/hist.h5" :direction :output :if-exists :supersede :if-does-not-exist :create) (write-histogram (make-contiguous-hist (list (list :name "x" :low -5d0 :high 5d0 :nbins 10))) file "/histogram"))) (defun read-histogram-test () (with-open-hdf-file (file "/home/ghollisjr/hist.h5" :direction :input :if-does-not-exist :error) (read-histogram file "/histogram")))
1,630
Common Lisp
.lisp
39
33.307692
70
0.592943
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
5d9eb777fe8b57c9fb4e8439d0c1f7ebcfa502f22363e74eb04ccf7b103b231c
1,444
[ -1 ]
1,445
histogram.lisp
ghollisjr_cl-ana/serialization/histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.serialization) (defparameter *histogram-data-path* "data") (defparameter *histogram-bin-spec-path* "bin-specs") (defun ->double-float (x) (float x 0d0)) (defun write-histogram (histogram file hdf-path) "Writes histogram to file. Supports histogram count values with errors as well as simple numerical values. Note that this function assumes that either all the dimensions have names or none of them do." (hdf-mkgroup file hdf-path) (flet ((subpath (path) (concatenate 'string hdf-path "/" path))) (let* ((raw-data (hist-bin-values histogram)) (errors? (typep (first (first raw-data)) 'err-num)) (data (if (not errors?) raw-data (mapcar (lambda (datum) (destructuring-bind (count &rest xs) datum (list* (err-num-value count) (err-num-error count) xs))) raw-data))) (data-names-specs ;; had to change this to double-float to allow for ;; normalized histograms etc. (append (if errors? (list (cons "count" :double) (cons "count-error" :double)) (list (cons "count" :double))) (loop for i from 0 for n in (hist-dim-names histogram) collect (cons (if n n (with-output-to-string (s) (format s "x~a" i))) :double)))) (data-table-path (subpath *histogram-data-path*)) (data-table (create-hdf-table file data-table-path data-names-specs)) (data-field-symbols (table-field-symbols data-table)) (hist-dim-specs (let ((result (hist-dim-specs histogram))) (loop for plist in result for i from 0 do (when (not (getf plist :name)) (setf (getf plist :name) (with-output-to-string (s) (format s "x~a" i))))) result)) (bin-spec-table-path (subpath *histogram-bin-spec-path*)) (max-string-length (loop for plist in hist-dim-specs maximizing (length (getf plist :name)))) (bin-spec-names-specs (list (cons "name" (list :array :char max-string-length)) (cons "name-length" :int) (cons "nbins" :int) (cons "low" :double) (cons "high" :double))) (bin-spec-table (create-hdf-table file bin-spec-table-path bin-spec-names-specs))) ;; write data table (loop for datum in data do (progn (loop for i from 0 for field in datum for sym in data-field-symbols do (table-set-field data-table sym (->double-float field))) (table-commit-row data-table))) (table-close data-table) ;; write bin-spec table ;; fix plists (loop for plist in hist-dim-specs for i from 0 do (when (not (getf plist :name)) (setf (getf plist :name) (with-output-to-string (s) (format s "x~a" i))))) (loop for plist in hist-dim-specs do (progn (table-push-fields bin-spec-table (|name| (getf plist :name)) (|name-length| (length (getf plist :name))) (|nbins| (getf plist :nbins)) (|low| (->double-float (getf plist :low))) (|high| (->double-float (getf plist :high)))))) (table-close bin-spec-table)))) ;; utility function (defun h5tget-member-name-as-lisp-string (hdf-type i) (let* ((name (hdf5:h5tget-member-name hdf-type i)) (lisp-name (cffi:foreign-string-to-lisp name))) (cffi:foreign-free name) lisp-name)) ;; new version which uses raw HDF5 functions (defun read-histogram (file hdf-path &optional (type :sparse)) "Reads a histogram from an hdf-table with file and path. type can be either :contiguous or :sparse for contiguous-histogram and sparse-histogram respectively." (flet ((subpath (path) (concatenate 'string hdf-path "/" path))) (let* ((binspec-path (subpath *histogram-bin-spec-path*)) (binspec-dataset (hdf5:h5dopen2 file binspec-path hdf5:+H5P-DEFAULT+)) (binspec-datatype (hdf5:h5dget-type binspec-dataset)) (binspec-dataspace (hdf5:h5dget-space binspec-dataset)) (data-path (subpath *histogram-data-path*)) (data-dataset (hdf5:h5dopen2 file data-path hdf5:+H5P-DEFAULT+)) (data-datatype (hdf5:h5dget-type data-dataset)) (data-dataspace (hdf5:h5dget-space data-dataset)) binspec-chunk-size nrows ndims binspec-row-size binspec-buffer-size binspecs data-chunk-size data-row-size data-buffer-size memspace n-count-vars hist) (with-foreign-objects ((binspec-dataset-dims 'hdf5:hsize-t) (binspec-chunk-dims 'hdf5:hsize-t) (binspec-name-dims 'hdf5:hsize-t) (data-dataset-dims 'hdf5:hsize-t) (data-chunk-dims 'hdf5:hsize-t) (memspace-dims 'hdf5:hsize-t) (memspace-maxdims 'hdf5:hsize-t)) (let ((create-plist (hdf5:h5dget-create-plist binspec-dataset))) (hdf5:h5pget-chunk create-plist 1 binspec-chunk-dims)) (setf binspec-chunk-size (mem-aref binspec-chunk-dims 'hdf5:hsize-t)) (hdf5:h5sget-simple-extent-dims binspec-dataspace binspec-dataset-dims (null-pointer)) (setf ndims (mem-aref binspec-dataset-dims 'hdf5:hsize-t)) (hdf5:h5tget-array-dims2 (hdf5:h5tget-member-type binspec-datatype 0) binspec-name-dims) (setf binspec-row-size (hdf5:h5tget-size binspec-datatype)) (setf binspec-buffer-size (* binspec-chunk-size binspec-row-size)) (with-foreign-object (buffer :char binspec-buffer-size) (loop for chunk-index from 0 while (< (* chunk-index binspec-buffer-size) ndims) do (let ((remaining-rows (- ndims (* chunk-index binspec-chunk-size)))) (if (< remaining-rows binspec-chunk-size) (setf (mem-aref memspace-dims 'hdf5:hsize-t 0) remaining-rows) (setf (mem-aref memspace-dims 'hdf5:hsize-t 0) binspec-chunk-size))) (setf (mem-aref memspace-maxdims 'hdf5:hsize-t) (mem-aref memspace-dims 'hdf5:hsize-t)) (with-foreign-objects ((start 'hdf5:hsize-t) (stride 'hdf5:hsize-t) (cnt 'hdf5:hsize-t) (blck 'hdf5:hsize-t)) (setf (mem-aref start 'hdf5:hsize-t) (* chunk-index binspec-chunk-size)) (setf (mem-aref stride 'hdf5:hsize-t) 1) (setf (mem-aref cnt 'hdf5:hsize-t) 1) (setf (mem-aref blck 'hdf5:hsize-t) (mem-aref memspace-dims 'hdf5:hsize-t)) (hdf5:h5sselect-hyperslab binspec-dataspace :H5S-SELECT-SET start stride cnt blck) (setf memspace (hdf5:h5screate-simple 1 memspace-dims memspace-maxdims)) (hdf5:h5dread binspec-dataset binspec-datatype memspace binspec-dataspace hdf5:+H5P-DEFAULT+ buffer) (loop for i from 0 below (mem-aref memspace-dims 'hdf5:hsize-t) do (let* ((buffer-index (+ (* i binspec-row-size) (* binspec-chunk-size chunk-index))) (name-length (mem-aref (mem-aptr buffer :char (+ (hdf5:h5tget-member-offset binspec-datatype 1) buffer-index)) :int)) (name (let ((result (make-string name-length))) (loop for j below name-length do (setf (aref result j) (int-char (mem-aref buffer :char (+ (hdf5:h5tget-member-offset binspec-datatype 0) buffer-index j))))) result)) (nbins (mem-aref (mem-aptr buffer :char (+ (hdf5:h5tget-member-offset binspec-datatype 2) buffer-index)) :int)) (low (mem-aref (mem-aptr buffer :char (+ (hdf5:h5tget-member-offset binspec-datatype 3) buffer-index)) :double)) (high (mem-aref (mem-aptr buffer :char (+ (hdf5:h5tget-member-offset binspec-datatype 4) buffer-index)) :double))) (push (list :name name :nbins nbins :low low :high high) binspecs))) (setf binspecs (nreverse binspecs)) (setf hist (if (eq type :sparse) (make-sparse-hist binspecs) (make-contiguous-hist binspecs)))))) (let ((create-plist (hdf5:h5dget-create-plist data-dataset))) (hdf5:h5pget-chunk create-plist 1 data-chunk-dims)) (setf data-chunk-size (mem-aref data-chunk-dims 'hdf5:hsize-t)) (hdf5:h5sget-simple-extent-dims data-dataspace data-dataset-dims (null-pointer)) (setf nrows (mem-aref data-dataset-dims 'hdf5:hsize-t)) (let ((second-field-name (h5tget-member-name-as-lisp-string data-datatype 1))) (if (equal second-field-name "count-error") (progn (setf n-count-vars 2) (if (eq type :sparse) (setf hist (make-sparse-hist binspecs :empty-bin-value (+- 0 0) :default-increment (+- 1 1))) (setf hist (make-contiguous-hist binspecs :empty-bin-value (+- 0 0) :default-increment (+- 1 1))))) (setf n-count-vars 1))) (setf data-row-size (hdf5:h5tget-size data-datatype)) (setf data-buffer-size (* data-row-size (mem-aref data-dataset-dims 'hdf5:hsize-t))) (with-foreign-object (buffer :char data-buffer-size) (setf (mem-aref memspace-dims 'hdf5:hsize-t) (mem-aref data-dataset-dims 'hdf5:hsize-t)) (setf (mem-aref memspace-maxdims 'hdf5:hsize-t) (mem-aref memspace-dims 'hdf5:hsize-t)) (with-foreign-objects ((start 'hdf5:hsize-t) (stride 'hdf5:hsize-t) (cnt 'hdf5:hsize-t) (blck 'hdf5:hsize-t)) (setf (mem-aref start 'hdf5:hsize-t) 0) (setf (mem-aref stride 'hdf5:hsize-t) 1) (setf (mem-aref cnt 'hdf5:hsize-t) 1) (setf (mem-aref blck 'hdf5:hsize-t) (mem-aref memspace-dims 'hdf5:hsize-t)) (hdf5:h5sselect-hyperslab data-dataspace :H5S-SELECT-SET start stride cnt blck) (setf memspace (hdf5:h5screate-simple 1 memspace-dims memspace-maxdims)) (hdf5:h5dread data-dataset data-datatype memspace data-dataspace hdf5:+H5P-DEFAULT+ buffer) (loop for i below (mem-aref memspace-dims 'hdf5:hsize-t) do (let* ((buffer-index (* i data-row-size)) (count (case n-count-vars (1 (mem-aref (mem-aptr buffer :char (+ buffer-index (hdf5:h5tget-member-offset data-datatype 0))) :double)) (2 (+- (mem-aref (mem-aptr buffer :char (+ buffer-index (hdf5:h5tget-member-offset data-datatype 0))) :double) (mem-aref (mem-aptr buffer :char (+ buffer-index (hdf5:h5tget-member-offset data-datatype 1))) :double))))) (xs (loop for dim from 0 below ndims collecting (mem-aref (mem-aptr buffer :char (+ buffer-index (hdf5:h5tget-member-offset data-datatype (+ n-count-vars dim)))) :double)))) (hins hist xs count)))))) hist))) ;;;; This version will work again (with possible modification to ;;;; function arguments) once the hdf-table library supports arbitrary ;;;; compound type structures and not just those produced by the C ;;;; compiler. (defun old-read-histogram (file hdf-path &optional (type :sparse)) "Reads a histogram from an hdf-table with file and path. type can be either :contiguous or :sparse for contiguous-histogram and sparse-histogram respectively." (flet ((subpath (path) (concatenate 'string hdf-path "/" path))) (let* ((bin-spec-table (open-hdf-table file (subpath *histogram-bin-spec-path*))) (bin-spec-table-field-names (list "name" "name-length" "low" "high" "nbins")) (hist-dim-specs (let ((result ())) (table-reduce bin-spec-table bin-spec-table-field-names (lambda (state name name-length low high nbins) (push (list :name (char-vector->string name name-length) :low low :high high :nbins nbins) result))) (nreverse result))) (histogram (cond ((equal type :contiguous) (make-contiguous-hist hist-dim-specs)) ((equal type :sparse) (make-sparse-hist hist-dim-specs)) (t (error "Must specify :contiguous or :sparse for type.")))) (data-table (open-hdf-table file (subpath *histogram-data-path*))) (data-table-field-names (table-field-names data-table))) (if (equal (second data-table-field-names) "count-error") (table-reduce data-table data-table-field-names (lambda (state count count-error &rest xs) (hist-insert histogram xs (+- count count-error)))) (table-reduce data-table data-table-field-names (lambda (state count &rest xs) (hist-insert histogram xs count)))) (table-close bin-spec-table) (table-close data-table) histogram)))
20,828
Common Lisp
.lisp
461
23.952278
88
0.41158
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
d79db6acce038a0cb1012da103ce41d095fa73ce0d9dcfd0dcb8f422c02bb3c0
1,445
[ -1 ]
1,446
hdf-table-chain.lisp
ghollisjr_cl-ana/hdf-table/hdf-table-chain.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.hdf-table) (declaim (optimize (speed 2) (safety 1) (compilation-speed 0) (debug 1))) ;;;; hdf-table-chain: A read-only chain of hdf-tables which can be ;;;; randomly accessed unlike the general table-chain. (defclass hdf-table-chain (table) ((dataset-path :initform "" :initarg :dataset-path :accessor hdf-table-chain-dataset-path :documentation "Path to dataset within each file. The path should be uniform if the hdf files truly are a chain.") (active-table ; hdf-table in-memory :initform () :accessor hdf-table-chain-active-table :documentation "The in-memory hdf-table") (active-file ; hdf-file currently opened :initform nil :accessor hdf-table-chain-active-file :documentation "hdf-file currently opened by the active hdf-table.") (file-paths :initform () :initarg :file-paths :accessor hdf-table-chain-file-paths :documentation "List of file-paths which contain one hdf-table each") (table-lengths :initform () :initarg :table-lengths :accessor hdf-table-chain-table-lengths :documentation "Length (in indices) of each table") (table-index-offsets :initform () :initarg :index-offsets :accessor hdf-table-chain-table-index-offsets :documentation "Start indexes for each table") (current-table-index :initform -1 :accessor hdf-table-chain-current-table-index :type integer :documentation "index for in-memory hdf-table in (virtual) list of tables") (current-table-start :initform -1 :accessor hdf-table-chain-current-table-start :type integer :documentation "starting row index for the current table") (current-table-end :initform -1 :accessor hdf-table-chain-current-table-end :type integer :documentation "last row index for the current table") (table-index-binary-tree :initform () :initarg :binary-tree :accessor hdf-table-chain-binary-tree :documentation "binary search tree storing the indeces for efficient searching") (read-row-index :initarg :read-row-index :initform -1 :accessor hdf-table-chain-read-row-index :documentation "Index to row which should be sequentually read next") (nrows :initarg :nrows :initform nil :accessor hdf-table-chain-nrows :documentation "number of rows in hdf-table"))) ;; table-nrows method: (defmethod table-nrows ((table hdf-table-chain)) (hdf-table-chain-nrows table)) ;; initialization: ;; For each path, read the dataset and get the number of entries in ;; each. Use this to create the offset list. Use the offset list to ;; create the hdf-table-chain-binary-tree. Use this to create (defun open-hdf-table-chain (filename-list dataset-path) "Creates and initializes hdf-table-chain given the filename-list and dataset-path" (labels ((get-nrows (filename dset-path) (with-open-hdf-file (file filename :direction :input) (let* ((dataset (hdf5:h5dopen2 file dset-path hdf5:+H5P-DEFAULT+)) (dataspace (hdf5:h5dget-space dataset)) (result (with-foreign-objects ((space-dim 'hsize-t 1) (space-max-dim 'hsize-t 1)) (hdf5:h5sget-simple-extent-dims dataspace space-dim space-max-dim) (mem-aref space-dim 'hsize-t 0)))) (hdf5:h5sclose dataspace) (hdf5:h5dclose dataset) result))) (get-field-names (filename dataset-path) (with-open-hdf-file (hdf-file filename :direction :input) (let* ((hdf-table (open-hdf-table hdf-file dataset-path)) (result (table-field-names hdf-table))) (table-close hdf-table) result))) (get-field-specs (filename dataset-path) (with-open-hdf-file (hdf-file filename :direction :input) (let* ((hdf-table (open-hdf-table hdf-file dataset-path)) (result (table-field-specs hdf-table))) (table-close hdf-table) result)))) (let* ((file-nrows (mapcar (lambda (filename) (get-nrows filename dataset-path)) filename-list)) (offsets (make-offsets file-nrows)) (index-binary-tree (make-index-binary-tree offsets)) (table (make-instance 'hdf-table-chain :field-names (get-field-names (first filename-list) dataset-path) ;; :field-specs (get-field-specs ;; (first filename-list) ;; dataset-path) :dataset-path dataset-path :file-paths filename-list :index-offsets offsets :table-lengths file-nrows :binary-tree index-binary-tree :nrows (reduce #'+ file-nrows)))) (let* ((current-table (hdf-table-chain-active-table table)) (table-index 0) (filename (elt (hdf-table-chain-file-paths table) table-index)) (dataset-path (hdf-table-chain-dataset-path table))) (setf (hdf-table-chain-active-file table) (open-hdf-file filename :direction :input)) (setf (hdf-table-chain-active-table table) (open-hdf-table (hdf-table-chain-active-file table) dataset-path)) (setf (hdf-table-chain-current-table-start table) (elt (hdf-table-chain-table-index-offsets table) table-index)) (setf (hdf-table-chain-current-table-end table) (+ (the integer (elt (hdf-table-chain-table-lengths table) table-index)) (hdf-table-chain-current-table-start table) -1)) table)))) ;; finalization: (defmethod table-close ((table-chain hdf-table-chain)) "Closes the active hdf-table & file" (with-accessors ((active-table hdf-table-chain-active-table) (active-file hdf-table-chain-active-file)) table-chain (table-close active-table) (close-hdf-file active-file))) ;; table-get-field: ;; Procedure is to first check if index is within bounds. If so, ;; create table-index from raw index and call table-get-field on ;; the active table. If not, get table index from the raw index, get ;; the file path using this index, and read the appropriate table into ;; memory using open-hdf-table with the file path and dataset ;; path. Then store the appropriate current-table-start/end and ;; change the table index to match the new in-memory table. This ;; should be done before the call to table-get-field on the ;; active table. (defmethod table-get-field ((table hdf-table-chain) field-symbol) (with-accessors ((active-table hdf-table-chain-active-table)) table (table-get-field active-table field-symbol))) (defmethod table-load-next-row ((table hdf-table-chain)) (with-accessors ((row-number hdf-table-chain-read-row-index) (nrows hdf-table-chain-nrows)) table (incf row-number) (when (< row-number nrows) (let* ((current-table-start (hdf-table-chain-current-table-start table)) (current-table-end (hdf-table-chain-current-table-end table))) (declare (integer current-table-start current-table-end)) (if (<= current-table-start row-number current-table-end) (table-load-next-row (hdf-table-chain-active-table table)) (let* ((current-table (hdf-table-chain-active-table table)) (table-index (get-tree-index (hdf-table-chain-binary-tree table) row-number)) (filename (elt (hdf-table-chain-file-paths table) table-index)) (dataset-path (hdf-table-chain-dataset-path table))) ;; free resources from previous table: (when current-table (table-close current-table) (close-hdf-file (hdf-table-chain-active-file table))) ;; establish next table: (setf (hdf-table-chain-active-file table) (open-hdf-file filename :direction :input)) (setf (hdf-table-chain-active-table table) (open-hdf-table (hdf-table-chain-active-file table) dataset-path)) (setf (hdf-table-chain-current-table-start table) (elt (hdf-table-chain-table-index-offsets table) table-index)) (setf (hdf-table-chain-current-table-end table) (+ (the integer (elt (hdf-table-chain-table-lengths table) table-index)) (hdf-table-chain-current-table-start table) -1)) (table-load-next-row (hdf-table-chain-active-table table)))))))) (defmethod table-field-specs ((table hdf-table-chain)) (with-slots (active-table) table (table-field-specs active-table))) ;;; Behind the scenes functions: (defun make-index-binary-tree (offsets) (let ((offsets-copy (copy-list offsets))) (make-balanced-tree (zip (sort offsets-copy #'<) (range 0 (1- (length offsets-copy)))) :test #'equal :sorted t :key #'car))) ;; if this returns nil, the table index is 0 (defun get-tree-index (binary-tree row-index) (declare (integer row-index)) (labels ((get-tree-index-worker (binary-tree row-index lastright) (declare (integer row-index)) (if binary-tree (let* ((node-value (node-value binary-tree)) (node-start-index (car node-value))) (declare (integer node-start-index)) (cond ((< row-index node-start-index) (get-tree-index-worker (node-left-child binary-tree) row-index lastright)) ((= row-index node-start-index) (cdr node-value)) (t (get-tree-index-worker (node-right-child binary-tree) row-index (cdr node-value))))) (if lastright lastright 0)))) (get-tree-index-worker binary-tree row-index nil)))
11,799
Common Lisp
.lisp
285
31.175439
79
0.593617
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9cf3f694c08d6efaddc8b91f9a156c92f8af7d1de495867eb4a993b614d1b470
1,446
[ -1 ]
1,447
package.lisp
ghollisjr_cl-ana/hdf-table/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.hdf-table (:use #:cl #:cffi #:alexandria #:hdf5 #:cl-ana.list-utils #:cl-ana.hdf-utils #:cl-ana.table #:cl-ana.typed-table #:cl-ana.typespec #:cl-ana.hdf-typespec #:cl-ana.string-utils #:cl-ana.functional-utils #:cl-ana.binary-tree #:cl-ana.memoization) (:export :hdf-table :hdf-table-nrows :open-hdf-table :create-hdf-table :hdf-table-chain :hdf-table-chain-nrows :open-hdf-table-chain))
1,374
Common Lisp
.lisp
42
29.428571
70
0.676183
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
b5af1a8f247b61349219305c70904c2b66f0ada8faedc7ffde8ede39552d2eb6
1,447
[ -1 ]
1,448
hdf-table.lisp
ghollisjr_cl-ana/hdf-table/hdf-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.hdf-table) ;;; NOTE: HDF5 types are left open forever. I tried to implement a ;;; system of closing types and re-opening them on a table-by-table ;;; basis, but it turned out to be a complete hassle, so I'm leaving ;;; them open forever once opened at the moment. In the future this ;;; could be revisited. It poses only minimal memory overhead since ;;; I've memoized the typespec functions so that only one HDF5 type is ;;; used per typespec. I believe the HDF5 type closing mechanism is ;;; for safety in situations where it isn't so easy to memoize ;;; functions. (declaim (optimize (speed 2) (safety 1) (compilation-speed 0) (debug 1))) (defclass hdf-table (typed-table) ((row-buffer-size :initarg :buffer-size :initform nil :accessor hdf-table-buffer-size :documentation "buffer size in number of rows") (chunk-index :initarg :chunk-index :initform -1 :accessor hdf-table-chunk-index :documentation "index to the in-memory chunk") (row-buffer :initarg :row-buffer :initform nil :accessor hdf-table-row-buffer :documentation "Object for storing a row to be read from/written to hdf table. It's stored as part of the table for efficiency purposes and should not be handled directly by the user; use the awesome higher level tools for that.") (row-buffer-index :initarg :row-buffer-index :initform nil :accessor hdf-table-row-buffer-index :documentation "Index to the row in the buffer which is currently being modified prior to writing.") (hdf-dataset :initarg :hdf-dataset :initform nil :accessor hdf-table-dataset :documentation "hdf dataset which the table is reading from/writing to.") (hdf-row-type :initarg :hdf-row-type :initform nil :accessor hdf-table-row-type :documentation "hdf type for the row data object") (read-row-index :initarg :read-row-index :initform -1 :accessor hdf-table-read-row-index :documentation "Index to row which should be sequentually read next") (nrows :initarg :nrows :initform nil :accessor hdf-table-nrows :documentation "number of rows in hdf-table"))) ;; table-nrows method: (defmethod table-nrows ((table hdf-table)) (hdf-table-nrows table)) ;; define high-level table access from files here (defun open-hdf-table (hdf-file dataset-name &key buffer-size) (labels ((get-dataset-length (dataset) (with-open-dataspace (dataspace dataset) (let ((rank (hdf5:h5sget-simple-extent-ndims dataspace))) (with-foreign-objects ((dims 'hsize-t rank) (maxdims 'hsize-t rank)) (hdf5:h5sget-simple-extent-dims dataspace dims maxdims) (mem-aref dims 'hsize-t 0)))))) (let* ((dataset (hdf5:h5dopen2 hdf-file dataset-name hdf5:+H5P-DEFAULT+)) (typespec (dataset-read-typespec dataset)) (cstruct (typespec->cffi-type typespec)) (hdf-row-type (hdf5:h5dget-type dataset)) (buffer-size (if (null buffer-size) ;; get buffer-size from the dataset ;; chunk-size: ;; this needs cleaning up (let* ((create-plist (hdf5:h5dget-create-plist dataset))) (with-foreign-object (chunkdims 'hsize-t 1) ;; this needs cleaning up (hdf5:h5pget-chunk create-plist 1 chunkdims) (mem-aref chunkdims 'hsize-t 0))) buffer-size)) (row-buffer (typespec-foreign-alloc typespec buffer-size))) (make-instance 'hdf-table :field-names (typespec->field-names typespec) :field-specs (typespec->field-specs typespec) :row-buffer row-buffer :row-pointer (mem-aptr row-buffer cstruct 0) :hdf-dataset dataset :hdf-row-type hdf-row-type :row-cstruct cstruct :buffer-size buffer-size :access-mode :read :nrows (get-dataset-length dataset))))) (defun create-hdf-table (hdf-file dataset-path names-specs &key (buffer-size 1000)) "Creates a hdf-table for writing in hdf-file with dataset-path as the path to the dataset in the hdf-file and the alist names-specs which maps the field names to their typespecs (this is just applying rest to the typespec for the table). Buffer size will be used as both the chunksize for the hdf dataset and as the size of the buffer for writing into the file." (let* ((typespec (cons :compound names-specs)) (cstruct (typespec->cffi-type typespec)) (row-buffer ;; (foreign-alloc cstruct ;; :count ;; buffer-size) (typespec-foreign-alloc typespec buffer-size)) (hdf-type (typespec->hdf-type typespec)) (dataset (progn (let (cparms) (with-foreign-objects ((chunkdims 'hsize-t 1) (dims 'hsize-t 1) (maxdims 'hsize-t 1)) (setf cparms (hdf5:h5pcreate hdf5:+H5P-DATASET-CREATE+)) (setf (mem-aref chunkdims 'hsize-t 0) buffer-size) (setf (mem-aref dims 'hsize-t 0) 0) (setf (mem-aref maxdims 'hsize-t 0) hdf5:+H5S-UNLIMITED+) (hdf5:h5pset-chunk cparms 1 chunkdims) ;; this needs cleaning up (with-create-dataspace (dataspace 1 dims maxdims) (hdf5:h5dcreate1 hdf-file dataset-path hdf-type dataspace cparms))))))) (make-instance 'hdf-table :row-cstruct cstruct :row-pointer (mem-aptr row-buffer cstruct 0) :field-names (mapcar #'car names-specs) :field-specs (mapcar #'cdr names-specs) :row-buffer row-buffer :buffer-size buffer-size :chunk-index 0 :row-buffer-index 0 :hdf-row-type hdf-type :hdf-dataset dataset :access-mode :write))) (defmethod table-close ((table hdf-table)) "Cleanup function only to be called on an hdf-table for writing. Writes the last remaining data in the buffer to the file and closes the dataset." (with-accessors ((dataset hdf-table-dataset) (row-buffer-index hdf-table-row-buffer-index) (hdf-type hdf-table-row-type) (fields-specs table-field-specs) (chunk-index hdf-table-chunk-index) (row-buffer hdf-table-row-buffer) (buffer-size hdf-table-buffer-size) (cstruct typed-table-row-cstruct) (access-mode table-access-mode)) table (when (equal access-mode :write) (when (not (zerop row-buffer-index)) (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (dataspace-dims 'hsize-t 1) (dataspace-maxdims 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (setf (mem-aref start 'hsize-t 0) (* buffer-size chunk-index)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) row-buffer-index) (with-open-dataspace (dataspace dataset) (hdf5:h5sget-simple-extent-dims dataspace dataspace-dims dataspace-maxdims) (incf (mem-aref dataspace-dims 'hsize-t 0) row-buffer-index) (hdf5:h5dset-extent dataset dataspace-dims)) (with-open-dataspace (dataspace dataset) (setf (mem-aref memdims 'hsize-t 0) row-buffer-index) (setf (mem-aref memmaxdims 'hsize-t 0) row-buffer-index) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (hdf5:h5dwrite dataset hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)))))) ;; no type closing for now, it's a complete headache and is ;; causing problems with memoization etc. ;; (let ((typespec (cons :compound fields-specs))) ;; (print 'typespec->hdf-type) ;; (print (typespec->hdf-type :int)) ;; (remhash (list typespec) (get-memo-map #'typespec->hdf-type))) ;; (print 'hdf-type->typespec) ;; (remhash (list hdf-type) (get-memo-map #'hdf-type->typespec)) (foreign-free row-buffer))) (defmethod table-commit-row ((table hdf-table)) (with-accessors ((row-buffer hdf-table-row-buffer) (row-pointer typed-table-row-pointer) (row-buffer-index hdf-table-row-buffer-index) (buffer-size hdf-table-buffer-size) (chunk-index hdf-table-chunk-index) (cstruct typed-table-row-cstruct) (dataset hdf-table-dataset) (hdf-type hdf-table-row-type)) table (incf row-buffer-index) (setf row-pointer (mem-aptr row-buffer cstruct (mod row-buffer-index buffer-size))) (when (zerop (mod row-buffer-index buffer-size)) ;; was rem (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (dataspace-dims 'hsize-t 1) (dataspace-maxdims 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (with-open-dataspace (dataspace dataset) (hdf5:h5sget-simple-extent-dims dataspace dataspace-dims dataspace-maxdims) (incf (mem-aref dataspace-dims 'hsize-t 0) buffer-size) (hdf5:h5dset-extent dataset dataspace-dims)) (with-open-dataspace (dataspace dataset) (setf (mem-aref start 'hsize-t 0) (* buffer-size chunk-index)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) buffer-size) (setf (mem-aref memdims 'hsize-t 0) buffer-size) (setf (mem-aref memmaxdims 'hsize-t 0) buffer-size) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (hdf5:h5dwrite dataset hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)))) (incf chunk-index) (setf row-buffer-index 0)))) (defun table->cstruct (table) "Function which, given an hdf-table, defines a cffi cstruct for use in reading/writing from the hdf file." (typespec->cffi-type (typed-table->typespec table))) (defun table->hdf-type (table) (typespec->hdf-type (typed-table->typespec table))) (defun dataset-read-typespec (dataset) "Reads the typespec from the dataset" ;; this needs cleaning up (with-dataset-type (type dataset) (hdf-type->typespec type))) ;; use foreign-slot-value to get the value of a slot ;; use foreign-alloc to create a foreign object; should use ;; foreign-free once the object is not needed ;; assumes: ;; ;; * The cstruct row object has already been created ;; ;; * The dataset has already been opened and its parameters set ;; ;; * The memory dataspace has already been created and its parameters set ;; ;; * The row object hdf type has been created (defmethod table-load-next-row ((table hdf-table)) (with-accessors ((row-number hdf-table-read-row-index) (row-buffer hdf-table-row-buffer) (row-pointer typed-table-row-pointer) (buffer-size hdf-table-buffer-size) (cstruct typed-table-row-cstruct)) table ;;(print row-number) (incf row-number) (setf row-pointer (mem-aptr row-buffer cstruct (mod row-number buffer-size))) (load-chunk table row-number))) (defun load-chunk (table row-number) (labels ((get-chunk-index (row-index buffer-size) (declare (fixnum buffer-size row-index)) (the fixnum (floor row-index buffer-size)))) (with-accessors ((buffer-size hdf-table-buffer-size) (current-chunk-index hdf-table-chunk-index) (row-buffer hdf-table-row-buffer) (cstruct typed-table-row-cstruct) (nrows hdf-table-nrows)) table (let ((chunk-index (get-chunk-index row-number buffer-size))) (if (< row-number nrows) (progn (when (not (= current-chunk-index chunk-index)) ;; read data from file: (with-accessors ((row-hdf-type hdf-table-row-type) (dataset hdf-table-dataset) (table-length hdf-table-nrows)) table (let ((chunk-size (min (- table-length (* chunk-index buffer-size)) buffer-size))) (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (setf (mem-aref start 'hsize-t 0) (* chunk-index buffer-size)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) chunk-size) (setf (mem-aref memdims 'hsize-t 0) chunk-size) (setf (mem-aref memmaxdims 'hsize-t 0) chunk-size) (with-open-dataspace (dataspace dataset) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5dread dataset row-hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)) (setf (hdf-table-row-buffer table) row-buffer) (setf (hdf-table-chunk-index table) chunk-index)))))) t) nil)))))
16,492
Common Lisp
.lisp
369
32.00542
77
0.560758
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
81a74572c5943f4b829900785347bafbdde753afec009bc8cb80584b56638e79
1,448
[ -1 ]
1,450
test.lisp
ghollisjr_cl-ana/hdf-table/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana.hdf-table) (in-package :cl-ana.hdf-table) (defun hdf-type-test () (hdf-type->typespec (typespec->hdf-type '(:compound ("x" . :double) ("y" . :int) ("xs" . (:array :double 5)) ("ys" . (:compound ("t" . :int))))))) (defun hdf-type-test2 () (hdf-type->typespec (typespec->hdf-type '(:compound ("x" . :double) ("y" . :int) ("xs" . (:compound ("fs" . (:array :double 5)))) ("ys" . (:compound ("t" . :int))))))) (defvar *table* nil) (defvar *hdf-typespec*) (defvar *table-typespec*) (defvar *hdf-size*) (defvar *cstruct-size*) (defvar *hdf-file*) (defun hdf-read-data-test () (with-open-hdf-file (file "/home/ghollisjr/phys/research/phd/ana/hdffile.h5" :direction :input) (setf *table* (open-hdf-table file "/h10")) (setf *hdf-file* file) (let ((result 0) (last-row-index 0)) (setf *table-typespec* (typed-table->typespec *table*)) (setf *hdf-size* (hdf5:h5tget-size (hdf-table-row-type *table*))) (setf *hdf-typespec* (hdf-type->typespec (hdf-table-row-type *table*))) (setf *cstruct-size* (foreign-type-size (typed-table-row-cstruct *table*))) (do-table (row-index *table*) ("gpart") (incf result gpart) (setf last-row-index row-index)) (format t "last-row-index: ~a~%" last-row-index) result))) (defun hdf-write-table-test () (with-open-hdf-file (file "/home/ghollisjr/hdfwork/test.h5" :direction :output :if-exists :supersede) (let* ((table (create-hdf-table file "/test" (list (cons "x" :int) (cons "y" :float))))) ;;(print (typed-table-type-map table)) (dotimes (i 1000000) (table-set-field table :|x| i) (table-set-field table :|y| (sqrt i)) (table-commit-row table)) (table-close table)))) (defun hdf-read-test () (when *table* (table-close *table*)) (setf *table* (open-hdf-table-chain (list "/home/ghollisjr/hdfwork/test.h5") "/test")) (let ((sum 0)) (do-table (row-index *table*) ("x" "y") (incf sum |x|) (incf sum |y|)) (print sum))) (defun hdf-table-test () (with-open-hdf-file (outfile "/home/ghollisjr/hdfwork/outfile.h5" :direction :output :if-exists :supersede) (let ((output-table (create-hdf-table outfile "/output-dataset" (zip (list "x" "y") (list :int :float)))) (input-table (open-hdf-table-chain (list "/home/ghollisjr/hdfwork/test.h5") "/test"))) ;;(open-hdf-table infile "/test"))) (do-table (row-index input-table) ("x" "y") ;; (format t "~a ~a; ~a ~a~%" ;; row-index (sqrt row-index) ;; x y) (when (> row-index (hdf-table-chain-nrows input-table)) (when (zerop (mod row-index 1000)) (print row-index))) (when (<= 25 y 30) (table-push-fields output-table x y))) (table-close output-table) (table-close input-table)))) (defun hdf-typed-table-test () (with-open-hdf-file (outfile "/home/ghollisjr/hdfwork/outfile.h5" :direction :output :if-exists :supersede) (let ((output-table (create-hdf-table outfile "/output-dataset" (zip (list "x" "y") (list :int :float)))) (input-table (open-hdf-table-chain (list "/home/ghollisjr/hdfwork/test.h5") "/test"))) (do-table (row-index input-table) ("x" "y") (when (<= 25 y 30) (table-set-field output-table :x x) (table-set-field output-table :y y) (table-commit-row output-table))) (table-close output-table) (table-close input-table)))) (defun array-test () (with-open-hdf-file (outfile "/home/ghollisjr/hdfwork/array.h5" :direction :output :if-exists :supersede :if-does-not-exist :create) (let* ((table (create-hdf-table outfile "/array" (list (cons "x" (list :array :float 4)))))) (loop for i below 30 do (progn (table-push-fields table (x (vector (float i 0f0) (sqrt (float i 0f0)) (float i 0f0) (sqrt (float i))))))) (table-close table))))
5,396
Common Lisp
.lisp
149
28.563758
88
0.563289
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
0eb19975cbbeb541be5f2004b523ffd181abe0391c5f55776f8762600ed9a7cf
1,450
[ -1 ]
1,451
raw-hdf-table.lisp
ghollisjr_cl-ana/hdf-table/raw-hdf-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013-2015 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.hdf-table) ;;; NOTE: HDF5 types are left open forever. I tried to implement a ;;; system of closing types and re-opening them on a table-by-table ;;; basis, but it turned out to be a complete hassle, so I'm leaving ;;; them open forever once opened at the moment. In the future this ;;; could be revisited. It poses only minimal memory overhead since ;;; I've memoized the typespec functions so that only one HDF5 type is ;;; used per typespec. I believe the HDF5 type closing mechanism is ;;; for safety in situations where it isn't so easy to memoize ;;; functions. (declaim (optimize (speed 2) (safety 1) (compilation-speed 0) (debug 1))) (defclass hdf-table (typed-table) ((row-buffer-size :initarg :buffer-size :initform nil :accessor hdf-table-buffer-size :documentation "buffer size in number of rows") (chunk-index :initarg :chunk-index :initform -1 :accessor hdf-table-chunk-index :documentation "index to the in-memory chunk") (row-buffer :initarg :row-buffer :initform nil :accessor hdf-table-row-buffer :documentation "Object for storing a row to be read from/written to hdf table. It's stored as part of the table for efficiency purposes and should not be handled directly by the user; use the awesome higher level tools for that.") (row-buffer-index :initarg :row-buffer-index :initform nil :accessor hdf-table-row-buffer-index :documentation "Index to the row in the buffer which is currently being modified prior to writing.") (hdf-dataset :initarg :hdf-dataset :initform nil :accessor hdf-table-dataset :documentation "hdf dataset which the table is reading from/writing to.") (hdf-row-type :initarg :hdf-row-type :initform nil :accessor hdf-table-row-type :documentation "hdf type for the row data object") (read-row-index :initarg :read-row-index :initform -1 :accessor hdf-table-read-row-index :documentation "Index to row which should be sequentually read next") (nrows :initarg :nrows :initform nil :accessor hdf-table-nrows :documentation "number of rows in hdf-table"))) ;; table-nrows method: (defmethod table-nrows ((table hdf-table)) (hdf-table-nrows table)) ;; define high-level table access from files here (defun open-hdf-table (hdf-file dataset-name &key buffer-size) (labels ((get-dataset-length (dataset) (with-open-dataspace (dataspace dataset) (let ((rank (hdf5:h5sget-simple-extent-ndims dataspace))) (with-foreign-objects ((dims 'hsize-t rank) (maxdims 'hsize-t rank)) (hdf5:h5sget-simple-extent-dims dataspace dims maxdims) (mem-aref dims 'hsize-t 0)))))) (with-foreign-string (cdataset-name dataset-name) (let* ((dataset (hdf5:h5dopen2 hdf-file cdataset-name hdf5:+H5P-DEFAULT+)) (typespec (dataset-read-typespec dataset)) (cstruct (typespec->cffi-type typespec)) (hdf-row-type (hdf5:h5dget-type dataset)) (buffer-size (if (null buffer-size) ;; get buffer-size from the dataset ;; chunk-size: ;; this needs cleaning up (let* ((create-plist (hdf5:h5dget-create-plist dataset))) (with-foreign-object (chunkdims 'hsize-t 1) ;; this needs cleaning up (hdf5:h5pget-chunk create-plist 1 chunkdims) (mem-aref chunkdims 'hsize-t 0))) buffer-size)) (row-buffer (typespec-foreign-alloc typespec buffer-size))) (make-instance 'hdf-table :field-names (typespec->field-names typespec) :field-specs (typespec->field-specs typespec) :row-buffer row-buffer :row-pointer (mem-aptr row-buffer cstruct 0) :hdf-dataset dataset :hdf-row-type hdf-row-type :row-cstruct cstruct :buffer-size buffer-size :access-mode :read :nrows (get-dataset-length dataset)))))) (defun create-hdf-table (hdf-file dataset-path names-specs &key (buffer-size 1000)) "Creates a hdf-table for writing in hdf-file with dataset-path as the path to the dataset in the hdf-file and the alist names-specs which maps the field names to their typespecs (this is just applying rest to the typespec for the table). Buffer size will be used as both the chunksize for the hdf dataset and as the size of the buffer for writing into the file." (let* ((typespec (cons :compound names-specs)) (cstruct (typespec->cffi-type typespec)) (row-buffer ;; (foreign-alloc cstruct ;; :count ;; buffer-size) (typespec-foreign-alloc typespec buffer-size)) (hdf-type (typespec->hdf-type typespec)) (dataset (progn (let (cparms) (with-foreign-objects ((chunkdims 'hsize-t 1) (dims 'hsize-t 1) (maxdims 'hsize-t 1)) (setf cparms (hdf5:h5pcreate hdf5:+H5P-DATASET-CREATE+)) (setf (mem-aref chunkdims 'hsize-t 0) buffer-size) (setf (mem-aref dims 'hsize-t 0) 0) (setf (mem-aref maxdims 'hsize-t 0) hdf5:+H5S-UNLIMITED+) (hdf5:h5pset-chunk cparms 1 chunkdims) ;; this needs cleaning up (with-create-dataspace (dataspace 1 dims maxdims) (hdf5:h5dcreate1 hdf-file dataset-path hdf-type dataspace cparms))))))) (make-instance 'hdf-table :row-cstruct cstruct :row-pointer (mem-aptr row-buffer cstruct 0) :field-names (mapcar #'car names-specs) :field-specs (mapcar #'cdr names-specs) :row-buffer row-buffer :buffer-size buffer-size :chunk-index 0 :row-buffer-index 0 :hdf-row-type hdf-type :hdf-dataset dataset :access-mode :write))) (defmethod table-close ((table hdf-table)) "Cleanup function only to be called on an hdf-table for writing. Writes the last remaining data in the buffer to the file and closes the dataset." (with-accessors ((dataset hdf-table-dataset) (row-buffer-index hdf-table-row-buffer-index) (hdf-type hdf-table-row-type) (fields-specs table-field-specs) (chunk-index hdf-table-chunk-index) (row-buffer hdf-table-row-buffer) (buffer-size hdf-table-buffer-size) (cstruct typed-table-row-cstruct) (access-mode table-access-mode)) table (when (equal access-mode :write) (when (not (zerop row-buffer-index)) (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (dataspace-dims 'hsize-t 1) (dataspace-maxdims 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (setf (mem-aref start 'hsize-t 0) (* buffer-size chunk-index)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) row-buffer-index) (with-open-dataspace (dataspace dataset) (hdf5:h5sget-simple-extent-dims dataspace dataspace-dims dataspace-maxdims) (incf (mem-aref dataspace-dims 'hsize-t 0) row-buffer-index) (hdf5:h5dset-extent dataset dataspace-dims)) (with-open-dataspace (dataspace dataset) (setf (mem-aref memdims 'hsize-t 0) row-buffer-index) (setf (mem-aref memmaxdims 'hsize-t 0) row-buffer-index) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (hdf5:h5dwrite dataset hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)))))) ;; no type closing for now, it's a complete headache and is ;; causing problems with memoization etc. ;;(hdf5:h5tclose hdf-type) ;; (let ((typespec (cons :compound fields-specs))) ;; (print 'typespec->hdf-type) ;; (print (typespec->hdf-type :int)) ;; (remhash (list typespec) (get-memo-map #'typespec->hdf-type))) ;; (print 'hdf-type->typespec) ;; (remhash (list hdf-type) (get-memo-map #'hdf-type->typespec)) (hdf5:h5dclose dataset) (foreign-free row-buffer))) (defmethod table-commit-row ((table hdf-table)) (with-accessors ((row-buffer hdf-table-row-buffer) (row-pointer typed-table-row-pointer) (row-buffer-index hdf-table-row-buffer-index) (buffer-size hdf-table-buffer-size) (chunk-index hdf-table-chunk-index) (cstruct typed-table-row-cstruct) (dataset hdf-table-dataset) (hdf-type hdf-table-row-type)) table (incf row-buffer-index) (setf row-pointer (mem-aptr row-buffer cstruct (mod row-buffer-index buffer-size))) (when (zerop (mod row-buffer-index buffer-size)) ;; was rem (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (dataspace-dims 'hsize-t 1) (dataspace-maxdims 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (with-open-dataspace (dataspace dataset) (hdf5:h5sget-simple-extent-dims dataspace dataspace-dims dataspace-maxdims) (incf (mem-aref dataspace-dims 'hsize-t 0) buffer-size) (hdf5:h5dset-extent dataset dataspace-dims)) (with-open-dataspace (dataspace dataset) (setf (mem-aref start 'hsize-t 0) (* buffer-size chunk-index)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) buffer-size) (setf (mem-aref memdims 'hsize-t 0) buffer-size) (setf (mem-aref memmaxdims 'hsize-t 0) buffer-size) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (hdf5:h5dwrite dataset hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)))) (incf chunk-index) (setf row-buffer-index 0)))) (defun table->cstruct (table) "Function which, given an hdf-table, defines a cffi cstruct for use in reading/writing from the hdf file." (typespec->cffi-type (typed-table->typespec table))) (defun table->hdf-type (table) (typespec->hdf-type (typed-table->typespec table))) (defun dataset-read-typespec (dataset) "Reads the typespec from the dataset" ;; this needs cleaning up (with-dataset-type (type dataset) (hdf-type->typespec type))) ;; use foreign-slot-value to get the value of a slot ;; use foreign-alloc to create a foreign object; should use ;; foreign-free once the object is not needed ;; assumes: ;; ;; * The cstruct row object has already been created ;; ;; * The dataset has already been opened and its parameters set ;; ;; * The memory dataspace has already been created and its parameters set ;; ;; * The row object hdf type has been created (defmethod table-load-next-row ((table hdf-table)) (with-accessors ((row-number hdf-table-read-row-index) (row-buffer hdf-table-row-buffer) (row-pointer typed-table-row-pointer) (buffer-size hdf-table-buffer-size) (cstruct typed-table-row-cstruct)) table ;;(print row-number) (incf row-number) (setf row-pointer (mem-aptr row-buffer cstruct (mod row-number buffer-size))) (load-chunk table row-number))) (defun load-chunk (table row-number) (labels ((get-chunk-index (row-index buffer-size) (declare (fixnum buffer-size row-index)) (the fixnum (floor row-index buffer-size)))) (with-accessors ((buffer-size hdf-table-buffer-size) (current-chunk-index hdf-table-chunk-index) (row-buffer hdf-table-row-buffer) (cstruct typed-table-row-cstruct) (nrows hdf-table-nrows)) table (let ((chunk-index (get-chunk-index row-number buffer-size))) (if (< row-number nrows) (progn (when (not (= current-chunk-index chunk-index)) ;; read data from file: (with-accessors ((row-hdf-type hdf-table-row-type) (dataset hdf-table-dataset) (table-length hdf-table-nrows)) table (let ((chunk-size (min (- table-length (* chunk-index buffer-size)) buffer-size))) (with-foreign-objects ((start 'hsize-t 1) (stride 'hsize-t 1) (count 'hsize-t 1) (blck 'hsize-t 1) (memdims 'hsize-t 1) (memmaxdims 'hsize-t 1)) (setf (mem-aref start 'hsize-t 0) (* chunk-index buffer-size)) (setf (mem-aref stride 'hsize-t 0) 1) (setf (mem-aref count 'hsize-t 0) 1) (setf (mem-aref blck 'hsize-t 0) chunk-size) (setf (mem-aref memdims 'hsize-t 0) chunk-size) (setf (mem-aref memmaxdims 'hsize-t 0) chunk-size) (with-open-dataspace (dataspace dataset) (hdf5:h5sselect-hyperslab dataspace :H5S-SELECT-SET start stride count blck) (with-create-dataspace (memspace 1 memdims memmaxdims) (hdf5:h5dread dataset row-hdf-type memspace dataspace hdf5:+H5P-DEFAULT+ row-buffer)) (setf (hdf-table-row-buffer table) row-buffer) (setf (hdf-table-chunk-index table) chunk-index)))))) t) nil)))))
16,265
Common Lisp
.lisp
371
32.102426
80
0.573786
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
3bbccb09cda585dafa738e2264a5ffaa7d5d472d13a4ab7f4bf208ea44a3a5d0
1,451
[ -1 ]
1,452
package.lisp
ghollisjr_cl-ana/typed-table/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.typed-table (:use #:cl #:cffi #:alexandria #:cl-ana.list-utils #:cl-ana.string-utils #:cl-ana.symbol-utils #:cl-ana.table #:cl-ana.typespec) (:export :typed-table :table-field-specs :typed-table-row-cstruct :typed-table-row-pointer :typed-table-lisp->c-converter-map :typed-table-c->lisp-converter-map :typespec->field-names :typespec->field-specs :typed-table->typespec))
1,360
Common Lisp
.lisp
38
32.210526
70
0.679031
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
ae642b3d90514944aeddc8fe73170e552e1365f5dbec3e8d61bd74baea222349
1,452
[ -1 ]
1,453
typed-table.lisp
ghollisjr_cl-ana/typed-table/typed-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.typed-table) (declaim (optimize (speed 3) (safety 0) (compilation-speed 0) (debug 3))) (defun gethash-keywordify (key hash-table) (gethash (keywordify (string key)) hash-table)) (defun (setf gethash-keywordify) (value key hash-table) (setf (gethash (keywordify (string key)) hash-table) value)) (defclass typed-table (table) ((field-specs :initarg :field-specs :initform () ;; renamed for intuitive-ness: :accessor table-field-specs :documentation "list of typespecs, one per field") (row-cstruct :initarg :row-cstruct :initform nil :accessor typed-table-row-cstruct :documentation "CFFI cstruct type designator for the row object") (row-pointer :initarg :row-pointer :initform nil :accessor typed-table-row-pointer :documentation "pointer to foreign object storing current row information.") (lisp->c-converter-map :initarg :lisp->c-converter-map :initform nil :accessor typed-table-lisp->c-converter-map :documentation "Hash table which maps the field symbols to the lisp->c converter function for corresponding field.") (c->lisp-converter-map :initarg :c->lisp-converter-map :initform nil :accessor typed-table-c->lisp-converter-map :documentation "Hash table which maps the field symbols to the c->lisp converter function for corresponding field."))) (defmethod initialize-instance :after ((table typed-table) &key) (with-accessors ((field-specs table-field-specs) (lisp->c-converter-map typed-table-lisp->c-converter-map) (c->lisp-converter-map typed-table-c->lisp-converter-map)) table (setf lisp->c-converter-map (make-hash-table :test 'eq)) (setf c->lisp-converter-map (make-hash-table :test 'eq)) (loop for s in (table-field-symbols table) for cs in field-specs do (progn (setf (gethash s lisp->c-converter-map) (typespec->lisp-to-c cs)) (setf (gethash s c->lisp-converter-map) (typespec->c-to-lisp cs)))))) ;;; These methods make it so that all you have to do is define methods ;;; on table-load-next-row and table-commit-row which properly set the ;;; row-pointer value to the current row (as well as allocating & ;;; freeing space as appropriate). (defmethod table-set-field ((table typed-table) field-symbol value) "Method on table-set-field that automatically converts the value into the appropriate CFFI type for the field given by field-symbol. Note that this function is still pedantic about which particular numerical type you are giving it, e.g. float vs. integer. Use plists to represent a structure (works for nested as well), and vectors to represent foreign arrays." (with-slots (lisp->c-converter-map row-pointer row-cstruct) table (funcall (gethash field-symbol lisp->c-converter-map) value (foreign-slot-pointer row-pointer row-cstruct field-symbol)))) (defmethod table-get-field ((table typed-table) field-symbol) "Automatically converts field pointer to lisp value." (with-accessors ((c->lisp-converter-map typed-table-c->lisp-converter-map) (row-pointer typed-table-row-pointer) (row-cstruct typed-table-row-cstruct)) table (funcall (gethash field-symbol c->lisp-converter-map) (foreign-slot-pointer row-pointer row-cstruct field-symbol)))) (defun typespec->field-names (compound-typespec) "Returns field names from the compound type designation." (if (typespec-compound-p compound-typespec) (mapcar #'car (rest compound-typespec)) (error "Non compound type given to typespec->field-names"))) (defun typespec->field-specs (compound-typespec) "Returns field typespecs from the compound type designation." (if (typespec-compound-p compound-typespec) (mapcar #'cdr (rest compound-typespec)) (error "Non compound type given to typespec->field-specs"))) (defun typed-table->typespec (table) "Creates a typespec from the table" (append (list :compound) (zip (table-field-names table) (table-field-specs table))))
5,343
Common Lisp
.lisp
124
36.298387
70
0.669291
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
5e4172351e17779bc52462e719b07940e31fe4b3743596e627eab25f8bd29228
1,453
[ -1 ]
1,454
package.lisp
ghollisjr_cl-ana/columnar-table/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2019 Katherine Cox-Buday ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. (defpackage #:cl-ana.columnar-table (:use :cl :cl-ana.table :cl-ana.reusable-table) (:export :pivot :columnar-table))
938
Common Lisp
.lisp
23
38.391304
70
0.701313
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
763ecc3e76fd9dfdbcecb4a6cecc6c818b4590f29e459ef6bc717bfa836a0a17
1,454
[ -1 ]
1,455
columnar-table.lisp
ghollisjr_cl-ana/columnar-table/columnar-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2019 Katherine Cox-Buday ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. (in-package :cl-ana.columnar-table) (defun pivot (table create-table-fn open-table-fn) "Pivot a table so that column values are accessible via rows. CREATE-TABLE-FN should create the table of type, and open-table-fn should open the same table again for reuse." (check-type table reusable-table) (check-type create-table-fn function) (check-type open-table-fn function) (let ((columnar-table (funcall create-table-fn '("column-name" "my-values"))) (field-names (table-field-names table))) (loop for field in (table-field-symbols table) do (table-set-field columnar-table :|column-name| field) (let ((col-vals (make-array 100 :adjustable t :fill-pointer 0))) (do-table (rowidx table) () (vector-push-extend (table-get-field table field) col-vals 100)) (table-set-field columnar-table :|my-values| (adjust-array col-vals (length col-vals)))) (table-commit-row columnar-table)) (table-close columnar-table) (make-instance 'columnar-table :field-names field-names ;; Fetching rows will involve scanning the ;; underlying table several times. :backing-table (wrap-for-reuse (funcall open-table-fn columnar-table))))) (defclass columnar-table (table) ((backing-table :initarg :backing-table :initform (error ":backing-table not specified") :accessor backing-table) (row :initarg :row :initform nil :accessor columnar-table-row) (row-index :initform 0 :accessor row-index))) (defmethod table-get-field ((table columnar-table) field-symbol) (with-accessors ((row columnar-table-row)) table (getf row field-symbol))) (defmethod table-load-next-row ((table columnar-table)) (with-accessors ((index row-index) (backing-table backing-table) (row columnar-table-row)) table (incf index) (let ((new-row (list))) (do-table (rowidx backing-table) () (let* ((column-name (table-get-field backing-table :|column-name|)) (values-vector (table-get-field backing-table :|my-values|))) (when (> index (length values-vector)) (return-from table-load-next-row nil)) (setf new-row (nconc new-row (list column-name (elt values-vector (- index 1))))))) (setf row new-row)) row)) (defmethod field-values ((table columnar-table) field) (with-accessors ((backing-table backing-table)) table (do-table (row-index backing-table) () (when (equalp (table-get-field backing-table :|column-name|) field) (table-close backing-table) (return-from field-values (table-get-field backing-table :|my-values|))))) (error "cannot find field ~a" field))
3,778
Common Lisp
.lisp
86
36.162791
93
0.636536
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
edab25081f7f5e9511aa1234895483bf0f6df2d2ae107484bae514574b0f77f0
1,455
[ -1 ]
1,456
package.lisp
ghollisjr_cl-ana/ntuple-table/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.ntuple-table (:use :cl :cffi :cl-ana.table :cl-ana.typed-table :cl-ana.typespec) (:export :open-ntuple-table :create-ntuple-table))
1,046
Common Lisp
.lisp
28
35.464286
70
0.704031
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e0518aaf48058ec0b1cf2c259e5c9d7276d67ac0dca8f39917862e7369abf483
1,456
[ -1 ]
1,457
ntuple-table.lisp
ghollisjr_cl-ana/ntuple-table/ntuple-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.ntuple-table) (defclass ntuple-table (typed-table) ((ntuple :initarg :ntuple :initform nil :accessor ntuple-table-ntuple :documentation "GSL handler for ntuple object"))) ;;; Writing functions: (defun create-ntuple-table (filename names-specs) "Creates an ntuple-table with file located at the path corresponding to filename and names-specs being an alist mapping the field names to their typespecs." (let* ((typespec (cons :compound names-specs)) (cstruct (typespec->cffi-type typespec)) (field-names (mapcar #'car names-specs)) (field-specs (mapcar #'cdr names-specs)) (row-pointer (typespec-foreign-alloc typespec))) (let ((ntuple (gsll:create-ntuple filename row-pointer cstruct))) (make-instance 'ntuple-table :field-names field-names :field-specs field-specs :ntuple ntuple :row-cstruct cstruct :row-pointer row-pointer)))) ;; (defmethod table-set-field ((table ntuple-table) field-symbol value) ;; (with-accessors ((row typed-table-row-pointer) ;; (cstruct ntuple-table-cstruct)) ;; table ;; (setf ;; (foreign-slot-value row ;; cstruct ;; field-symbol) ;; value))) (defmethod table-commit-row ((table ntuple-table)) (with-accessors ((row typed-table-row-pointer) (ntuple ntuple-table-ntuple)) table (gsll:write-ntuple ntuple))) ;;; Reading functions: (defun open-ntuple-table (filename names-specs) "Opens a pre-existing ntuple data file. Must already know the typespecs of each of the field types (and names); this is a limitation of the ntuple file format itself." (let* ((typespec (cons :compound names-specs)) (cstruct (typespec->cffi-type typespec)) (field-names (mapcar #'car names-specs)) (field-specs (mapcar #'cdr names-specs)) (row (typespec-foreign-alloc typespec))) (let ((ntuple (gsll:open-ntuple filename row cstruct))) (make-instance 'ntuple-table :field-names field-names :field-specs field-specs :ntuple ntuple :row-cstruct cstruct :row-pointer row)))) (defmethod table-load-next-row ((table ntuple-table)) (with-accessors ((ntuple ntuple-table-ntuple)) table (let ((read-status (cl-ana.gsl-cffi:gsl-ntuple-read ntuple))) (not (equal read-status cl-ana.gsl-cffi:+GSL-EOF+))))) ;; (defmethod table-get-field ((table ntuple-table) field-symbol) ;; (with-accessors ((row typed-table-row-pointer) ;; (cstruct ntuple-table-cstruct)) ;; table ;; (foreign-slot-value row ;; cstruct ;; field-symbol))) ;;; Cleanup: (defmethod table-close ((table ntuple-table)) (with-accessors ((ntuple ntuple-table-ntuple) (row typed-table-row-pointer)) table (gsll:close-ntuple ntuple) (foreign-free row)))
3,659
Common Lisp
.lisp
94
35.755319
71
0.699972
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
7d52611e47bff362edb371f1e7f4edfdfc7cf8d5324265f045530a785beeb2a7
1,457
[ -1 ]
1,458
test.lisp
ghollisjr_cl-ana/ntuple-table/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana.ntuple-table) (in-package :cl-ana.ntuple-table) (defparameter *table* (create-ntuple-table "/home/ghollisjr/test.dat" (list (cons "x" :int) (cons "X" :int) (cons "y" :double)))) (table-push-fields *table* (|x| 3) (x 4) (|y| 5d0)) (table-push-fields *table* (|x| 4) (x 5) (|y| 10d0)) (table-close *table*) (setf *table* (open-ntuple-table "/home/ghollisjr/test.dat" (list (cons "x" :int) (cons "X" :int) (cons "y" :double)))) (do-table (row-index *table*) ("x" "X" "y") (print |x|) (print x) (print |y|))
1,561
Common Lisp
.lisp
48
27.9375
70
0.614466
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
58221320c2bc626a5fd800ccf460d64cac02fbbf1dda55ae9c8c9fe84c1a5a76
1,458
[ -1 ]
1,459
package.lisp
ghollisjr_cl-ana/reusable-table/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.reusable-table (:use :cl :cl-ana.table) (:export :wrap-for-reuse :reusable-table :make-reusable-table :internal-table :reusable-table-opener-form))
1,092
Common Lisp
.lisp
28
36.035714
70
0.688617
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
038319896c1f94c5f73ae65b7e75e55531ced618b3a019637aa2cf4fa01c2bd5
1,459
[ -1 ]
1,460
reusable-table.lisp
ghollisjr_cl-ana/reusable-table/reusable-table.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; reusable-table.lisp ;;;; reusable-table provides a wrapper macro which, when given the ;;;; form you would have evaluated to open your table for reading, ;;;; creates a closure which will be called whenever the table needs ;;;; reloading. The table object returned only defines minimal ;;;; interface, but this is a minor inconvenience as it is still ;;;; possible to access the raw table directly. ;;;; ;;;; It can safely be used with do-table since table-load-next-row ;;;; still returns nil when appropriate. (in-package :cl-ana.reusable-table) (defclass reusable-table () ((creation-fn :initarg :creation-fn :initform nil :accessor reusable-table-creation-fn :documentation "Function which creates the table being wrapped.") (creation-fn-form :initarg :opener-form :initform nil :accessor reusable-table-opener-form :documentation "Lisp form which returns the table opener function when evaluated. A table opener An optional field which assists in serializing reusable tables.") (raw-table :initarg :raw-table :initform nil :accessor internal-table :documentation "The table which is being wrapped.") (needs-reloading :initform nil :accessor reusable-table-needs-reloading :documentation "Boolean which tells the wrapper when it needs to close and re-open the table."))) (defun make-reusable-table (creation-fn &optional opener-form) "Returns result of creation-fn if reusable-table, else returns reusable-table which will make use of creation-fn to generate new copies when needed." (let ((tab (funcall creation-fn))) (if (typep tab 'reusable-table) tab (make-instance 'reusable-table :creation-fn creation-fn :opener-form opener-form :raw-table tab)))) (defmacro wrap-for-reuse (table-creation-form &optional opener-form) "Creates a reusable (when table-creation-from does not return a reusable-table) table which places the table-creation-form into a closure which will be evaluated each time the table gets re-read from the beginning. If the creation form returns a reusable-table, simply returns the table." (let ((lambda-form `(lambda () ,table-creation-form))) `(make-reusable-table ,lambda-form ,opener-form))) (defmethod table-load-next-row ((table reusable-table)) (with-slots (raw-table creation-fn needs-reloading) table (when needs-reloading (when (table-open-p raw-table) (table-close raw-table)) (setf raw-table (funcall creation-fn)) (setf needs-reloading nil)) (let ((status (table-load-next-row raw-table))) (when (not status) (setf needs-reloading t)) status))) (defmethod table-get-field ((table reusable-table) field-symbol) (with-slots (raw-table) table (table-get-field raw-table field-symbol))) (defmethod table-field-names ((table reusable-table)) (with-slots (raw-table) table (table-field-names raw-table))) ;;; Cleanup: (defmethod table-close ((table reusable-table)) "Closes the physical table; note that this is unsafe unless you know the table needs closing." (with-slots (raw-table needs-reloading) table (when (not needs-reloading) (setf needs-reloading t)) (table-close raw-table))) ;; table-nrows method: (defmethod table-nrows ((table reusable-table)) (table-nrows (internal-table table))) ;; access mode: (defmethod table-access-mode ((table reusable-table)) (table-access-mode (internal-table table)))
4,477
Common Lisp
.lisp
110
36.454545
82
0.710835
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
f961303e770ecaf7611adcc57c099b31a6968410f8c71d22bb760ce2fcb85ab7
1,460
[ -1 ]
1,461
test.lisp
ghollisjr_cl-ana/reusable-table/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana.reusable-table) (require 'cl-ana.hdf-table) (in-package :cl-ana.hdf-table) (use-package 'cl-ana.reusable-table) (defvar *table* (wrap-for-reuse (open-hdf-table-chain (list "/home/ghollisjr/hdfwork/outfile.h5") "/output-dataset"))) (do-table (i *table*) ("x" "y") (when (zerop i) (print "First pass: ") (print x) (print y))) (do-table (i *table*) ("x" "y") (when (zerop i) (print "Second pass: ") (print x) (print y)))
1,380
Common Lisp
.lisp
40
31.575
70
0.666917
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
3a0f47157542298c2057d34c592b9bb5b025ce2dbdba381887d29a3b3247b47e
1,461
[ -1 ]
1,462
package.lisp
ghollisjr_cl-ana/makeres-graphviz/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.makeres-graphviz (:use :cl :external-program :cl-ana.makeres) (:export ;; project graph -> dot code: :dot-compile :dot->ps :dot->png :dot->pdf))
1,074
Common Lisp
.lisp
30
33.466667
70
0.689358
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
62fa46fe656513a38216b45136ab1842f9929a2ae48e4aac5d915fd617512df8
1,462
[ -1 ]
1,463
dot.lisp
ghollisjr_cl-ana/makeres-graphviz/dot.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.makeres-graphviz) (defun dot-compile (path &key (if-exists :error) (target-table (target-table)) posts) "Writes target graph into a file located at path. Returns path of dot output file. posts is a list of lines to append to the end of the dot commands without semicolons." (let ((*print-pretty* nil)) (ensure-directories-exist path) (with-open-file (file path :direction :output :if-does-not-exist :create :if-exists if-exists) (format file "digraph \"~a\" {~%" (project)) (loop for id being the hash-keys in target-table for tar being the hash-values in target-table do (let ((deps (target-deps tar))) (loop for d in deps do (format file " \"~a\" -> \"~a\";~%" d id)))) (loop for p in posts do (format file "~a;~%" p)) (format file "}~%") path))) (defun dot->ps (from-path to-path &key ;; can be one of ;; ;; :dot (normal) ;; :neato ;; :twopi ;; :circo ;; :fdp ;; :sfdp ;; :patchwork ;; :osage (type :dot)) "Runs dot command to convert dot code in from-path to a ps file at to-path" (let* ((types (list :dot :neato :twopi :circo :fdp :sfdp :patchwork :osage))) (when (member type types) (run (string-downcase (string type)) (list from-path "-Tps" "-o" to-path))))) (defun dot->png (from-path to-path &key ;; can be one of ;; ;; :dot (normal) ;; :neato ;; :twopi ;; :circo ;; :fdp ;; :sfdp ;; :patchwork ;; :osage (type :dot)) "Runs dot command to convert dot code in from-path to a png file at to-path" (let* ((types (list :dot :neato :twopi :circo :fdp :sfdp :patchwork :osage))) (when (member type types) (run (string-downcase (string type)) (list from-path "-Tpng" "-o" to-path))))) (defun dot->pdf (from-path to-path &key ;; can be one of ;; ;; :dot (normal) ;; :neato ;; :twopi ;; :circo ;; :fdp ;; :sfdp ;; :patchwork ;; :osage (type :dot)) "Runs dot command to convert dot code in from-path to a pdf file at to-path" (let* ((types (list :dot :neato :twopi :circo :fdp :sfdp :patchwork :osage))) (when (member type types) (run (string-downcase (string type)) (list from-path "-Tpdf" "-o" to-path)))))
4,429
Common Lisp
.lisp
142
19.422535
70
0.453059
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
57990244b3a4d9de958871570710bb459f0f8bb898bca2dad316d9307bf98318
1,463
[ -1 ]
1,464
test.lisp
ghollisjr_cl-ana/makeres-graphviz/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana.makeres-graphviz) (in-package :cl-ana.makeres-graphviz) (in-project makeres-graphviz) (defres src (list 1 2 3 4 5)) (defres squares (mapcar (lambda (x) (expt x 2)) (res src))) (defres mean (mean (res src))) (defres mean-squares (mean (res squares))) (defres variance (- (res mean-squares) (expt (res mean) 2))) (defres standard-deviation (sqrt (res variance)))
1,309
Common Lisp
.lisp
39
30.948718
70
0.689929
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
875cf772291d4ab8297de9891ded37cab6cc409811c80fdf25a529794e5e7df9
1,464
[ -1 ]
1,465
package.lisp
ghollisjr_cl-ana/array-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2021 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.array-utils (:use :cl) (:export :for-array :map-array))
959
Common Lisp
.lisp
24
38.125
70
0.699143
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
4c358d3bcf6e7c52bfc08260008541cb011053baf358f9241f0561e2984aac01
1,465
[ -1 ]
1,466
array-utils.lisp
ghollisjr_cl-ana/array-utils/array-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2021 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.array-utils) ;; Looping over array (defmacro for-array (binding dimensions &body body) "Iterates over every possible index for an array with supplied dimensions. If binding is an atom, then the index list will be set to that variable as a list. If it is a list of symbols, then each symbol will be bound to its corresponding element from the Cartesian product element." (alexandria:with-gensyms (sets dims setdims nsets index continue incr dim) `(let* ((,dims ,dimensions) (,nsets (if (atom ,dims) 1 (length ,dims))) (,setdims (if (atom ,dims) (vector ,dims) (map 'vector #'identity ,dims))) (,index (make-array ,nsets :initial-element 0)) (,continue t)) (loop while ,continue do ;; execute body ,(if (atom binding) `(let ((,binding (map 'list #'identity ,index))) ,@body) `(destructuring-bind ,binding (map 'list #'identity ,index) ,@body)) ;; iterate (let* ((,incr t) (,dim 0)) (loop while ,incr do (if (>= ,dim ,nsets) (progn (setf ,incr nil) (setf ,continue nil)) (progn (incf (aref ,index ,dim)) (if (>= (aref ,index ,dim) (aref ,setdims ,dim)) (progn (setf (aref ,index ,dim) 0) (incf ,dim)) (setf ,incr nil)))))))))) (defun map-array (array fn) "Map for arrays. fn should be of the form (lambda (value &rest indices)...)" (let* ((result (make-array (array-dimensions array)))) (for-array indices (array-dimensions array) (setf (apply #'aref result indices) (apply fn (apply #'aref array indices) indices))) result))
3,252
Common Lisp
.lisp
81
27.493827
70
0.506313
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
6e9c8681f5cb8ad31e831881a48c58aa899615bae05a897d801b24048a4ac1ce
1,466
[ -1 ]
1,467
package.lisp
ghollisjr_cl-ana/hdf-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.hdf-utils (:use #:cl #:cffi #:alexandria #:hdf5 #:cl-ana.memoization #:cl-ana.typespec #:cl-ana.hdf-typespec #:cl-ana.macro-utils #:cl-ana.string-utils #:cl-ana.pathname-utils) (:export :with-cleanup ; general use for HDF5 objects :with-open-dataspace ; opens a dataspace from a dataset :with-create-dataspace ; creates a new dataspace :with-dataset-type ; opens dataset datatype :with-open-hdf-file ; opens/creates a file for reading/writing :open-hdf-file :close-hdf-file :hdf-mkgroup))
1,534
Common Lisp
.lisp
39
34.794872
76
0.659973
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
f9893eca179b5b6f2152f74a14f4cc3072ed7f02b649aa7064788a66cc3bb5ec
1,467
[ -1 ]
1,468
hdf-utils.lisp
ghollisjr_cl-ana/hdf-utils/hdf-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis via email at ;;;; [email protected] (in-package :cl-ana.hdf-utils) ;;;; Still need to fix the with-open-hdf-file macro to make use of the ;;;; open-hdf-file and close-hdf-file functions. (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 1))) (defmacro with-cleanup ((&rest specs) &body body) "Executes body inside of a lexical environment where objects described by specs are bound and then freed upon concluding the body. Each spec is a list of 3 elements: 1. A symbol which will denote a variable inside the body, 2. A form which will be evaluated and its value bound to the symbol, 3. A function for cleaning up the object referenced by the symbol; it will be given the symbol as the sole argument." (multiple-value-bind (symbols inits cleanup-fns) (loop for (s i c) in specs collecting s into symbols collecting i into inits collecting c into cleanup-fns finally (return (values symbols inits cleanup-fns))) (let ((lexical-bindings (loop for s in symbols for i in inits collecting `(,s ,i))) (cleanup-forms (loop for s in symbols for c in cleanup-fns collecting `(funcall ,c ,s)))) (with-gensyms (result) `(let ,lexical-bindings (let ((,result (progn ,@body))) ,@(reverse cleanup-forms) ,result)))))) (defmacro with-open-dataspace ((dataspace dataset) &body body) "Safely work with dataspace taken from dataset" `(with-cleanup ((,dataspace (hdf5:h5dget-space ,dataset) #'hdf5:h5sclose)) ,@body)) (defmacro with-create-dataspace ((dataspace rank dims maxdims) &body body) "Creates a new dataspace and cleans up after it" `(with-cleanup ((,dataspace (hdf5:h5screate-simple ,rank ,dims ,maxdims) #'hdf5:h5sclose)) ,@body)) (defmacro with-dataset-type ((type dataset) &body body) `(with-cleanup ((,type (hdf5:h5dget-type ,dataset) #'hdf5:h5tclose)) ,@body)) ;;;; File utilities: (defun open-hdf-file (filename &key direction (if-exists nil if-exists-supplied-p) (if-does-not-exist nil if-does-not-exist-supplied-p) (read-access-parameters hdf5:+H5P-DEFAULT+) (write-access-parameters (list hdf5:+H5P-DEFAULT+ hdf5:+H5P-DEFAULT+))) "Opens an hdf file, returning a handle to the file (hid-t). direction can be :input or :output. if-exists can be :supersede :error nil if-does-not-exist can be :create :error nil" (let ((filename (namestring (->absolute-pathname filename)))) (case direction (:input ;; I'm choosing the convention that when direction is :input, the ;; only meaningful if-does-not-exist are :error and nil ;; setup if-does-not-exist: (when (not if-does-not-exist-supplied-p) (setf if-does-not-exist :error)) (let ((file-exists-p (probe-file filename))) (if file-exists-p (hdf5:h5fopen filename hdf5:+H5F-ACC-RDONLY+ read-access-parameters) (case if-does-not-exist (:error (error "File does not exist")) (nil nil))))) (:output ;; default for if-exists is :error ;; can't ignore if-does-not-exist if I want to be consistent with ;; with-open-file, but default is to go ahead and create the file ;; setup if-exists & if-does-not-exist (when (not if-exists-supplied-p) (setf if-exists :error)) (when (not if-does-not-exist-supplied-p) (setf if-does-not-exist :create)) (let ((file-exists-p (probe-file filename))) (if file-exists-p (case if-exists (:error (error "File exists")) (nil nil) (:supersede (delete-file filename) (apply #'hdf5:h5fcreate filename hdf5:+H5F-ACC-TRUNC+ write-access-parameters)) (:rename (progn ;; rename "file" to "file.bak" ;; then create new file (rename-file filename (concatenate 'string filename ".bak")) (apply #'hdf5:h5fcreate filename hdf5:+H5F-ACC-TRUNC+ write-access-parameters))) (:append (hdf5:h5fopen filename hdf5:+H5F-ACC-RDWR+ read-access-parameters))) (case if-does-not-exist (:create (apply #'hdf5:h5fcreate filename hdf5:+H5F-ACC-TRUNC+ write-access-parameters)) (:error (error "file does not exist")) (nil nil)))))))) (defun close-hdf-file (hdf-file) "Closes all datatype objects associated with file along with the file" (reset-memo-map #'typespec->hdf-type) (reset-memo-map #'hdf-type->typespec) (let ((nobs (hdf5:h5fget-obj-count hdf-file hdf5:+H5F-OBJ-ALL+)) (ids nil)) (when (plusp nobs) (with-foreign-object (raw-ids 'hid-t nobs) (hdf5:h5fget-obj-ids hdf-file hdf5:+H5F-OBJ-ALL+ nobs raw-ids) (setf ids (loop for i below nobs collecting (mem-aref raw-ids 'hid-t i))))) (loop for id in ids do ;; In the future, detect type instead of trying everything (hdf5:h5fclose id) (hdf5:h5dclose id) (hdf5:h5gclose id) (hdf5:h5tclose id) (hdf5:h5aclose id))) (hdf5:h5fclose hdf-file)) (defmacro with-open-hdf-file ((hdf-file file-path-or-string &key direction (if-exists nil if-exists-supplied-p) (if-does-not-exist nil if-does-not-exist-supplied-p) (read-access-parameters hdf5:+H5P-DEFAULT+) (write-access-parameters (list hdf5:+H5P-DEFAULT+ hdf5:+H5P-DEFAULT+))) &body body) "Macro providing lispy access to hdf (HDF5) files. Use just like you would with-open-file, just give a file and a path/string. The usual key arguments for access mode, etc. are honored and transformed into HDF5 terms. The argument hdf-file is the symbol you'll use to refer to the file handle inside of the macro body." ;; direction: :input :output ;; if-exists: :error :supersede nil :rename ;; if-does-not-exist: :error :create nil (let* ((result (gensym)) (body-with-close `(let ((,result (progn ,@body))) (close-hdf-file ,hdf-file) ,result))) `(let ((,hdf-file (open-hdf-file ,file-path-or-string ,@(when-keywords direction if-exists if-does-not-exist read-access-parameters (:write-access-parameters (cons 'list write-access-parameters)))))) ,body-with-close))) (defun hdf-mkgroup (file group-name) "Creates a group with name group-name in hdf-file file; returns path to group with final '/' included." (let ((group-name (if (not (equal (last-elt group-name) #\/)) group-name (subseq group-name 0 (1- (length group-name)))))) (hdf5:h5gclose (hdf5:h5gcreate1 file group-name 0)) (string-append group-name "/")))
8,486
Common Lisp
.lisp
210
30.857143
83
0.589967
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
ebb0e4386cefa8c10ec6d8c061f3e6059763530170226f5a384dd2dfa6b357e8
1,468
[ -1 ]
1,469
conversion.lisp
ghollisjr_cl-ana/histogram/conversion.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.histogram) (defun sparse->contiguous (histogram) "converts a sparse histogram into a contiguous one. Note that this is dangerous in cases where sparse histograms are actually necessary." (if (typep histogram 'sparse-histogram) (let* ((dim-spec-plists (hist-dim-specs histogram)) (bin-values (hist-bin-values histogram)) (hist (make-contiguous-hist dim-spec-plists :empty-bin-value (hist-empty-bin-value histogram) :default-increment (hist-default-increment histogram)))) (loop for datum in bin-values do (hist-insert hist (rest datum) (first datum))) hist) histogram)) (defun contiguous->sparse (histogram) "converts a sparse histogram into a contiguous one. Note that this is dangerous in cases where sparse histograms are actually necessary." (if (typep histogram 'contiguous-histogram) (let* ((dim-spec-plists (hist-dim-specs histogram)) (bin-values (hist-bin-values histogram)) (hist (make-sparse-hist dim-spec-plists))) (loop for datum in bin-values do (hist-insert hist (rest datum) (first datum))) hist) histogram))
2,338
Common Lisp
.lisp
57
32.561404
73
0.618086
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
41681e73558d9c5ed21c2cc170c93dff14a8547c0c4e13255c5eefa18f7aa8a4
1,469
[ -1 ]
1,470
package.lisp
ghollisjr_cl-ana/histogram/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage :cl-ana.histogram (:use #:cl #:alexandria ;; #:iter #:cl-ana.clos-utils #:cl-ana.tensor #:cl-ana.binary-tree #:cl-ana.symbol-utils #:cl-ana.string-utils #:cl-ana.list-utils #:cl-ana.hash-table-utils #:cl-ana.macro-utils #:cl-ana.functional-utils #:cl-ana.fitting #:cl-ana.map) (:export :bin ; useful for quickly plotting small datasets :histogram :rectangular-histogram :contiguous-histogram :sparse-histogram :categorical-histogram :make-contiguous-hist :make-chist :make-sparse-hist :make-shist :make-categorical-hist :make-cathist :sparse->contiguous :contiguous->sparse :copy-hist ; returns a filled or empty copy of a histogram :map-contiguous-hist :rectangular-hist-bin-specs :hist-dim-specs :hist-ndims :hist-dim-names :hist-bin-widths :hist-empty-bin-value :hist-default-increment :hist-total-integral :hist-integrate :hist-project :hist-slice :getslice :hist-insert :hist-insert-list :hist-absorb :hist-index-ref ; setf-able :hist-point-ref ; setf-able :hist-bin-values ;; Functional access: :hist-map :hist-filter ;; Abbreviations: :hins ;; hist-insert :htint ;; hist-total-integral :hint ;; hist-integrate :hproj ;; hist-project :hslice ;; hist-slice :hiref ;; hist-index-ref :hpref ;; hist-point-ref :hbv ;; hist-bin-values :hdn ;; hist-dim-names :hds ;; hist-dim-specs :hbw :normalize-histogram ;; For generating discrete dim-specs :discrete-dim-spec :dds ;; Variable binning histograms: :variable-binning-histogram :make-variable-binning-histogram :make-vhist)) (cl-ana.gmath:use-gmath :cl-ana.histogram)
2,998
Common Lisp
.lisp
93
24.795699
70
0.605789
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
c62cb772e9d1af9d3d29b77f7187d3c626ce30a3a575b269c057c244f80cae6a
1,470
[ -1 ]
1,471
rectangular-histogram.lisp
ghollisjr_cl-ana/histogram/rectangular-histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; rectangular-histogram.lisp ;;;; This probably needs a lot of work to make it logically clear ;;;; what's going on, but at the moment it does work and I don't feel ;;;; like breaking it while I try to do get plotting done. ;;;; ;;;; For example there is currently code duplication for generating ;;;; the bin-specs from the plists in the contiguous and sparse ;;;; histograms, so this should be placed in this histogram class. (in-package :cl-ana.histogram) (declaim (optimize (speed 3))) ;;;; Provides a rectangular histogram; i.e. the binning is fixed-width ;;;; and the width is uniform in every dimension. (defclass rectangular-histogram (histogram) ((bin-specs :accessor rectangular-hist-bin-specs :initarg :bin-specs :initform nil :documentation "List of number of bins, bin low edge, and bin high edge. Should be computed from a bin specification plist and then stored in said order as a list (not a plist)."))) (defmethod hist-slice ((hist rectangular-histogram) &rest dims) (let* ((empty-bin-value (hist-empty-bin-value hist)) (default-increment (hist-default-increment hist)) (type-constructor (type-constructor hist)) (all-dim-specs (hist-dim-specs hist)) (all-dims (hdn hist)) (slice-indices (get-dim-indices all-dims dims)) (remaining-dim-specs (except-at all-dim-specs slice-indices)) (remaining-indices (except-at (range 0 (1- (hist-ndims hist))) slice-indices)) (bin-values (hbv hist)) (result (make-hash-table :test 'equal))) (loop for (count . centers) in bin-values do (let* ((slice-centers (at-indices centers slice-indices)) (other-centers (at-indices centers remaining-indices)) (h (gethash slice-centers result))) (when (not h) (setf h (funcall type-constructor remaining-dim-specs :empty-bin-value empty-bin-value :default-increment default-increment)) (setf (gethash slice-centers result) h)) (hins h other-centers count))) result)) (defun get-bin-index (data-list bin-specs) "Computes the bin-index-list from the data-list (a data point). Does so for all axes, returns nil if overflow/underflow occurs. Make sure that data-list and bin-specs have the same length before calling this function; it is unchecked in this respect for speed." (labels ((get-bin-index-worker (data-list bin-specs &optional result) (if data-list ; I'm intentionally ignoring length differences ; between data-list and bin-specs (let* ((datum (first data-list)) (bin-spec (first bin-specs)) (nbins (the fixnum (first bin-spec))) (bin-index (the fixnum (get-axis-bin-index datum bin-spec)))) (when (not (or (minusp bin-index) (>= bin-index nbins))) (get-bin-index-worker (rest data-list) (rest bin-specs) (cons bin-index result)))) (nreverse result)))) (get-bin-index-worker data-list bin-specs))) (defun get-axis-bin-index (value bin-spec) "Computes the bin index (-1 underflow, binnum overflow) for value given the bin-spec for a single axis/dimension." (declare (list bin-spec) (real value)) (destructuring-bind (nbins binlo binhi) bin-spec (declare (fixnum nbins)) (let ((delta (cl:/ (cl:- binhi binlo) nbins))) (the fixnum (floor (cl:- value binlo) delta))))) (defun get-bin-center-worker (bin-spec index) (let* ((nbins (first bin-spec)) (binlo (second bin-spec)) (binhi (third bin-spec)) (delta (cl:/ (cl:- binhi binlo) nbins))) (declare (fixnum nbins)) (cl:+ binlo (cl:/ delta 2) (cl:* delta index)))) (defun get-bin-center (bin-specs bin-index) (mapcar #'get-bin-center-worker bin-specs bin-index)) (defun hist-dim-specs (histogram) "Returns the plists denoting the name, nbins, low, and high for each dimension in the histogram." (loop for bin-spec in (rectangular-hist-bin-specs histogram) for dim-name in (hist-dim-names histogram) collecting (destructuring-bind (nbins low high) bin-spec (list :name dim-name :nbins nbins :low low :high high)))) (defun hist-bin-widths (hist) (mapcar (lambda (lst) (destructuring-bind (&key low high nbins &allow-other-keys) lst (cl:/ (cl:- high low) nbins))) (hist-dim-specs hist))) ;; abbrevations: (defun hds (histogram) "Abbreviation for hist-dim-specs" (hist-dim-specs histogram)) (defun hbw (histogram) (hist-bin-widths histogram)) ;; Ease of use: ;; nbins * delta + low = high ;; -> delta = (high - low)/nbins ;; if nbins = floor((high-low/delta)) then ;; newhigh = floor((high-low)/delta)*delta + low (defun discrete-dim-spec (&key low high (delta 1d0)) "Returns dim-spec for discrete/integral data, e.g. digital event counter readouts." (let* ((newlow (cl:- low (cl:* delta 0.5))) (newnbins (1+ (floor (cl:- high low) delta))) (newhigh (cl:+ low (cl:* (1- newnbins) delta) (cl:* delta 0.5)))) (list :low newlow :high newhigh :nbins newnbins))) (defun dds (&rest args) "Abbreviation for discrete-dim-spec" (apply #'discrete-dim-spec args))
6,763
Common Lisp
.lisp
164
32.932927
74
0.60933
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
251626107aa44096bcce9b56d09b806276f0ad595c68f9758ff3e3122a26c53c
1,471
[ -1 ]
1,472
contiguous-histogram.lisp
ghollisjr_cl-ana/histogram/contiguous-histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; Implements histograms with binning which is both contiguous and ;;;; uniform. (in-package :cl-ana.histogram) (defclass contiguous-histogram (rectangular-histogram) ((bin-values :accessor contiguous-hist-bin-values :initarg :bin-values :initform nil :documentation "Nested arrays representing the bin values"))) ;; I was thinking about making this a method on initialize-instance, ;; but it seems cleaner to keep this as a distinct function, since if ;; I wish to directly copy histogram contents the initialize-instance ;; method would have to handle these two cases separately, or I would ;; have to implement the copying in a strange way. (defun make-contiguous-hist (dim-spec-plists &key empty-bin-value default-increment) "dim-spec-plist is a plist with the following fields: :name :low :high :nbins, which specify the axis name, bin-low-edge, bin-high-edge, and the number of bins on the axis respectively. Example usage: (make-contiguous-hist (list (list :name \"x\" :nbins 10 :low 50 :high 55))) would create a contiguous histogram with one dimension named \"x\" with 10 bins, low bin edge 50 and high bin edge 55." (let* ((dim-names (mapcar (lambda (spec) (getf spec :name)) dim-spec-plists)) (ndims (length dim-names)) (bin-specs (mapcar (lambda (s) (list (getf s :nbins) (getf s :low) (getf s :high))) dim-spec-plists)) (size-list (mapcar #'first bin-specs)) (default-args (progn (let ((result ())) (when empty-bin-value (push empty-bin-value result) (push :empty-bin-value result)) (when default-increment (push default-increment result) (push :default-increment result)) result))) (result (apply #'make-instance 'contiguous-histogram :ndims ndims :dim-names dim-names :bin-specs bin-specs default-args)) (bin-values (make-contiguous-hist-contents size-list (hist-empty-bin-value result)))) (setf (contiguous-hist-bin-values result) bin-values) result)) (defun make-chist (dim-spec-plists &key empty-bin-value default-increment) "Abbreviation for make-contiguous-hist" #k(make-contiguous-hist dim-spec-plists &when-keys empty-bin-value default-increment)) (defmethod empty-copy ((h contiguous-histogram)) (with-slots (empty-bin-value default-increment) h (make-chist (hist-dim-specs h) :empty-bin-value empty-bin-value :default-increment default-increment))) (defmethod hist-total-integral ((hist contiguous-histogram)) (let ((bin-values (hist-bin-values hist))) (sum (mapcar #'car bin-values)))) (defmethod hist-integrate ((histogram contiguous-histogram) &rest axes) (if axes (with-accessors ((ndims hist-ndims) (dim-names hist-dim-names) (empty-bin-value hist-empty-bin-value) (default-increment hist-default-increment) (bin-values contiguous-hist-bin-values) (bin-specs rectangular-hist-bin-specs)) histogram (if (length-equal axes ndims) (hist-total-integral histogram) (flet ((index-key (x) (if (listp x) (first x) x))) (let* ((axis-name-or-indices (mapcar (lambda (x) (if (listp x) (first x) x)) axes)) (dim-indices (get-dim-indices dim-names axis-name-or-indices)) (point-bounds (mapcar (lambda (x) (when (listp x) (rest x))) axes)) (index-bounds (mapcar (lambda (point-bound bin-spec) (when point-bound (let ((low-index (get-axis-bin-index (first point-bound) bin-spec)) (high-index (get-axis-bin-index (second point-bound) bin-spec))) (list (if (equal low-index :underflow) 0 low-index) (if (equal high-index :overflow) (1- (first bin-spec)) high-index))))) point-bounds bin-specs)) (index-specs (mapcar (lambda (x y) (if y (cons x y) x)) dim-indices index-bounds)) (index-specs-copy (copy-list index-specs)) (sorted-index-specs (sort index-specs-copy #'> :key #'index-key)) (unique-sorted-index-specs (reduce (lambda (x y) (adjoin y x :test #'equal :key #'index-key)) sorted-index-specs :initial-value ())) (unique-sorted-indices (mapcar (lambda (x) (if (listp x) (first x) x)) unique-sorted-index-specs)) (new-ndims (- ndims (length unique-sorted-indices))) (new-dim-names (except-at dim-names unique-sorted-indices :uniquely-sorted t)) (new-bin-specs (except-at bin-specs unique-sorted-indices :uniquely-sorted t))) (make-instance 'contiguous-histogram :ndims new-ndims :dim-names new-dim-names :empty-bin-value empty-bin-value :default-increment default-increment :bin-values (contiguous-hist-integrate-contents bin-values index-specs) :bin-specs new-bin-specs))))) histogram)) ;; note that hist-insert is a stateful function, since this is the ;; only efficient way to implement it (defmethod hist-insert ((hist contiguous-histogram) datum &optional weight) (let ((data-list (mklist datum)) (weight-factor (if weight weight (hist-default-increment hist)))) (cond-setf (hist-point-ref hist data-list) (+ (hist-point-ref hist data-list) weight-factor) :place) hist)) (defmethod hist-index-ref ((hist contiguous-histogram) index-list) "Unchecked, assumes you know what the allowed index values are." (with-accessors ((bin-values contiguous-hist-bin-values)) hist (apply #'tensor-ref bin-values index-list))) (defmethod (setf hist-index-ref) (value (hist contiguous-histogram) index-list) "Unchecked, assumes you know what the allowed index values are." (with-accessors ((bin-values contiguous-hist-bin-values)) hist (setf (apply #'tensor-ref bin-values index-list) value))) (defmethod hist-point-ref ((hist contiguous-histogram) data-list) "Checked access to the bin value via a point. Returns nil if the point is not inside the histogram domain." (with-accessors ((bin-specs rectangular-hist-bin-specs)) hist (let ((bin-index (get-bin-index data-list bin-specs))) (when bin-index (hist-index-ref hist bin-index))))) (defmethod (setf hist-point-ref) (value (hist contiguous-histogram) data-list) "Checked setf to the bin value via a point. Does nothing & returns nil if the point is not inside the histogram domain." (with-accessors ((bin-specs rectangular-hist-bin-specs) (bin-values contiguous-hist-bin-values)) hist (let ((bin-index (get-bin-index data-list bin-specs))) (when bin-index (setf (hist-index-ref hist bin-index) value))))) (defmethod hist-bin-values ((hist contiguous-histogram)) (with-accessors ((bin-specs rectangular-hist-bin-specs) (bin-values contiguous-hist-bin-values)) hist (let* ((nbin-list (mapcar #'first bin-specs)) (bin-indices (apply #'cartesian-product (mapcar (lambda (x) (range 0 (1- x))) nbin-list)))) (mapcar (lambda (bin-index) (cons (hist-index-ref hist bin-index) (get-bin-center bin-specs bin-index))) bin-indices)))) ;;; Generic Math functions: ;; Note that I am still not sure how to handle summing when the axis ;; limits and bin sizes are not the same. It may be best to leave ;; this to the user and just provide naive arithmetic functions. ;; ;; In general you should be safe as long as your histograms have the ;; same axis limits & bin sizes. (defun map-contiguous-hist (fn &rest histograms) "Defines the map operation over contiguous histograms." (let ((h1 (first histograms))) (with-accessors ((bin-specs rectangular-hist-bin-specs) (ndims hist-ndims) (dim-names hist-dim-names) (empty-bin-value hist-empty-bin-value) (default-increment hist-default-increment)) h1 (make-instance 'contiguous-histogram :ndims ndims :dim-names dim-names :empty-bin-value empty-bin-value :default-increment default-increment :bin-specs bin-specs :bin-values (apply #'tensor-map fn (mapcar #'contiguous-hist-bin-values histograms)))))) (defmethod add ((h1 contiguous-histogram) (h2 contiguous-histogram)) (map-contiguous-hist #'add h1 h2)) (defmethod sub ((h1 contiguous-histogram) (h2 contiguous-histogram)) (map-contiguous-hist #'sub h1 h2)) (defmethod mult ((h1 contiguous-histogram) (h2 contiguous-histogram)) (map-contiguous-hist #'mult h1 h2)) (defmethod div ((h1 contiguous-histogram) (h2 contiguous-histogram)) (map-contiguous-hist #'div h1 h2)) (defmethod unary-div ((h1 contiguous-histogram)) (map-contiguous-hist #'unary-div h1)) ;; NOTE: This method differs from the usage of other protected-div ;; methods in that histograms have a default bin value. For this ;; reason, the default bin value for the first histogram is used by ;; default instead of 0. (defmethod protected-div ((h1 contiguous-histogram) (h2 contiguous-histogram) &key protected-value) (let ((protected-value (if protected-value protected-value (hist-empty-bin-value h1)))) (map-contiguous-hist (lambda (x y) (protected-div x y :protected-value protected-value)) h1 h2))) ;; See notes on protected-div (defmethod protected-unary-div ((h contiguous-histogram) &key protected-value) (let ((protected-value (if protected-value protected-value (hist-empty-bin-value h)))) (map-contiguous-hist (lambda (x) (protected-unary-div x :protected-value protected-value)) h))) ;;; Internal-usage functions (defun contiguous-hist-integrate-contents (hist index-specs) "Assumes the index-specs are unique and sorted greatest to least." (reduce #'contiguous-hist-integrate-contents-worker index-specs :initial-value hist)) (defun contiguous-hist-integrate-contents-worker (hist index-spec) (if (zerop (if (listp index-spec) (first index-spec) index-spec)) (reduce #'tensor-+ (if (listp index-spec) (subseq hist (second index-spec) (1+ (third index-spec))) hist)) (map (type-of hist) (lambda (h) (contiguous-hist-integrate-contents-worker h (if (listp index-spec) (cons (1- (first index-spec)) (rest index-spec)) (1- index-spec)))) hist))) (defun make-contiguous-hist-contents (size-list initial-value) (if size-list (let ((size (first size-list))) (if (single size-list) (make-array (first size-list) :initial-element initial-value) (let* ((result (make-array size))) (loop for i from 0 below size do (setf (elt result i) (make-contiguous-hist-contents (rest size-list) initial-value))) result))) nil)) (defun point-in-bounds (hist point) (with-accessors ((bin-specs rectangular-hist-bin-specs)) hist (let ((lower-bounds (mapcar #'second bin-specs)) (upper-bounds (mapcar #'third bin-specs))) (every (lambda (x y z) (and (<= x y) (< y z))) lower-bounds point upper-bounds)))) (defmethod hist-reorder-dimensions ((histogram contiguous-histogram) dim-indices) (if (equal dim-indices (range 0 (length dim-indices))) histogram (let ((result (make-contiguous-hist (permute (hist-dim-specs histogram) dim-indices) :empty-bin-value (hist-empty-bin-value histogram) :default-increment (hist-default-increment histogram)))) (loop for bin-value in (hist-bin-values histogram) do (hist-insert result (permute (rest bin-value) dim-indices) (first bin-value))) result))) (defmethod type-constructor ((hist contiguous-histogram)) #'make-contiguous-hist)
15,409
Common Lisp
.lisp
347
31.659942
84
0.559577
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
2be28fb25e8c4ad51bb592ac73e1309f8b265046d9352fa834ccb1fd021d83c4
1,472
[ -1 ]
1,473
categorical-histogram.lisp
ghollisjr_cl-ana/histogram/categorical-histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.histogram) ;; I've realized that histograms are an instance of a more general ;; idea: Categorization/Grouping. The categories are the bin ranges, ;; and can be represented by the bin centers as long as all bin ;; properties are known from this (it seems obvious but it took a ;; while to realize). ;; ;; Also: sparse and contiguous histograms are provided for efficiency ;; reasons only, since categorical-histograms are general enough for ;; any histogramming, including nonuniform-binning (defclass categorical-histogram (histogram) ((bin-table :initarg :bin-table :initform (make-hash-table :test 'equal) :accessor cathist-bin-table))) (defun make-categorical-hist (dim-names &key default-increment empty-bin-value) #k(make-instance 'categorical-histogram :dim-names dim-names :ndims (length dim-names) &when-keys default-increment empty-bin-value)) (defun make-cathist (&rest args) "Short form of make-categorical-hist" (apply #'make-categorical-hist args)) (defmethod type-constructor ((hist categorical-histogram)) #'make-cathist) (defmethod empty-copy ((hist categorical-histogram)) (with-slots (dim-names default-increment empty-bin-value) hist (make-cathist dim-names :default-increment default-increment :empty-bin-value empty-bin-value))) (defmethod hist-insert ((hist categorical-histogram) datum &optional weight) (with-slots (bin-table empty-bin-value default-increment) hist (let ((weight (if weight weight default-increment))) (if (gethash datum bin-table) (incf (gethash datum bin-table) weight) (setf (gethash datum bin-table) (+ empty-bin-value weight))))) hist) (defmethod hist-point-ref ((hist categorical-histogram) point) (with-slots (bin-table) hist (aif (gethash point bin-table) it (hist-empty-bin-value hist)))) (defmethod hist-bin-values ((hist categorical-histogram)) (with-slots (bin-table) hist (loop for k being the hash-keys in bin-table for v being the hash-values in bin-table collecting (cons v k)))) (defmethod hist-total-integral ((hist categorical-histogram)) (sum (mapcar #'car (hist-bin-values hist)))) (defmethod hist-integrate ((hist categorical-histogram) &rest axes) (with-slots (ndims dim-names empty-bin-value default-increment) hist (let* ((indices (get-dim-indices dim-names axes)) (remaining-dim-names (except-at dim-names indices)) (remaining-indices (except-at (range 0 (1- ndims)) indices)) (result (make-cathist remaining-dim-names :empty-bin-value empty-bin-value :default-increment default-increment))) (loop for (count . centers) in (hist-bin-values hist) do (hist-insert result (at-indices centers remaining-indices) count)) result))) ;; for hist-project (defmethod hist-reorder-dimensions ((hist categorical-histogram) dim-indices) (let ((result (empty-copy hist))) (loop for (count . centers) in (hist-bin-values hist) do (hist-insert result (permute centers dim-indices) count)) result)) (defmethod hist-slice ((hist categorical-histogram) &rest dims) (let* ((empty-bin-value (hist-empty-bin-value hist)) (default-increment (hist-default-increment hist)) (type-constructor (type-constructor hist)) (all-dim-names (hist-dim-names hist)) (all-dims (hdn hist)) (slice-indices (get-dim-indices all-dims dims)) (remaining-dim-names (except-at all-dim-names slice-indices)) (remaining-indices (except-at (range 0 (1- (hist-ndims hist))) slice-indices)) (bin-values (hbv hist)) (result (make-hash-table :test 'equal))) (loop for (count . centers) in bin-values do (let* ((slice-centers (at-indices centers slice-indices)) (other-centers (at-indices centers remaining-indices)) (h (gethash slice-centers result))) (when (not h) (setf h (funcall type-constructor remaining-dim-names :empty-bin-value empty-bin-value :default-increment default-increment)) (setf (gethash slice-centers result) h)) (hins h other-centers count))) result))
5,902
Common Lisp
.lisp
153
29.575163
70
0.610548
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
86ba8abc6ae013287045fdbac1339fa46a4373d70c12283fd40d6b2bbf5c1bdb
1,473
[ -1 ]
1,474
uniform-binning.lisp
ghollisjr_cl-ana/histogram/uniform-binning.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; Provides common functions for contiguous-histogram and ;;;; sparse-histogram due to uniform binning (in-package :cl-ana.histogram) (defun get-bin-index (data-list bin-specs) "Computes the bin-index-list from the data-list (a data point). Does so for all axes, returns nil if overflow/underflow occurs. Make sure that data-list and bin-specs have the same length before calling this function; it is unchecked in this respect for speed." (labels ((get-bin-index-worker (data-list bin-specs &optional result) (if data-list ; I'm intentionally ignoring length differences ; between data-list and bin-specs (let* ((datum (first data-list)) (bin-spec (first bin-specs)) (bin-index (get-axis-bin-index datum bin-spec))) (if (not (or (equal bin-index :underflow) (equal bin-index :overflow))) (get-bin-index-worker (rest data-list) (rest bin-specs) (cons bin-index result)))) (nreverse result)))) (get-bin-index-worker data-list bin-specs))) (defun get-axis-bin-index (value bin-spec) "Computes the bin index (-1 underflow, binnum overflow) for value given the bin-spec for a single axis/dimension." (let* ((nbins (first bin-spec)) (binlo (second bin-spec)) (binhi (third bin-spec)) (delta (/ (- binhi binlo) nbins))) (labels ((internal-bin (i) (cond ((< i 0) :underflow) ((> i (- nbins 1)) :overflow) (t i)))) (internal-bin (floor (/ (- value binlo) delta)))))) (defun get-bin-center-worker (bin-spec index) (let* ((nbins (first bin-spec)) (binlo (second bin-spec)) (binhi (third bin-spec)) (delta (/ (- binhi binlo) nbins))) (+ binlo (/ delta 2) (* delta index)))) (defun get-bin-center (bin-specs bin-index) (mapcar #'get-bin-center-worker bin-specs bin-index))
2,704
Common Lisp
.lisp
67
36.761194
70
0.680867
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e23b2045c452a269a4e074ebac25b370f5238ff77e4bc284fd4543a542bac41e
1,474
[ -1 ]
1,475
sparse-histogram.lisp
ghollisjr_cl-ana/histogram/sparse-histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; Implements sparse histogram with uniform binning (in-package :cl-ana.histogram) (defclass sparse-histogram (rectangular-histogram) ((bin-value-map :accessor sparse-hist-value-map :initarg :value-map :initform nil :documentation "Hash table storing the histogram bin values which have been set."))) (defun make-sparse-hist (dim-spec-plists &key empty-bin-value default-increment hash-table-test) "dim-spec-plist is a plist with the following fields: :name :low :high :nbins, which specify the axis name, bin-low-edge, bin-high-edge, and the number of bins on the axis respectively. Example usage: (make-sparse-hist (list (list :name \"x\" :nbins 10 :low 50 :high 55))) would create a sparse histogram with one dimension named \"x\" with 10 bins, low bin edge 50 and high bin edge 55." (let* ((dim-names (mapcar (lambda (spec) (getf spec :name)) dim-spec-plists)) (ndims (length dim-names)) (bin-specs (mapcar (lambda (s) (list (getf s :nbins) (getf s :low) (getf s :high))) dim-spec-plists)) (default-args (progn (let ((result ())) (when empty-bin-value (push empty-bin-value result) (push :empty-bin-value result)) (when default-increment (push default-increment result) (push :default-increment result)) result)))) (apply #'make-instance 'sparse-histogram :ndims ndims :dim-names dim-names :bin-specs bin-specs :value-map (make-hash-table :test (if hash-table-test hash-table-test 'equal)) default-args))) (defun make-shist (dim-spec-plists &key empty-bin-value default-increment) "Abbreviation for make-sparse-hist" #k(make-sparse-hist dim-spec-plists &when-keys empty-bin-value default-increment)) (defmethod empty-copy ((h sparse-histogram)) (with-slots (empty-bin-value default-increment) h (make-shist (hist-dim-specs h) :empty-bin-value empty-bin-value :default-increment default-increment))) ;; For now I'll use this; since I'm not taking into account empty bins ;; during the other calculations I guess I'm not going to do it here ;; either--emphasis on for now. (defmethod hist-total-integral ((hist sparse-histogram)) (let ((bin-values (hist-bin-values hist))) (if bin-values (sum (mapcar #'car bin-values)) 0))) (defmethod hist-integrate ((histogram sparse-histogram) &rest axes) (if axes (with-accessors ((ndims hist-ndims) (dim-names hist-dim-names) (empty-bin-value hist-empty-bin-value) (default-increment hist-default-increment) (value-map sparse-hist-value-map) (bin-specs rectangular-hist-bin-specs)) histogram (if (length-equal axes ndims) (hist-total-integral histogram) (flet ((index-key (x) (if (listp x) (first x) x))) (let* ((axis-name-or-indices (mapcar (lambda (x) (if (listp x) (first x) x)) axes)) (dim-indices (get-dim-indices dim-names axis-name-or-indices)) (point-bounds (mapcar (lambda (x) (when (listp x) (rest x))) axes)) (index-bounds (mapcar (lambda (point-bound bin-spec) (when point-bound (let ((low-index (get-axis-bin-index (first point-bound) bin-spec)) (high-index (get-axis-bin-index (second point-bound) bin-spec))) (list (if (equal low-index :underflow) 0 low-index) (if (equal high-index :overflow) (1- (first bin-spec)) high-index))))) point-bounds bin-specs)) (index-specs (mapcar (lambda (x y) (if y (cons x y) x)) dim-indices index-bounds)) (index-specs-copy (copy-list index-specs)) (sorted-index-specs (sort index-specs-copy #'> :key #'index-key)) (unique-sorted-index-specs (reduce (lambda (x y) (adjoin y x :test #'equal :key #'index-key)) sorted-index-specs :initial-value ())) (unique-sorted-indices (mapcar (lambda (x) (if (listp x) (first x) x)) unique-sorted-index-specs)) (new-ndims (cl:- ndims (length unique-sorted-indices))) (new-dim-names (except-at dim-names unique-sorted-indices :uniquely-sorted t)) (new-bin-specs (except-at bin-specs unique-sorted-indices :uniquely-sorted t))) (make-instance 'sparse-histogram :ndims new-ndims :dim-names new-dim-names :empty-bin-value empty-bin-value :default-increment default-increment :value-map (sparse-hist-integrate-contents value-map index-specs ;;unique-sorted-index-specs empty-bin-value) :bin-specs new-bin-specs))))) histogram)) (defmethod hist-insert ((hist sparse-histogram) datum &optional weight) (with-accessors ((value-map sparse-hist-value-map) (empty-bin-value hist-empty-bin-value)) hist (let ((point (mklist datum)) (weight-factor (if weight weight (hist-default-increment hist)))) (cond-setf (hist-point-ref hist point) (+ (hist-point-ref hist point) weight-factor) :place) hist))) (defmethod hist-index-ref ((hist sparse-histogram) index-list) "Unchecked, assumes you know what the allowed index values are." (with-accessors ((value-map sparse-hist-value-map) (empty-bin-value hist-empty-bin-value)) hist (gethash index-list value-map empty-bin-value))) (defmethod (setf hist-index-ref) (value (hist sparse-histogram) index-list) "Unchecked, assumes you know what the allowed index values are." (with-accessors ((value-map sparse-hist-value-map)) hist (setf (gethash index-list value-map) value))) (defmethod hist-point-ref ((hist sparse-histogram) point) "Checked access to the bin value via a point. Returns nil if the point is not inside the histogram domain." (with-accessors ((bin-specs rectangular-hist-bin-specs) (value-map sparse-hist-value-map) (empty-bin-value hist-empty-bin-value)) hist (let ((bin-index (get-bin-index point bin-specs))) (when bin-index (gethash bin-index value-map empty-bin-value))))) (defmethod (setf hist-point-ref) (value (hist sparse-histogram) point) "Checked setf to the bin value via a point. Does nothing & returns nil if the point is not inside the histogram domain." (with-accessors ((bin-specs rectangular-hist-bin-specs) (value-map sparse-hist-value-map)) hist (let ((bin-index (get-bin-index point bin-specs))) (when bin-index (setf (gethash bin-index value-map) value))))) (defmethod hist-bin-values ((hist sparse-histogram)) (with-accessors ((value-map sparse-hist-value-map) (bin-specs rectangular-hist-bin-specs)) hist (iter:iter (iter:for (key val) in-hashtable value-map) (iter:collect (cons val (get-bin-center bin-specs key)))))) ;;; Generic Math functions: ;; It may not be in the best style to implement mathematical functions ;; on sparse histograms. Reason: They use un-ordered containers (hash ;; tables) for the data. That means that, unless assumptions are made ;; about the default value, it will be extremely inefficient to try to ;; do computations using the sparse histograms. It would be better to ;; do computations with contiguous histograms by first integrating the ;; sparse histogram into a size small enough to be operated on. But I ;; may change my mind and implement the basic functions anyways. ;;; Internal use functions (defun sparse-hist-integrate-contents (value-map index-specs empty-bin-value) "Integrates over the bin value hash table according to the index-specs." (reduce (rcurry #'sparse-hist-integrate-contents-worker empty-bin-value) index-specs :initial-value value-map)) (defun sparse-hist-integrate-contents-worker (value-map index-spec empty-bin-value) "Integrates the bin value hash table along the index in index-spec; if index-spec is a list, then the axis index is taken from the first value, and then the index low/high cutoffs are taken from the second and third elements respectively." (let* ((test (hash-table-test value-map)) (result (make-hash-table :test test))) (if (listp index-spec) ;; handle case with bounds (let ((axis (first index-spec)) (low-bound (second index-spec)) (high-bound (third index-spec))) (iter:iter (iter:for (key val) in-hashtable value-map) (let ((this-axis (elt key axis))) (when (and (<= low-bound this-axis) (< this-axis high-bound)) (setf (gethash (except-nth key axis) result) (+ (gethash (except-nth key axis) result empty-bin-value) val)))))) ;; handle the unbounded case (let ((axis index-spec)) (iter:iter (iter:for (key val) in-hashtable value-map) (setf (gethash (except-nth key axis) result) (+ (gethash (except-nth key axis) result empty-bin-value) val))))) result)) (defmethod hist-reorder-dimensions ((histogram sparse-histogram) dim-indices) (if (equal dim-indices (range 0 (length dim-indices))) histogram (let ((result (make-sparse-hist (permute (hist-dim-specs histogram) dim-indices) :empty-bin-value (hist-empty-bin-value histogram) :default-increment (hist-default-increment histogram)))) (loop for bin-value in (hist-bin-values histogram) do (hist-insert result (permute (rest bin-value) dim-indices) (first bin-value))) result))) (defmethod type-constructor ((hist sparse-histogram)) #'make-sparse-hist)
13,101
Common Lisp
.lisp
283
32.074205
83
0.541064
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
7729085475e486306a249307485b4c90097e8fccdb1e380b6f57f8c0c0a58821
1,475
[ -1 ]
1,476
variable-binning-histogram.lisp
ghollisjr_cl-ana/histogram/variable-binning-histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.histogram) ;; Each bin low edge is mapped to the count of for that bin. The low ;; edge is chosen so that (defclass variable-binning-histogram (histogram) ((dim-specs :accessor variable-binning-histogram-dim-specs :initarg :dim-specs :initform nil :documentation "List of bin edges for each dimension") (content :accessor variable-binning-histogram-content :initarg :content :initform (make-hash-table :test #'equal) :documentation "Hash table mapping from low-edge list to count") ;; internal usage: (binary-trees :accessor variable-binning-histogram-binary-trees :initarg :binary-trees :initform nil :documentation "List of binary trees for each dimension used to lookup bin content") (maxes :accessor variable-binning-histogram-maxes :initarg :maxes :initform nil :documentation "List of maximum values for each dimension; for optimization."))) (defun make-variable-binning-histogram (names-specs &key (empty-bin-value 0) (default-increment 1)) "Creates a variable-binning-histogram. names-specs should be an alist mapping from dimension name to the list of bin edges for that dimension (i.e. a list of lists with the first elements being the dimension names)." (make-instance 'variable-binning-histogram :ndims (length names-specs) :dim-names (mapcar #'car names-specs) :empty-bin-value empty-bin-value :default-increment default-increment :dim-specs (mapcar #'cdr names-specs) :binary-trees (mapcar #'make-balanced-tree (mapcar #'cdr names-specs)) :maxes (mapcar (lambda (x) (first (last x))) names-specs))) (defun make-vhist (names-specs &key (empty-bin-value 0) (default-increment 1)) (make-variable-binning-histogram names-specs :empty-bin-value empty-bin-value :default-increment default-increment)) (defmethod hist-insert ((hist variable-binning-histogram) datum &optional weight) (with-accessors ((low-edges variable-binning-histogram-dim-specs) (btrees variable-binning-histogram-binary-trees) (content variable-binning-histogram-content) (maxes variable-binning-histogram-maxes) (empty-bin-value hist-empty-bin-value) (default-increment hist-default-increment)) hist (flet ((uncar (x) (if (consp x) (car x) x))) (let ((indices (mapcar (lambda (bt d h) (when (< d h) (uncar (bref bt d)))) btrees datum maxes))) (when (every #'identity indices) (let ((weight (if weight weight default-increment)) (start (if (gethash indices content) (gethash indices content) empty-bin-value))) (setf (gethash indices content) (+ start weight))))))) hist) ;; Map->alist (defmethod map->alist ((obj variable-binning-histogram)) (let* ((edges-list (variable-binning-histogram-dim-specs obj)) (bin-widths-list (mapcar (lambda (edges) (- (rest edges) edges)) edges-list)) (edge->width-ht-list (loop for edges in edges-list for bin-widths in bin-widths-list collecting (let ((result (make-hash-table :test 'equal))) (loop for edge in edges for width in bin-widths do (setf (gethash edge result) width)) result))) (content (variable-binning-histogram-content obj))) (loop for point being the hash-keys in content for count being the hash-values in content collecting (cons (loop for p in point for edge->width in edge->width-ht-list collecting (+ p (* 0.5 (gethash p edge->width)))) count)))) ;; Copying (defmethod copy-hist ((obj variable-binning-histogram) &optional empty-p) (let ((result (make-variable-binning-histogram (zip (hist-dim-names obj) (variable-binning-histogram-dim-specs obj)) :empty-bin-value (hist-empty-bin-value obj) :default-increment (hist-default-increment obj)))) (if empty-p result (let ((ht (variable-binning-histogram-content obj)) (result-ht (variable-binning-histogram-content result))) (loop for indices being the hash-keys in ht for count being the hash-values in ht do (setf (gethash indices result-ht) count)) result)))) ;; Arithmetic functions: ;; Assumes that the histograms have congruent binnings (defmethod add ((h1 variable-binning-histogram) (h2 variable-binning-histogram)) (let ((h2-content (variable-binning-histogram-content h2)) (result (copy-hist h1))) (loop for indices being the hash-keys in h2-content for count being the hash-values in h2-content do (hins result indices count)) result)) (defmethod sub ((h1 variable-binning-histogram) (h2 variable-binning-histogram)) (let ((h2-content (variable-binning-histogram-content h2)) (result (copy-hist h1))) (loop for indices being the hash-keys in h2-content for count being the hash-values in h2-content do (hins result indices (- count))) result)) (defmethod mult ((h1 variable-binning-histogram) (h2 variable-binning-histogram)) (let ((h1-content (variable-binning-histogram-content h1)) (h2-content (variable-binning-histogram-content h2)) (result (copy-hist h1 t))) (loop for indices being the hash-keys in h1-content for count1 being the hash-values in h1-content do (let ((count2 (gethash indices h2-content))) (when count2 (hins result indices (mult count1 count2))))) result)) (defmethod unary-div ((h variable-binning-histogram)) (let ((h-content (variable-binning-histogram-content h)) (result (copy-hist h t))) (loop for indices being the hash-keys in h-content for count being the hash-values in h-content do (hins result indices (unary-div count))) result)) (defmethod div ((h1 variable-binning-histogram) (h2 variable-binning-histogram)) (let ((h1-content (variable-binning-histogram-content h1)) (h2-content (variable-binning-histogram-content h2)) (result (copy-hist h1 t))) (loop for indices being the hash-keys in h1-content for count1 being the hash-values in h1-content do (let ((count2 (gethash indices h2-content))) (when count2 (hins result indices (div count1 count2))))) result)) ;; NOTE: This method differs from the usage of other protected-div ;; methods in that histograms have a default bin value. For this ;; reason, the default bin value for the first histogram is used by ;; default instead of 0. (defmethod protected-div ((h1 variable-binning-histogram) (h2 variable-binning-histogram) &key protected-value) (let* ((protected-value (if protected-value protected-value (hist-empty-bin-value h1))) (h1-content (variable-binning-histogram-content h1)) (h2-content (variable-binning-histogram-content h2)) (result (copy-hist h1 t))) (loop for indices being the hash-keys in h1-content for count1 being the hash-values in h1-content do (let ((count2 (gethash indices h2-content))) (when count2 (hins result indices (protected-div count1 count2 :protected-value protected-value))))) result))
9,786
Common Lisp
.lisp
251
28.079681
70
0.576935
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
0f0ab2abcd9a31a132f6b8b1685a330fa239e85960951f0489cde0711b315716
1,476
[ -1 ]
1,477
test.lisp
ghollisjr_cl-ana/histogram/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana) (in-package :cl-ana) (defparameter *ndata* 1000000) (defparameter *x-data* nil) (defparameter *y-data* nil) (defun fill-random () (setf *x-data* nil) (setf *y-data* nil) (iter (for i from 0 to (1- *ndata*)) (push (* 2d0 (/ (random 100) 100)) *x-data*) (push (* 2d0 (/ (random 100) 100)) *y-data*))) (defun contiguous-hist-test () (defparameter *hist* (make-contiguous-hist (list (list :name "x" :nbins 10 :low 0d0 :high 5d0) (list :name "y" :nbins 3 :low 0 :high 2)) :default-increment (+- 1 1))) ;;(fill-random) (defparameter *data* (mapcar #'list *x-data* *y-data*)) (dolist (d *data*) (hist-insert *hist* d)) (hist-integrate *hist* "x")) (defun sparse-hist-test () (defparameter *hist* (make-sparse-hist (list (list :name "x" :nbins 10 :low 0d0 :high 5d0) (list :name "y" :nbins 3 :low 0 :high 2)) :default-increment (+- 1 1))) (defparameter *ndata* 1000000) ;;(fill-random) (defparameter *data* (mapcar #'list *x-data* *y-data*)) (dolist (d *data*) (hist-insert *hist* d)) (hist-integrate *hist* "x"))
2,144
Common Lisp
.lisp
67
27.238806
70
0.616699
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
c6657b569dcd23e75732d8c62961cd62c8972c25106219f77df63cec0387c992
1,477
[ -1 ]
1,478
histogram.lisp
ghollisjr_cl-ana/histogram/histogram.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; Histogram interface. Most of the interesting mathematical ;;;; features like summing, multiplying, scaling histograms are done ;;;; via the generic math (gmath) library. (in-package :cl-ana.histogram) (defclass histogram () ((ndims :accessor hist-ndims :initarg :ndims :initform 0 :documentation "Number of dimensions of the histogram") (dim-names :accessor hist-dim-names :initarg :dim-names :initform () :documentation "Names of the dimension axes") (empty-bin-value :accessor hist-empty-bin-value :initarg :empty-bin-value :initform 0 :documentation "Default value for a bin which has had no events added") (default-increment :accessor hist-default-increment :initarg :default-increment :initform 1 :documentation "Default amount by which bins are incremented; i.e. unless overridden by a weight factor."))) (defgeneric hist-total-integral (histogram) (:documentation "Returns the number of entries in the histogram, i.e. the full integral of the histogram")) (defgeneric hist-integrate (histogram &rest axes) (:documentation "Integrates the histogram along the dimensions/axes specified. Axes are specified using the lispified dimension name (a string); specifying by index is for internal use but can be done. Also in order to support partial domain integration, each axis in the axes list can also be a list of three values: the axis name, the lower bound over which to integrate, and the upper bound.")) (defgeneric hist-project (histogram &rest axes) (:documentation "Projects the histogram onto specified axes by integrating over the other axes. As with integrate, the axes are specified using name. Comes with a default implementation that should be good for most cases; specialize only if necessary.") (:method (histogram &rest axes) (with-accessors ((dim-names hist-dim-names) (ndims hist-ndims)) histogram (let* ((selected-axis-indices (get-dim-indices dim-names axes)) (integrate-axes (set-difference (range 0 (1- ndims)) selected-axis-indices)) (disordered-hist (apply #'hist-integrate histogram integrate-axes)) (new-selected-axis-indices (condense-indices selected-axis-indices))) (hist-reorder-dimensions disordered-hist new-selected-axis-indices))))) (defgeneric hist-reorder-dimensions (histogram dim-indices) (:documentation "Re-arranges the data in the histogram so that the dimensions are permuted according to dim-indices.")) (defgeneric hist-insert (histogram datum &optional weight) (:documentation "Inserts a value specified by the datum (An atom for 1-D or a list of values for more dimensions) into the histogram; i.e. increments the bin value by weight (which defaults to 1 or whatever you set). Returns histogram (though it does change the histogram state).")) ;;;; Not sure if index-ref functions are appropriate for all types of ;;;; histograms (defgeneric hist-index-ref (histogram indices) (:documentation "Like aref for an array, but for histograms using the index list.")) (defgeneric (setf hist-index-ref) (value histogram indices) (:documentation "hist-index-ref is setf-able")) (defgeneric hist-point-ref (histogram point) (:documentation "Like hist-index-ref but looks up the cell in which point would lie.") ;; default method for non-histograms: (:method (x point) x)) (defgeneric (setf hist-point-ref) (value histogram point) (:documentation "hist-point-ref is setf-able")) (defgeneric hist-bin-values (histogram) (:documentation "Returns a list of bin values consed to the bin center of the bin")) (defmethod map->alist ((hist histogram)) "Since fitting needs 1-D histograms to give not a list with the cdr being a singleton list but a cons with the cdr being the actual bin center, we have to do some footwork here." (let* ((hist-bin-values (hist-bin-values hist)) (alist-maker (if (single (cdr (first hist-bin-values))) (lambda (x) (let ((car (car x)) (cdr (first (cdr x)))) (cons cdr car))) (lambda (x) (let ((car (car x)) (cdr (cdr x))) (cons cdr car)))))) (mapcar alist-maker (hist-bin-values hist)))) (defgeneric hist-slice (hist &rest dims) (:documentation "Slices up the histogram along each dimension in dims. Returns a hash table mapping the bin center list for each dimension in dims to a histogram of the same kind as hist which has only the leftover dimensions.")) (defun getslice (slices bin) "Function for finding a slice from (hist-slice hist) via minimizing the sum of squares of the vector difference between bin and each slice center." (ensure-lists (bin) (gethash (minimum (hash-keys slices) :key (lambda (s) (sum (expt (- s bin) 2)))) slices))) ;; Functional access to histograms: (defun hist-map (fn hist) "hist-map maps the function fn over the histogram hist bin-by-bin. fn should take as its first argument the bin value and the rest the bin center values for each dimension of the histogram as keyword parameters. The keyword arguments should be the lispified dimension names of the histogram. fn should return the new bin value for that bin; for a bin to not be re-filled in the resulting histogram, return nil. Note that a particularly useful strategy is to use &allow-other-keys so that you do not have to worry about all the dimensions in the histogram." (let* ((result (funcall (type-constructor hist) (hist-dim-specs hist) :empty-bin-value (hist-empty-bin-value hist) :default-increment (hist-default-increment hist))) (dim-names (hist-dim-names hist)) (dim-keywords (mapcar (compose #'keywordify #'lispify) dim-names))) (reduce (lambda (h x) (when x (hist-insert h (car x) (cdr x))) h) (mapcar (lambda (x) (let* ((key-args (mapcan #'list dim-keywords (rest x))) (count (first x)) (result (apply fn count key-args))) (when result (cons (rest x) result)))) (hist-bin-values hist)) :initial-value result))) ;; I'm keeping the first argument as the bin count since I don't want ;; to clobber any dimensions of the histogram which might wish to be ;; called count or anything else I would happen to choose. (defun hist-filter (fn hist) "Re-fills entries in the histogram only when fn returns non-nil. fn should take as its first argument the bin count and the rest of the arguments being the bin centers for each dimension of the histogram as keyword arguments. The keyword arguments should be the lispified dimension names of the histogram." (hist-map (lambda (count &rest xs) (when (apply fn count xs) count)) hist)) ;;;; Ease of use functions: (defun hist-insert-list (histogram data-list) "Inserts each data list in data-lists into the histogram. Accepts data as either atom for 1-D or lists for any dimensionality." (loop for datum in data-list do (hist-insert histogram (mklist datum)))) ;;;; Abbreviations: (defun hins (histogram datum &optional weight) "Abbreviation for hist-insert" (apply #'hist-insert histogram datum (when weight (list weight)))) (defun htint (histogram) "Abbreviation for hist-total-integral" (hist-total-integral histogram)) (defun hint (histogram &rest axes) "Abbreviation for hist-integrate" (apply #'hist-integrate histogram axes)) (defun hproj (histogram &rest axes) "Abbreviation for hist-project" (apply #'hist-project histogram axes)) (defun hslice (histogram &rest axes) "Abbreviation for hist-slice" (apply #'hist-slice histogram axes)) (defun hiref (histogram indices) "Abbreviation for hist-index-ref" (hist-index-ref histogram indices)) (defun (setf hiref) (value histogram indices) (setf (hist-index-ref histogram indices) value)) (defun hpref (histogram point) "Abbreviation for hist-point-ref" (hist-point-ref histogram point)) (defun (setf hpref) (value histogram point) (setf (hist-point-ref histogram point) value)) (defun hbv (histogram) "Abbreviation for hist-bin-values" (hist-bin-values histogram)) (defun hdn (histogram) "Abbreviation for hist-dim-names" (hist-dim-names histogram)) ;;;; Generic math: (still need to handle functions with keyword ;;;; arguments) (defmacro defhistmath-unary (fname) (with-gensyms (a count centers a-bin-values result) `(defmethod ,fname ((,a histogram)) (let ((,a-bin-values (hist-bin-values ,a)) (,result (copy-hist ,a t))) (loop for (,count . ,centers) in ,a-bin-values do (hist-insert ,result ,centers (,fname ,count))) ,result)))) (defun empty-set (&optional (test 'equal)) (make-hash-table :test test)) (defun set-insert (set object) (multiple-value-bind (val p) (gethash object set) (when (not p) (setf (gethash object set) t)) set)) (defun set->list (set) (loop for x being the hash-keys in set collecting x)) (defmacro defhistmath-binary (fname) (with-gensyms (a b res count all-centers centers a-bin-values b-bin-values result) (let ((lrbody `(let ((,all-centers (cl-ana.histogram::set->list (let ((,res (cl-ana.histogram::empty-set))) (reduce #'cl-ana.histogram::set-insert (mapcar #'cdr (hbv ,a)) :initial-value ,res) (reduce #'cl-ana.histogram::set-insert (mapcar #'cdr (hbv ,b)) :initial-value ,res)))) (,result (copy-hist ,a t))) (loop for ,centers in ,all-centers do (hist-insert ,result ,centers (,fname (hist-point-ref ,a ,centers) (hist-point-ref ,b ,centers)))) ,result)) (lbody `(let ((,a-bin-values (hist-bin-values ,a)) (,result (copy-hist ,a t))) (loop for (,count . ,centers) in ,a-bin-values do (hist-insert ,result ,centers (,fname ,count (hist-point-ref ,b ,centers)))) ,result)) (rbody `(let ((,b-bin-values (hist-bin-values ,b)) (,result (copy-hist ,b t))) (loop for (,count . ,centers) in ,b-bin-values do (hist-insert ,result ,centers (,fname (hist-point-ref ,a ,centers) ,count))) ,result))) `(progn (defmethod ,fname ((,a histogram) (,b histogram)) ,lrbody) (defmethod ,fname ((,a histogram) ,b) ,lbody) (defmethod ,fname (,a (,b histogram)) ,rbody))))) (defun defhistmaths () (loop for fname being the hash-keys in *gmath-generic-map* for arglist being the hash-values in *gmath-generic-map* do (case (length arglist) (1 (eval `(defhistmath-unary ,fname))) (2 (eval `(defhistmath-binary ,fname)))))) (defhistmaths) ;; NOTE: This method differs from the usage of other protected-div ;; methods in that histograms have a default bin value. For this ;; reason, the default bin value for the first histogram is used by ;; default instead of 0. (defmethod protected-div ((a histogram) (b histogram) &key (protected-value 0)) (let* ((protected-value (if protected-value protected-value (hist-empty-bin-value a))) (all-centers (cl-ana.histogram::set->list (let ((res (cl-ana.histogram::empty-set))) (reduce #'cl-ana.histogram::set-insert (mapcar #'cdr (hbv a)) :initial-value res) (reduce #'cl-ana.histogram::set-insert (mapcar #'cdr (hbv b)) :initial-value res)))) (result (copy-hist a t))) (loop for centers in all-centers do (hist-insert result centers (protected-div (hist-point-ref a centers) (hist-point-ref b centers) :protected-value protected-value))) result)) (defgeneric copy-hist (hist &optional empty-p) (:documentation "Returns a filled copy of hist for null empty-p, otherwise returns empty copy") (:method (hist &optional empty-p) (hist-map (if empty-p (constantly nil) (lambda (count &key &allow-other-keys) count)) hist))) (defun hist-absorb (h1 h2) "Absorbs the contents of h2 into h1 by filling the contents of h2 into h1" (loop for cons in (map->alist h2) do (hist-insert h1 (car cons) (cdr cons))) h1) ;; ease of use function: (defun bin (data &key dim-names mins maxs nbins empty-bin-value default-increment) "Creates a sparse histogram determining min, max, and number of bins from the data. data can be a list of atoms for 1-D data or a list of lists for any dimensionality. dim-names is an optional list of dimension names mins, maxs, and nbins can be alists mapping from dimension name/index to a value, or if all dimensions have a value specified, just a list of values taken to be given in order of dimension. empty-bin-value and default-increment will be supplied to the histogram if present." (when data (let* ((dimensionality (let ((d (first data))) (if (atom d) 1 (length d)))) (dim-names (if dim-names dim-names (loop for i below dimensionality collect nil)))) (flet ((mkspecs (specs) (if specs (if (consp (first specs)) ;; alists (labels ((rec (spcs names result) ;; spcs should be a hash-table mapping ;; from whatever is in names to a value (if names (let ((spec (gethash (first names) spcs))) (rec spcs (rest names) (cons spec result))) (nreverse result)))) (rec (map->hash-table specs 'equal) (if dim-names dim-names (range 0 (1- dimensionality))) nil)) ;; full spec list specs) (loop for i below dimensionality collect nil)))) ;; each spec has either an explicit value or nil for each ;; dimension (let ((min-specs (mkspecs mins)) (max-specs (mkspecs maxs)) (nbin-specs (mkspecs nbins)) (data-per-dim (transpose (mapcar #'mklist data)))) (when (or (not (length-equal min-specs dimensionality)) (not (length-equal max-specs dimensionality)) (not (length-equal nbin-specs dimensionality))) (error "Inconsistent histogram dimensionality")) ;; final version of mins, maxs and nbins (let* ((hist-specs (loop for min in min-specs for max in max-specs for n in nbin-specs for name in dim-names for d in data-per-dim collect (let ((mi (if min min (minimum d))) (ma (if max max (maximum d))) (n (if n n (ceiling (sqrt (length d)))))) (let (real-min real-max) (if (and min max) ;; min & max both explicit (progn (setf real-min min) (setf real-max max)) ;; need delta (let ((delta (/ (- ma mi) n))) (setf real-min (if min min (- mi (* 0.5 delta)))) (setf real-max (if max max (+ ma (* 0.5 delta)))))) (list :low real-min :high real-max :nbins (floor n) :name name))))) (result (apply #'make-sparse-hist hist-specs (when-keywords empty-bin-value default-increment)))) (loop for d in data do (hins result (mklist d))) result)))))) ;; Utility for normalizing histogram intelligently: (defun normalize-histogram (h &optional (norm :integral)) "Normalizes a histogram using either the integral or setting a point's value to 1. Set norm to be a bin point value to choose a specific point, or to NIL for no normalization. Set norm to a function to normalize via an integral over a filtered subset of a histogram." (flet ((hnorm (h) (/ h (htint h))) (hinorm (h f) (/ h (htint (hist-filter f h)))) (hpnorm (h p) (/ h (hpref h (list p))))) (let ((normfn (cond ;; no normalization ((null norm) #'identity) ;; normalization by integral ((eq norm :integral) #'hnorm) ;; normalization by filtered integral ((functionp norm) (lambda (h) (hinorm h norm))) ;; normalization by W point (t (lambda (h) (hpnorm h norm)))))) (funcall normfn h)))) ;;;; Internal use: (defun condense-indices (indices) (let* ((sorted (sort (copy-list indices) #'<)) (map (let ((result (make-hash-table :test 'equal))) (loop for i from 0 for s in sorted do (setf (gethash s result) i)) result))) (mapcar (lambda (x) (gethash x map)) indices))) (defun get-dim-indices (dim-names axes) "Converts axes from a list of either index or name into a list of indices by looking up the name when necessary." (mapcar (lambda (s) (if (stringp s) (position s dim-names :test #'equal) s)) axes))
21,414
Common Lisp
.lisp
534
28.479401
83
0.553208
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
4d1c66d695a4689a8d3b42da3520b6d0230459801ee33d661ad15287b3aff7a4
1,478
[ -1 ]
1,479
package.lisp
ghollisjr_cl-ana/memoization/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; package.lisp (defpackage #:cl-ana.memoization (:use #:cl #:alexandria) (:export :memolet :memoize :unmemoize :defun-memoized :get-memo-map :reset-memo-map))
1,103
Common Lisp
.lisp
30
33.333333
70
0.672575
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e35288d24643488956a7983bda3f46837c8a142b33d786574ce6d640844a7827
1,479
[ -1 ]
1,480
memoization.lisp
ghollisjr_cl-ana/memoization/memoization.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;; Memoized functions remember the previous calls of the function and ;;; look-up the return value from the last time the function was ;;; called. ;;; ;;; This implementation uses hash tables to store the previous call values. ;;; ;;; I am still unsure whether or not to expose access to the ;;; memoization hash table, at the moment it is not exposed. (in-package :cl-ana.memoization) (eval-when (:compile-toplevel :load-toplevel :execute) (defvar *memoized-map* (make-hash-table :test 'equal) "Hash table mapping each memoized function to its value hash table.")) (defun get-memo-map (memo-fn) "Returns the memoized function's value hash table." (gethash memo-fn *memoized-map*)) (defun reset-memo-map (memo-fn) "Resets the memoization hash table for memo-fn" (when (gethash memo-fn *memoized-map*) (clrhash (gethash memo-fn *memoized-map*)))) (defmacro memoize (fn &key (test 'equal)) "Macro for memoizing any function; test argument allows you to specify how arguments will be looked up." (with-gensyms (memoized lookup-value lookup-stored-p return-value args table xs) `(let* ((,table (make-hash-table :test ',test)) (,memoized (lambda (&rest ,xs) (let ((,args ,xs)) ; for accidental capture (multiple-value-bind (,lookup-value ,lookup-stored-p) (gethash ,args ,table) (if ,lookup-stored-p ,lookup-value (let ((,return-value (apply ,fn ,args))) (setf (gethash ,args ,table) ,return-value) ,return-value))))))) (setf (gethash ,memoized *memoized-map*) ,table) ,memoized))) (defmacro memolet (memo-fns &body body) "A macro for defining mutually recursive memoized functions and executing body with knowledge of them. Cannot access the lookup tables via *memoized-map* in the body, since this would prevent garbage collection of the memoized function hash tables." (with-gensyms (tables lookup-value lookup-stored-p args) (let ((tabs (loop for i in memo-fns collecting '(make-hash-table :test 'equal))) (gsyms (loop for i in memo-fns collecting (gensym)))) `(let ,(loop for tab in tabs for gsym in gsyms collecting `(,gsym ,tab)) (labels (,@(loop for mf in memo-fns for gsym in gsyms collecting (destructuring-bind (self args-list &body body) mf `(,self (&rest ,args) (multiple-value-bind (,lookup-value ,lookup-stored-p) (gethash ,args ,gsym) (if ,lookup-stored-p ,lookup-value (setf (gethash ,args ,gsym) (destructuring-bind ,args-list ,args ,@body)))))))) ;; ,@(loop ;; for gsym in gsyms ;; for mf in memo-fns ;; collecting `(setf (gethash (function ,(first mf)) ;; *memoized-map*) ;; ,gsym)) ,@body))))) (defun unmemoize (fn) "Removes fn from the memoization lookup table; this prevents access to the lookup map from outside the function but allows the function to be garbage collected if necessary." (remhash fn *memoized-map*)) (defmacro defun-memoized (function-name arg-list &body body) "Macro for defining a memoized function. Note that currently there is a small inconvenience in that lambda-lists are not automatically added to the documentation used by things like SLIME." (with-gensyms (raw-function memoized defuned xs) `(let* ((,raw-function (lambda (&rest ,xs) (destructuring-bind (,@arg-list) ,xs ,@body))) (,memoized (memoize ,raw-function)) (,defuned (defun ,function-name (&rest ,xs) (apply ,memoized ,xs)))) (setf (gethash (symbol-function ,defuned) *memoized-map*) (gethash ,memoized *memoized-map*)) ,memoized ,defuned)))
5,584
Common Lisp
.lisp
129
32.24031
75
0.56188
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
2b3ba10bf929dc530d12ef625809bc1769710965e3fdedb9a4d4e3e1ea2324fe
1,480
[ -1 ]
1,481
package.lisp
ghollisjr_cl-ana/quantity/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.quantity (:use :cl ;; :alexandria :cl-ana.list-utils :cl-ana.macro-utils :cl-ana.symbol-utils :cl-ana.error-propogation :cl-ana.math-functions) (:export ;; Unit: :define-unit ;; Quantity: :quantity :quantity-scale :quantity-unit ;; Quantity methods: :define-quantity-methods ;; Temperature :convert-temperature ;; General unit conversion :convert-units ;; Metric prefix functions: :yotta :zetta :exa :peta :tera :giga :mega :kilo :hecto :deca :deci :centi :milli :micro :nano :pico :femto :atto :zepto :yocto ;; Binary prefix functions: :binary-kilo :binary-mega :binary-giga :binary-tera ;; Constants: :+c+ :+G+ :+h+ :+hbar+ :+mu0+ :+eps0+ :+Z0+ :+k-coulomb+ :+e+ :+mu-bohr+ :+a0+ :+r-electron+ :+me+ :+alpha+ :+mp+ :+mn+ :+md+ :+rydberg+ :+NA+ :+k-boltzmann+ :+R+ :+stefan-boltzmann+ :+gravitational-acceleration+ :+vsound+ :+T0+ ;; Misc. :reader-macro-units->quantity)) (cl-ana.gmath:use-gmath :cl-ana.quantity)
2,056
Common Lisp
.lisp
96
17.791667
70
0.636874
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
ec9577339e945aa49348801d2ccaa4d9c4442e8264cf3734587532b3c97e8f57
1,481
[ -1 ]
1,482
metric-non-si.lisp
ghollisjr_cl-ana/quantity/metric-non-si.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;; These are common metric units which do not officially belong to the ;; S.I. unit system. (define-unit :gram (milli :kilogram)) (define-unit :minute (* 60 :second)) (define-unit :hour (* 60 :minute)) (define-unit :day (* 24 :hour)) (define-unit :year (* 365.25 :day)) (define-unit :hectare (expt (hecto :meter) 2)) (define-unit :liter (expt (deci :meter) 3)) (define-unit :tonne (expt (mega :gram))) (define-unit :atomic-mass-unit (* 1.6605388628d-27 :kilogram)) (define-unit :dalton :atomic-mass-unit) (define-unit :angstrom (/ (nano :meter) 10)) (define-unit :barn (* 1d-28 (expt :meter 2))) (define-unit :bar (* 1d5 :pascal)) (define-unit :atmosphere (* 101325 :pascal)) (define-unit :mmHg ;; the full name is way too long (* 133.322387415d0 :pascal)) (define-unit :torr (* 133.322368421d0 :pascal)) (define-unit :kph (/ (kilo :meter) :hour)) (define-unit :rpm (/ (* 2 pi) :minute))
1,892
Common Lisp
.lisp
60
28.766667
70
0.674945
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e28f5773ea12a52967e161e418283f6b85da04a3fefcee60b3210f070cffe9ad
1,482
[ -1 ]
1,483
binary.lisp
ghollisjr_cl-ana/quantity/binary.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) (defun binary-kilo (x) (* x (expt 2 10))) (defun binary-mega (x) (* x (expt 2 20))) (defun binary-giga (x) (* x (expt 2 30))) (defun binary-tera (x) (* x (expt 2 40)))
1,083
Common Lisp
.lisp
29
35.758621
70
0.689228
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
dad5ffd1b96357594fe859bac0abd5653143eadef79b863ef6e56e620cd2738b
1,483
[ -1 ]
1,484
unit.lisp
ghollisjr_cl-ana/quantity/unit.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;;; Units ;;; Units are, in the context of this library, restricted to base ;;; units, i.e. those directly corresponding to the base dimensions. ;;; They are directly represented via keyword symbols; properties of ;;; units are stored in global tables. ;;; Default units are S.I. units (defvar *default-units* (make-hash-table :test 'equal) "Maps from dimension to the default unit for that dimension.") (defun set-default-unit (dimension unit) "Sets the default unit for a dimension." (setf (gethash dimension *default-units* ) unit)) ;;; Units utilities (defun unit-symbol (unit) (if (symbolp unit) unit (unit-symbol (first unit)))) (defun unit-string (unit) (string (unit-symbol unit))) (defun unit-first< (unit1 unit2) (string< (unit-string unit1) (unit-string unit2))) (defun unit-first= (unit1 unit2) (string= (unit-string unit1) (unit-string unit2))) (defun unit-standard-order (unit) (if (not (listp unit)) unit (if (and (length-equal unit 2) (numberp (second unit))) (list unit) (let* ((copy (copy-list unit))) (sort copy #'string< :key #'unit-string))))) (defun ensure-explicit-exponent (u) "Ensures that a unit is expressed as a list." (if (symbolp u) (list u 1) u)) (defun unit-compound-form (u) "Ensures that a unit is expressed as a compound unit list." (if (symbolp u) (list u) (if (and (length-equal u 2) (numberp (second u))) (list u) u))) (defun unit-standard-form (u) "Ensures that a unit is in compound form with each component unit being expressed with explicit exponent." (if (equal u 1) (list (list 1 0)) (mapcar #'ensure-explicit-exponent (unit-compound-form u)))) (defun un-singleton-zero (lst) (remove-if #'null (mapcar (lambda (x) (if (and (listp x) (numberp (second x))) (cond ((= (second x) 1) (first x)) ((zerop (second x)) nil) (t x)) x)) lst))) (defun one-if-null (x) (if (null x) 1 x)) (defun unwrap-single (l) (if (single l) (car l) l)) (defun unit-simplify (u) "Expects u to be in standard form" (unwrap-single (one-if-null (un-singleton-zero u)))) (defun unit-mult (unit1 unit2) (labels ((ucoef (u) (if (symbolp u) 1 (second u))) (umult (u1 u2) (+ (ucoef u1) (ucoef u2)))) (cond ((equal unit1 1) unit2) ((equal unit2 1) unit1) (t (when (not (unit-first< unit1 unit2)) (rotatef unit1 unit2)) (let ((ulst1 (unit-standard-form unit1)) (ulst2 (unit-standard-form unit2)) (result ())) (unit-simplify (do () ((or (null ulst1) (null ulst2)) (append result ulst1 ulst2)) (let ((u1 (first ulst1)) (u2 (first ulst2))) (cond ((string< (unit-string u1) (unit-string u2)) (push u1 result) (setf ulst1 (rest ulst1))) ((string= (unit-string u1) (unit-string u2)) (push (list (unit-symbol u1) (umult u1 u2)) result) (setf ulst1 (rest ulst1)) (setf ulst2 (rest ulst2))) (t (push u2 result) (setf ulst2 (rest ulst2)))))))))))) (defun unit-div (unit1 unit2) (labels ((negate-unit-coefs (u) (cond ((equal u 1) 1) ((symbolp u) (list u -1)) ((and (length-equal u 2) (numberp (second u))) (list (first u) (- (second u)))) (t (mapcar #'negate-unit-coefs u))))) (unit-mult unit1 (unit-simplify (negate-unit-coefs (unit-standard-form unit2)))))) (defun unit-expt (unit power) (unit-simplify (let ((unit (unit-standard-form unit))) (mapcar (lambda (u) (list (first u) (* (second u) power))) unit))))
5,576
Common Lisp
.lisp
168
23.452381
70
0.521441
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
48fd98ce863979a87a002c3068b0db4f0660b412f7073c3d6b45ec0f593af4d2
1,484
[ -1 ]
1,485
convert-units.lisp
ghollisjr_cl-ana/quantity/convert-units.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) (defun convert-units (quantity new-units) "Gets the scale of quantity if expressed in new-units. new-units can be either a product unit (usual unit, e.g. meter/second) or a list of product units which is interpreted as a sum of units. Using a list of units results in a list of unit-scales, one element per unit in the sum. The quantity value is the result of multiplying the unit-scales with the corresponding product units and them summing. Useful for expressing U.S. quantities like heights in feet and inches." (if (listp new-units) (let ((units (butlast new-units)) (last-unit (first (last new-units))) (result ()) (q quantity) factor) (dolist (unit units) (setf factor (floor (/ q unit))) (setf q (- q (* unit factor))) (push factor result)) (push (/ q last-unit) result) (nreverse result)) (/ quantity new-units)))
1,847
Common Lisp
.lisp
43
39.023256
70
0.684444
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
4835490facaec33b0042f1b866f598e2f1bd8eff107aab748fd53cf10d782e3a
1,485
[ -1 ]
1,486
si.lisp
ghollisjr_cl-ana/quantity/si.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;; base units (defvar +si-base-units+ (list (cons :meter :length) (cons :kilogram :mass) (cons :second :time) (cons :ampere :electric-current) (cons :kelvin :temperature) (cons :mole :amount-of-substance) (cons :candela :luminuous-intensity))) (loop for (u . d) in +si-base-units+ do (set-default-unit d u)) ;;; derived units (define-unit :hertz (/ :second)) (define-unit :newton (* :kilogram :meter (expt :second -2))) (define-unit :pascal (/ :newton (expt :meter 2))) (define-unit :joule (* :newton :meter)) (define-unit :watt (/ :joule :second)) (define-unit :coulomb (* :ampere :second)) (define-unit :volt (/ :watt :ampere)) (define-unit :farad (/ :coulomb :volt)) (define-unit :ohm (/ :volt :ampere)) (define-unit :siemens (/ :ampere :volt)) (define-unit :weber (* :volt :second)) (define-unit :tesla (/ :weber (expt :meter 2))) (define-unit :henry (/ :weber :ampere)) (define-unit :lumen (quantity :candela)) ;; technically there's a steradian in there, ;; but that's just 1. (define-unit :lux (/ :lumen (expt :meter 2))) (define-unit :becquerel (/ :second)) (define-unit :gray (/ :joule :kilogram)) (define-unit :sievert (/ :joule :kilogram)) (define-unit :katal (/ :mole :second))
2,312
Common Lisp
.lisp
82
24.47561
70
0.643699
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
7c17843509610320b7da09d8e9e1287343ef8529b9f6b4fc827b4e8e530e254f
1,486
[ -1 ]
1,487
constants.lisp
ghollisjr_cl-ana/quantity/constants.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) (defvar +c+ (* 299792458 :meter (expt :second -1)) "Speed of light in vacuum") (defvar +G+ #q(6.6738480d-11 (:meter 3) (:kilogram -1) (:second -2)) "Newton's gravitational constant") (defvar +h+ (* 6.6260695729d-34 :joule :second) "Planck's constant") (defvar +hbar+ (* 1.05457172647d-34 :joule :second) "Reduced Planck's constant") (defvar +mu0+ (* 4 pi 1d-7 :newton (/ (expt :ampere 2))) "Permeability of free space") (defvar +eps0+ (/ (* +mu0+ (expt +c+ 2))) "Permittivity of free space") (defvar +Z0+ (* +mu0+ +c+) "Impedance of vacuum") (defvar +k-coulomb+ (/ (* 4 pi +eps0+)) "Coulomb's constant") (defvar +e+ (* 1.60217656535d-19 :coulomb) "Elementary charge") (defvar +mu-bohr+ (* 9.2740096820d-24 :joule (/ :tesla)) "Bohr magneton") (defvar +a0+ #q(5.291772109217d-11 :meter) "Bohr radius") (defvar +r-electron+ (* 2.817940326727d-15 :meter) "Classical electron radius") (defvar +me+ (* 9.1093829140e-31 :kilogram) "Electron mass") (defvar +alpha+ (/ (expt +e+ 2) (* 4 pi +eps0+ +hbar+ +c+)) "Fine Structure Constant") (defvar +mp+ (* 1.67262177774d-27 :kilogram) "Proton mass") (defvar +mn+ (* 1.67492735174d-27 :kilogram) "Neutron Mass") (defvar +md+ (* 3.34358348d-27 :kilogram) "Deuteron Mass") (defvar +rydberg+ (* (expt +alpha+ 2) +me+ +c+ (/ (* 2 +h+))) "Rydberg Constant") (defvar +NA+ 6.0221412927e23 "Avogadro's Number") (defvar +k-boltzmann+ (* 1.380648813d-23 :joule (/ :kelvin)) "Boltzmann constant") (defvar +R+ (* 8.314462175d0 :joule (/ (* :kelvin :mole))) "Ideal Gas Constant") (defvar +stefan-boltzmann+ (* (expt pi 2) (/ (expt +k-boltzmann+ 4) (* 60 (expt +hbar+ 3) (expt +c+ 2)))) "Stefan-Boltzmann Constant") (defvar +gravitational-acceleration+ (* 9.80665d0 :meter (expt :second -2)) "Standard Gravitational Acceleration") (defvar +vsound+ (* 340.29d0 (/ :meter :second))) (defvar +T0+ #q(273.15d0 :kelvin) "Freezing point of water")
3,029
Common Lisp
.lisp
111
23.891892
70
0.640733
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
d7511753ef248c179d41f5867b36341b2b8d9fe98ab9a38c66103a81d3745c3e
1,487
[ -1 ]
1,488
temperature.lisp
ghollisjr_cl-ana/quantity/temperature.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;;; Temperature units are: :fahrenheit, :celsius, :kelvin, and :rankine (defun invert-linear (linear-coefs) "Yields the coefficients of the inverse of a linear function; i.e. A + B*x -> -A/B + (1/B)*x" (destructuring-bind (A B) linear-coefs (list (- (/ A B)) (/ B)))) (defun compose-linear (linear-coefs1 linear-coefs2) "Yields the coefficients of the composition linear1(linear2(x))" (destructuring-bind (A1 B1) linear-coefs1 (destructuring-bind (A2 B2) linear-coefs2 (list (+ A1 (* B1 A2)) (* B1 B2))))) (defvar *linear-fn-coefs* (make-hash-table :test 'equal)) (defun linear-coefs (xname yname) "line-name is a keywordified symbol" (if (eq xname yname) (list 0d0 1d0) (gethash (cons (keywordify xname) (keywordify yname)) *linear-fn-coefs*))) (defun linear-composition-chain (&rest var-chain) "Takes a chain of variables and returns the linear function as a result of sequentially evaluating the linear function required to move from one variable to the next in the var-chain." (reduce (let ((last-var (first var-chain))) (lambda (coefs var) (let ((new-coefs (linear-coefs last-var var))) (setf last-var var) (compose-linear new-coefs coefs)))) (rest var-chain) :initial-value (list 0 1))) (defun linear-funcall (coefs x) "Evaluates a linear function with coefficients coefs at the point x" (destructuring-bind (A B) coefs (+ A (* B x)))) (defun linear-trans (independent-var dependent-var x) "Evaluates the linear transformation (function) which takes the independent-var to the dependent-var at the point x" (linear-funcall (linear-coefs independent-var dependent-var) x)) (defmacro deflinear (xname yname coefs) "Defines two functions xname->yname and yname->xname which are the linear function and its inverse based on coefs." (flet ((trans (a b) (intern (concatenate 'string (string a) "->" (string b))))) (let ((fname (trans xname yname)) (finvname (trans yname xname)) (xsym (keywordify xname)) (ysym (keywordify yname))) (alexandria:with-gensyms (invcs cs) `(let* ((,cs ,coefs) (,invcs (invert-linear ,cs))) (setf (gethash (cons ,xsym ,ysym) *linear-fn-coefs*) ,cs) (setf (gethash (cons ,ysym ,xsym) *linear-fn-coefs*) ,invcs)))))) (deflinear celsius fahrenheit (list 32 9/5)) (deflinear celsius kelvin (list (/ +T0+ :kelvin) 1)) (deflinear fahrenheit kelvin (linear-composition-chain 'fahrenheit 'celsius 'kelvin)) (deflinear fahrenheit rankine (list 459.67d0 1)) (deflinear celsius rankine (linear-composition-chain 'celsius 'fahrenheit 'rankine)) (deflinear kelvin rankine (linear-composition-chain 'kelvin 'celsius 'rankine)) (defmacro define-temperature-mult (temp-keyword) `(progn (defmethod-commutative mult ((x (eql ,temp-keyword)) (y number)) (with-slots (quantity-scale) x (mult (linear-trans ,temp-keyword :kelvin y) :kelvin))) (defmethod-commutative mult ((y number) (x (eql ,temp-keyword))) (with-slots (quantity-scale) x (mult (linear-trans ,temp-keyword :kelvin y) :kelvin))))) (define-temperature-mult :fahrenheit) (define-temperature-mult :celsius) (define-temperature-mult :rankine) (defmacro define-temperature-quantity (temp-keyword) `(defmethod quantity ((x (eql ,temp-keyword))) (mult 1 ,temp-keyword))) (define-temperature-quantity :fahrenheit) (define-temperature-quantity :celsius) (define-temperature-quantity :rankine) ;;;; General temperature conversion function: (defun convert-temperature (temp to-units) "Converts the temperature quantity temp into the temperature units to-units. Note that the result is unitless." (let* ((raw-from-units (unit-standard-form (quantity-unit temp))) (from-units (first (first raw-from-units)))) (linear-trans (keywordify from-units) (keywordify to-units) (quantity-scale temp))))
5,155
Common Lisp
.lisp
130
34.023077
78
0.664801
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
2c05725612e5b73edc7f73d6c0cd63488043261d0be09e7cfc6d231d9b4c9506
1,488
[ -1 ]
1,489
macros.lisp
ghollisjr_cl-ana/quantity/macros.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013-2016 Gary Hollis, 2016 Elijah Malaby ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;;; This is in its own file since it needs to be available at compile ;;;; time; easiest fix since it was already fairly sizable code (defun lcons (x lst) "conses x onto each element of lst, hence the name" (mapcar (lambda (y) (cons x y)) lst)) (defun some-not-all (val n-slots slot-vals) "Returns the list of combinations of slot values taken from slot-vals which is of length n-slots and where each combination has some but not all slot values equal to val." (if (<= n-slots 1) () (loop for sv in slot-vals append (if (equal sv val) (lcons sv (not-all val (1- n-slots) slot-vals)) (lcons sv (just-some val (1- n-slots) slot-vals)))))) (defun not-all (val n-slots slot-vals) "Helper function for some-not-all, same but doesn't require there to be any slots of type val at all." (if (= n-slots 1) (mapcar #'list (remove-if (lambda (x) (equal x val)) slot-vals)) (loop for sv in slot-vals append (if (equal val sv) (lcons sv (not-all val (1- n-slots) slot-vals)) (lcons sv (all-possible (1- n-slots) slot-vals)))))) (defun all-possible (n-slots slot-vals) "Returns list of lists of length n-slots which represent all possible ways to select with ordering and repeating values from slot-vals." (cond ((<= n-slots 0) ()) ((= n-slots 1) (mapcar #'list slot-vals)) (t (loop for sv in slot-vals append (lcons sv (all-possible (1- n-slots) slot-vals)))))) (defun just-some (val n-slots slot-vals) "Like some-not-all but drops the not-all requirement." (cond ((<= n-slots 0) ()) ((= n-slots 1) (if (member val slot-vals) (list (list val)) ())) (t (loop for sv in slot-vals append (if (equal sv val) (lcons sv (all-possible (1- n-slots) slot-vals)) (lcons sv (just-some val (1- n-slots) slot-vals))))))) ;; Elijah Malaby's with-quantities: (defmacro with-quantities ((&rest args) &body body) "Ensures all arguments are quantities and evaluates body in this context and with a quantity-if-necessary call. Supports dual syntax for arguments: * Symbols: Simply binds the symbol to the quantity value. * Lists of form (s u q): Binds quantity to q, scale to s, and unit to u." (labels ((recursor (args) (if args (if (symbolp (car args)) `(let ((,(car args) (quantity ,(car args)))) ,(recursor (cdr args))) `(with-accessors ((,(caar args) quantity-scale) (,(cadar args) quantity-unit)) (quantity ,(caddar args)) ,(recursor (cdr args)))) `(progn ,@body)))) `(quantity-if-necessary (block nil ;; Block here so that #'return still passes through ;; quantity-if-necessary, although #'return-from does ;; not (similar to loop) ,(recursor args))))) ;; (defvar *quantity-types* nil) ;; (list 'number ;; 'symbol ;; 'err-num ;; 'quantity)) ;; (defmacro defquantity (type var &body body) ;; "Defines a method on quantity for transforming a value from a given ;; type into a quantity." ;; `(when (not (member ',type *quantity-types* :test #'equal)) ;; (push ',type *quantity-types*) ;; (defmethod quantity ((,var ,type)) ;; ,@body))) ;; (defmacro define-quantity-methods ;; (fname (&rest args) &body qbody) ;; "Defines all suitable methods on quantities using only the ;; quantity-only function body. Note that one should omit the ;; quantity-if-necessary call, as this is always a good idea and is ;; built into the generated methods. ;; The methods are implemented via the minimal set of necessary methods ;; to allow quantities to interact with numbers, symbols, quantities, ;; and err-nums. ;; The rules: ;; 1. Methods on quantities should only be invoked by the presence of a ;; symbol or quantity as an argument. ;; 2. Methods invoked via the presence of a quantity should have ;; explicit typing of all arguments. ;; 3. Methods invoked via the presence of a symbol should leave all ;; other argument types unspecified and simply call quantity on all ;; arguments to pass to the quantity-only method." ;; (flet ((lzip (xs ys) ;; (loop ;; for x in xs ;; for y in ys ;; collect (list x y)))) ;; (let* ((q-only ;; `(defmethod ,fname ;; ,(loop ;; for a in args ;; collecting `(,a quantity)) ;; (quantity-if-necessary ;; (let ,(loop ;; for a in args ;; collecting `(,a (quantity ,a))) ;; ,@qbody)))) ;; (body-args ;; (loop ;; for a in args ;; collect `(quantity ,a))) ;; (q-types ;; (some-not-all 'quantity ;; (length args) ;; *quantity-types*)) ;; (q-args ;; (mapcar (lambda (x) (lzip args x)) ;; q-types)) ;; (q-methods ;; (loop ;; for a in q-args ;; collect `(defmethod ,fname ,a ;; (,fname ,@body-args)))) ;; (symbol-args ;; (let ((traversed-elements ()) ;; (result ())) ;; (loop ;; for lst on args ;; do ;; (progn ;; (push (append (reverse traversed-elements) ;; (list (list (first lst) ;; 'symbol)) ;; (rest lst)) ;; result) ;; (push (first lst) ;; traversed-elements)) ;; finally (return (nreverse result))))) ;; (symbol-methods ;; (loop ;; for a in symbol-args ;; collect `(defmethod ,fname ,a ;; (,fname ,@body-args))))) ;; `(progn ;; ,q-only ;; ,@q-methods ;; ,@symbol-methods))))
7,546
Common Lisp
.lisp
192
34.395833
73
0.536742
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
4528ee2f09fc88da5970c765869ce268760ad7a6cef2cbcc6eaff1e3bc37ee03
1,489
[ -1 ]
1,490
us.lisp
ghollisjr_cl-ana/quantity/us.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;;; Customary units: (define-unit :inch (* 2.54d0 (centi :meter))) (define-unit :foot (* 12 :inch)) (define-unit :yard (* 3 :foot)) (define-unit :mile (* 5280 :foot)) (define-unit :nautical-mile (* 1.151d0 :mile)) ;; (define-unit :acre ;; #q(4046.873d0 (:meter 2))) (define-unit :acre (* 4046.873d0 (expt :meter 2))) ;;;; Fluid volumes: (define-unit :teaspoon (* 4.928921 (milli :liter))) (define-unit :tablespoon (* 3 :teaspoon)) (define-unit :fluid-ounce (* 2 :tablespoon)) (define-unit :cup (* 8 :fluid-ounce)) (define-unit :pint (* 2 :cup)) (define-unit :quart (* 2 :pint)) (define-unit :gallon (* 4 :quart)) ;;;; Mass (define-unit :pound (* 453.59237d0 :gram)) (define-unit :grain (/ :pound 7000)) (define-unit :dram (* (+ 27 11/32) :grain)) (define-unit :ounce (* 16 :dram)) (define-unit :ton (* 2000 :pound)) (define-unit :long-ton (* 2240 :pound)) ;; Speed (define-unit :mph (/ :mile :hour)) ;; Miscellaneous ;; U.S. commonly used size for a "cup" of coffee (define-unit :coffee-cup (* 6 :fluid-ounce))
2,037
Common Lisp
.lisp
72
25.583333
70
0.655653
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
c819578969bce4115fcbb94c5bc408bcc889f8584ad8756ca2fc45db836f2000
1,490
[ -1 ]
1,491
post-constants.lisp
ghollisjr_cl-ana/quantity/post-constants.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.quantity) ;;;; Energy: (define-unit :electron-volt (* +e+ :volt)) (define-unit :dyne (* 10 (micro :newton))) (define-unit :calorie (* 4.184d0 :joule)) ;; Food calorie (define-unit :cal (kilo :calorie)) ;;;; U.S. force & power (define-unit :pound-force (* +graviational-acceleration+ :pound)) (define-unit :horsepower (* 33000 :foot :pound-force (/ :minute))) ;;;; Astronomical Distance: (define-unit :light-year (* +c+ :year)) (define-unit :astronomical-unit (* 149597870.700d0 (kilo :meter))) (define-unit :parsec (/ :astronomical-unit (tan (/ pi (* 180 3600)))))
1,532
Common Lisp
.lisp
46
30.586957
70
0.673677
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e503861f483dac455edc702a437f5ef8fcf1eb890199f1bb9a4ab4f5149ffcd6
1,491
[ -1 ]
1,492
package.lisp
ghollisjr_cl-ana/statistical-learning/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2019 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.statistical-learning (:use :cl :cl-ana.macro-utils :cl-ana.map :cl-ana.list-utils :cl-ana.functional-utils :cl-ana.histogram :cl-ana.math-functions :cl-ana.statistics :cl-ana.linear-algebra) (:export ;; Clustering :k-means-cluster :g-means-cluster ;; Least squares :linear-least-squares :ridge-regression :data->polynomial-x :fit-polynomial-least-squares ;; Kernel methods :gaussian-kernel :make-gaussian-kernel :kernel-method :kernel-polynomial-method)) (cl-ana.gmath:use-gmath :cl-ana.statistical-learning)
1,505
Common Lisp
.lisp
45
29.933333
70
0.69273
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
93eb6bbafcc47218ad54bf55278835811022ea88a6da7475635bf23c823a84fb
1,492
[ -1 ]
1,493
statistical-learning.lisp
ghollisjr_cl-ana/statistical-learning/statistical-learning.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2019 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.statistical-learning) ;;;; Clustering ;; K-means clustering (defun k-means-cluster (data init) "Clusters the data using the k-means algorithm. init can be a number specifying the number of clusters to partition the data into, or a list of explicit initial guesses for the centroids. Data should be a list of numbers or lists. Returns: * The clusters of data. * The centroids. * The number of iterations required." (let* ((niter 0) (data (mapcar #'->double-float data)) (centroids (if (listp init) (copy-list init) (subseq data 0 (min (length data) init)))) (k (length centroids)) (changed-p t)) ;; data length check (when (<= (length data) (length centroids)) (return-from k-means-cluster (values (map 'list #'list centroids) centroids 0))) (let* ((categories (make-vector (length data) :initial-element -1)) (clusters (make-vector k :initial-element nil)) (normfn (if (listp (first data)) (lambda (x c) (sum (expt (- x (car c)) 2))) (lambda (x c) (expt (- x (car c)) 2))))) ;; iterative algorithm (loop while changed-p do (incf niter) (setf changed-p nil) (loop for x in data for i from 0 do (let* ((nearest (minimum (zip centroids (range 0 (1- k))) :key (lambda (c) (funcall normfn x c)))) (newcategory (cdr nearest))) (when (not (= newcategory (elt categories i))) (setf changed-p t) (setf (elt categories i) newcategory) (setf (elt centroids newcategory) (mean (loop for x in data for c across categories when (= c newcategory) collecting x))))))) ;; collect categorized data: (loop for x in data for c across categories do (push x (elt clusters c))) (values (map 'list #'reverse clusters) centroids niter)))) ;; G-means clustering (defun g-means-cluster (data &key (critical 2.492)) "Applies the G-means clustering algorithm based on the Anderson-Darling normality test. The algorithm is a variant of k-means where the number k is determined through finding the minimum number of clusters required to have Gaussian distributed data when projected along a single dimension. Critical selects the critical value for the normality test. Data should be a list of numbers or lists. Returns: * Clusters * Centroids * k" (labels (;; project data onto new axis (project (x vec) (if (atom x) x (/ (euclidean-dot x vec) (euclidean-norm vec)))) ;; test for gaussian normality of a centroid (g-test (cluster) ;; Get new centroids (multiple-value-bind (clusters centroids niter) (k-means-cluster cluster 2) (declare (ignore clusters niter)) (let* (;; Find axis (vec (apply #'- centroids)) ;; Project data onto that axis (projected (mapcar (lambda (x) (project x vec)) cluster))) ;; apply normality test (anderson-darling-normality-test projected :critical critical))))) (let* ((n (length data))) (loop for k from 1 to n do (multiple-value-bind (clusters centroid niter) (k-means-cluster data k) (declare (ignore niter)) (let* ((g-tests (loop for cluster in clusters collecting (g-test cluster)))) (when (every #'identity g-tests) (return (values clusters centroid k))))))))) ;;;; Least squares (defun linear-least-squares (data) "Fits a linear function against the data alist. car can be a list, but cdr should be an atom. Fitting a vector Y value is mathematically equivalent to simultaneous indepedent linear fits so no functionality is lost." (when data (let* ((coefs (coerce (loop for cons in data collecting (coerce (cons 1d0 (mklist (car cons))) 'vector)) 'vector)) (coefstransposed (matrix-transpose coefs)) (yvector (cdrs data))) (lu-solve (matrix-mult coefstransposed coefs 'list) (first (transpose (matrix-mult coefstransposed (map 'vector (lambda (x) (apply #'vector x)) (transpose (list yvector))) 'list))))))) (defun ridge-regression (data lambda) "Applies ridge regression fitting as a function of lambda." (let* ((coefs (map 'vector (lambda (x) (coerce (cons 1d0 (mklist x)) 'vector)) (cars data))) (coefstransposed (matrix-transpose coefs)) (ys (mapcar #'cdr data)) (newcoefs (matrix-mult coefstransposed coefs 'list)) (newys (first (transpose (matrix-mult coefstransposed (map 'vector (lambda (y) (apply #'vector y)) (transpose (list ys))) 'list))))) (loop for i below (1- (length newcoefs)) do (incf (tensor-ref newcoefs i i) lambda)) (lu-solve newcoefs newys))) (defun data->polynomial-x (data order) "Returns an alist of data suitable for least squares fitting against a polynomial function using the existing linear-least-squares fit function. order should be at least 0. Note that this is not as efficient as a purpose-built polynomial least squares fit due to algebraic simplifications to the matrix multiplication that are possible." (mapcar (lambda (cons) (destructuring-bind (x . y) cons (let* ((term 1d0)) (cons (loop for i from 1 upto order do (setf term (* term x)) collecting term) y)))) data)) (defun fit-polynomial-least-squares (data degree) "Fits a polynomial of specified degree against the data, returning the list of parameters from least order to highest order." (let* ((coefs (loop for k from 0 to degree collecting (loop for j from 0 to degree for pow = (+ k j) collecting (loop for (x . y) in data summing (expt x pow))))) (constants (loop for k from 0 to degree collecting (loop for (x . y) in data summing (* y (expt x k)))))) (lu-solve coefs constants))) ;;;; Kernel methods (defun gaussian-kernel (x1 x2 lambda) "Gaussian kernel for multi-dimensional x1 and x2" (* (/ lambda) (exp (- (/ (if (sequencep x1) (sum (expt (- x1 x2) 2d0)) (expt (- x1 x2) 2d0)) lambda))))) (defun make-gaussian-kernel (lambda) (lambda (x1 x2) (gaussian-kernel x1 x2 lambda))) (defun kernel-method (data fn kernel init-params) "Returns a function which will compute the kernel method estimate for a given point, using the init-params to fit on a point-by-point basis." (lambda (x) (let* ((weights (mapcar (lambda (y) (funcall kernel x y)) (cars data))) ;; X is now (x, y, sqrt(w)) and y is always 0 (ndata (mapcar (lambda (cons w) (cons (list (car cons) (cdr cons) (sqrt w)) 0d0)) data weights)) (nfn (lambda (params k) (destructuring-bind (x y w) k (* w (- (funcall fn params x) y))))) (fit-results (suppress-output (multiple-value-list (fit ndata nfn init-params)))) (fit-params (second fit-results))) (funcall fn fit-params x)))) (defun kernel-polynomial-method (data kernel degree) "Returns a function which will compute the kernel method estimate for a given point, using a polynomial of the specified degree." (lambda (x) (let* ((weights (mapcar (lambda (y) (funcall kernel x y)) (cars data))) (coefs (loop for k from 0 to degree collecting (loop for j from 0 to degree for pow = (+ k j) collecting (loop for (x . y) in data for w in weights summing (* w (expt x pow)))))) (constants (loop for k from 0 to degree collecting (loop for (x . y) in data for w in weights summing (* y w (expt x k))))) (fit-params (lu-solve coefs constants))) (polynomial fit-params x))))
11,312
Common Lisp
.lisp
285
25.926316
75
0.499455
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
aea12c7c60e7cd0a42de81b27769130f26c819f50dd05dd11f30744680d6cb4f
1,493
[ -1 ]
1,494
package.lisp
ghollisjr_cl-ana/lorentz/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.lorentz (:use :cl :cl-ana.linear-algebra :cl-ana.tensor :iterate) (:export :lorentz-vector :make-lorentz-vector :make-double-float-vector :make-lorentz-boost :lorentz-vector-spatial :minkowski-dot :minkowski-norm :minkowski-norm2 ; minkowski-norm^2 :lorentz-phi :lorentz-theta :gamma :gamma-from-beta2 :four-momentum-beta-vector)) (cl-ana.gmath:use-gmath :cl-ana.lorentz)
1,372
Common Lisp
.lisp
39
31.333333
70
0.681443
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9c9199fa0c0aba72adf7fe2a35ff2f6e930a8554adc35994f74a648c9789e186
1,494
[ -1 ]
1,495
lorentz.lisp
ghollisjr_cl-ana/lorentz/lorentz.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.lorentz) ;;; This library of lorentz transformation-related utilities assumes ;;; dogmatically that ;;; ;;; 1. Time component is the zeroth element. ;;; 2. We are using the (+,-,-,...) Minkowski space metric. ;;; ;;; This implementation does lack a general lorentz transformation as ;;; it only provides the boost facilities. But: you can do any ;;; general lorentz transformation by using a boost followed by a ;;; rotation. ;;; ;;; The library also provides the useful reader macro for lorentz ;;; vectors: #L(...), which accepts exactly 4 values inside of the ;;; parentheses which will become the time, x, y, and z components ;;; respectively. (defun minkowski-dot (left-vector right-vector) "Computes the inner product using the Minkowski metric; only requires the tensor-ref function to be defined and that the vectors each have exactly 4 elements each." (flet ((variance-flip-factor (i) (if (zerop i) 1 -1))) (let ((left-length (first (tensor-dimensions left-vector))) (right-length (first (tensor-dimensions right-vector)))) (loop for i from 0 below left-length for j from 0 below right-length summing (* (variance-flip-factor i) (tensor-ref left-vector i) (tensor-ref right-vector j)))))) (defun minkowski-norm (vector) (sqrt (minkowski-norm2 vector))) (defun minkowski-norm2 (vector) (minkowski-dot vector vector)) (defun make-lorentz-boost (beta-vector) "Construct lorentz boost matrix from beta vector" (let* ((lorentz-boost (make-matrix 4 4)) (beta2 (euclidean-norm2 beta-vector)) (gamma (gamma-from-beta2 beta2))) (if (zerop beta2) (list (list 1 0 0 0) (list 0 1 0 0) (list 0 0 1 0) (list 0 0 0 1)) ;; matrix is symmetric, so we can fill one side and then set the ;; other to be the same main diagonal: top-left corner: (progn (setf (tensor-ref lorentz-boost 0 0) gamma) ;; spatial diagonal: (loop for i from 1 to 3 do (setf (tensor-ref lorentz-boost i i) (+ 1 (* (- gamma 1) (/ (expt (tensor-ref beta-vector (1- i)) 2) beta2))))) ;; spatial off-diagonal: (loop for i from 1 to 2 do (loop for j from (1+ i) to 3 do (progn (setf (tensor-ref lorentz-boost i j) (* (- gamma 1) (tensor-ref beta-vector (1- i)) (tensor-ref beta-vector (1- j)) (/ beta2))) (setf (tensor-ref lorentz-boost j i) (tensor-ref lorentz-boost i j))))) ;; rest of first row & first column (loop for i from 1 to 3 do (progn (setf (tensor-ref lorentz-boost 0 i) (- (* gamma (tensor-ref beta-vector (1- i))))) (setf (tensor-ref lorentz-boost i 0) (tensor-ref lorentz-boost 0 i)))) lorentz-boost)))) ;;; miscellaneous physics functions: (defun gamma (beta) "Returns gamma factor from beta" (gamma-from-beta2 (expt beta 2))) (defun gamma-from-beta2 (beta2) "Computes gamma from beta^2, for efficiency purposes" ;; protection against infinities: (when (not (= beta2 1)) (/ (sqrt (- 1 beta2))))) (defun lorentz-vector-spatial (vector) "Returns spatial part of the lorentz-vector" (let* ((length (first (tensor-dimensions vector))) (spatial-part (make-vector (1- length)))) (loop for i from 1 below length do (setf (tensor-ref spatial-part (1- i)) (tensor-ref vector i))) spatial-part)) (defun four-momentum-beta-vector (four-momentum) "Returns the beta vector from the four-momentum. Assumes that your units are chosen such that c is effectively 1 (e.g. GeV/c^2 for mass, GeV/c for momentum, etc.)" (let ((momentum-vector (lorentz-vector-spatial four-momentum)) (energy (tensor-ref four-momentum 0))) (div momentum-vector energy))) ;; Angles for lorentz spatial components: (defun lorentz-phi (lorentz-vector) (phi (lorentz-vector-spatial lorentz-vector))) (defun lorentz-theta (lorentz-vector) (theta (lorentz-vector-spatial lorentz-vector)))
5,381
Common Lisp
.lisp
133
32.909774
72
0.614826
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
c0d3821574ef387078aeed002d1baebfa42c1369d8e279d5302a9b298f810a22
1,495
[ -1 ]
1,496
package.lisp
ghollisjr_cl-ana/map/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; package.lisp (defpackage #:cl-ana.map (:use #:cl #:cl-ana.hash-table-utils) (:export :map->alist :map->hash-table))
1,018
Common Lisp
.lisp
26
37.038462
70
0.690212
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
453dc8dcd7a5cad4730e205718336707481f1d70a39b3b97bb5bad044d7abb13
1,496
[ -1 ]
1,497
map.lisp
ghollisjr_cl-ana/map/map.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; map.lisp (in-package :cl-ana.map) ;;;; A map is any object which represents or can be represented by the ;;;; mapping from one value to another; a two good examples are alists ;;;; and hash tables. ;;;; ;;;; These utilities are for the generic handling of maps so they can ;;;; be appropriately treated by things like fitting data or making ;;;; scatter plots. (defgeneric map->alist (object) (:documentation "Returns the values of a data-source as an alist mapping the independent value to the dependent one. Multidimensional independent variable data can be represented as a list of values.") (:method ((obj list)) obj) (:method ((obj hash-table)) (hash-table->alist obj))) (defun map->hash-table (object &optional test) (alist->hash-table (map->alist object) test))
1,678
Common Lisp
.lisp
42
38.095238
70
0.718137
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
cd7fd2e655408d3840b597620a6eb3d090e575c84d900668b8dba1cbfed98567
1,497
[ -1 ]
1,498
package.lisp
ghollisjr_cl-ana/makeres-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2016 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.makeres-utils (:use :cl :cl-ana.fitting :cl-ana.makeres :cl-ana.macro-utils :cl-ana.list-utils :cl-ana.symbol-utils :cl-ana.map :cl-ana.plotting :cl-ana.string-utils :cl-ana.functional-utils :cl-ana.file-utils :cl-ana.histogram :cl-ana.pathname-utils :cl-ana.table :cl-ana.reusable-table) (:export ;; Basic utilities: :deffitres :fit-results :fit-params :fit-plot )) (cl-ana.gmath:use-gmath :cl-ana.makeres-utils)
1,433
Common Lisp
.lisp
44
28.477273
70
0.665465
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9208d39b1df27a8de06ae8bc4bc838e3ebe04ce39f7020bba900aad5bb8f1365
1,498
[ -1 ]
1,499
makeres-utils.lisp
ghollisjr_cl-ana/makeres-utils/makeres-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2016 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.makeres-utils) (defmacro deffitres (fit-id-prefix data-form fn-form &key fit-options draw-p (x-range '(cons "*" "*")) (y-range '(cons "*" "*")) flags force-p nparams (param-init-value 1d0) param-init-list) "Defines fit result, fit parameter and fit function targets for fitting a function against data. force-p non-NIL means defres is used, whereas NIL means defres-uniq is used for defining the targets. flags should be a list of identifiers appended to the created targets' IDs. param-inits can be a constant or a list of initial parameter guesses. draw-p NIL means don't draw the fit results, non-NIL means draw in an interactive window. Note that drawing only works for single parameter data at the moment. x-range and y-range apply to the optional plot. param-init-value can be used to set a constant default parameter value, whereas param-init-list can be used to specify a list of default parameter values. If fn-form is a simple lambda form, then the number of parameters can be inferred, otherwise param-init-list needs to be specified explicitly. fit-options are supplied to fit. Defines the following targets: * (fit-id-prefix fit-results): fit results, parameters, and the rest from the multiple fit values. * (fit-id-prefix fit-params): fit parameters * (fit-id-prefix fit): fit function with applied parameters * (fit-id-prefix fit-plot): optional plot target" (let* ((defres-op (if force-p 'defres 'defres-uniq)) (id-fit-results `(,fit-id-prefix fit-results ,@flags)) (id-fit-params `(,fit-id-prefix fit-params ,@flags)) (id-fit `(,fit-id-prefix fit ,@flags)) (id-fit-plot `(,fit-id-prefix fit-plot ,@flags)) (param-init-form (cond ;; Explicit case (param-init-list param-init-list) ;; Implicit case ((numberp nparams) `(list ,@(loop for i below nparams collecting param-init-value))) ;; Error when neither works (t (error "Must supply explicit param init list with non-lambda fit function form"))))) `(progn (,defres-op ,id-fit-results (rest (multiple-value-list (fit ,data-form ,fn-form ,param-init-form ,@fit-options)))) (,defres-op ,id-fit-params (first (res ,id-fit-results))) (,defres-op ,id-fit (let ((params (res ,id-fit-params)) (fit-fn ,fn-form)) (lambda (x) (funcall fit-fn params x)))) ,@(when draw-p `((,defres-op ,id-fit-plot (let* ((xr ,x-range) (yr ,y-range) (sampling-list (if (and (numberp (car xr)) (numberp (cdr xr))) (list :low (car xr) :high (cdr xr) :nsamples 1000))) (data ,data-form) (fn (res ,id-fit))) (draw (page (list (plot2d (list (line data :style "points" :title "data" :color "red") (apply #'line fn :title "fit" :style "lines" :color "black" (when sampling-list (list :sampling sampling-list)))) :x-range xr :y-range yr)))))))) )))
5,115
Common Lisp
.lisp
117
29.512821
97
0.510511
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e7070b1e03d496296b0b586e85c16e7fc4ed8b27ad70b7a8bed012b0c68b61d6
1,499
[ -1 ]
1,500
test.lisp
ghollisjr_cl-ana/makeres-utils/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013-2016 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana) (in-package :cl-ana) (defproject makeres-utils-test "/home/ghollisjr/test/makeres-utils-test" (list #'macrotrans #'progresstrans) (fixed-cache 5)) (defres data '((1 . 2) (2 . 3) (3 . 5) (4 . 5) (6 . 4))) (deffitres data (res data) #'polynomial :force-p t :x-range (cons 0 7) :y-range (cons 0 7) :draw-p t :nparams 2 :flags (linear))
1,266
Common Lisp
.lisp
40
29.45
72
0.682488
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
d7899314c5771c48345212fea0a73abd1ff96427ab4b47f224401df618688b26
1,500
[ -1 ]
1,501
combinatorics.lisp
ghollisjr_cl-ana/math-functions/combinatorics.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.math-functions) (defmath factorial (x) (:documentation "Very naive factorial function") (:method ((x number)) (labels ((rec (x &optional (result 1)) (if (<= x 1) result (rec (1- x) (* x result))))) (rec x)))) (defmath npermutations (n r) (:documentation "Returns nPr, the number of permutations of n objects taken r at a time without repetition. Assumes reasonable values of n and r. Returns 1 for nP0.") (:method ((n number) (r number)) (loop for k from (- n r) upto n for result = 1 then (* result k) finally (return result)))) (defmath npermutations-repeating (n r) (:documentation "Returns n^r, the number of ways to permute r objects from a set of n with allowed repetition. Assumes reasonable values of n and r. Note that r can be greater than n.") (:method ((n number) (r number)) (expt n r))) (defmath ncombinations (n r) (:documentation "Returns nCr, the number of combinations of n objects taken r at a time without repetition. Assumes reasonable values of n and r.") (:method ((n number) (r number)) (cond ((zerop r) 1) ((= n r) 1) (t (let ((result 1) (r (min r (- n r)))) ; symmetry optimization (do ((num n (1- num)) (den 1 (1+ den))) ((> den r) result) (setf result (* result num)) (setf result (truncate result den)))))))) (defun ncombinations-repeating (n r) "Returns the number of combinations of n objects taken r at a time with allowed repetition. Assumes reasonable values of n and r. Note that r can be greater than n." (ncombinations (1- (+ n r)) r)) (defun binomial (n r) "Nickname for ncombinations; returns the binomial coefficient of n and r." (ncombinations n r)) (defun multinomial (&rest ms) "Returns the multinomial coefficient where each element of ms is taken to be the number of objects of a single type." (let* ((n (sum ms)) (m NIL) (j NIL) (result 1)) (loop while ms do (when (not m) (setf m (first ms)) (setf j 1) (setf ms (rest ms))) (cond ((null ms) nil) ((< m j) (setf m nil)) (t (setf result (* result (1+ (decf n)))) (setf result (/ result (1- (incf j))))))) result)) ;;;; Useful macros for working with combinatorics ;;; Loop over all nPr permutations. E.g., ;;; ;;; (for-permutations (indices 5 2) (print indices)) ;;; ;;; would print out all of the possible 20 permutation index arrays. ;;; ;;; Note that for nP0, a single iteration of body is evaluated with an ;;; empty index array. (defmacro for-permutations ((indexvar n r) &body body) "Iterates over all permutations of r objects taken from n total, binding an array of r index values to indexvar and evaluating body with that binding. If you want to actually permute objects in a list/array/sequence, use the bound index array to find permutations of those objects. No safety checks are performed, so use reasonable values of n and r." (alexandria:with-gensyms (npr nn rr i j norder x k) `(let* ((,nn ,n) (,rr ,r)) ;; safety check (when (and (plusp ,nn) (<= 0 ,rr ,nn)) (let* ((,npr (npermutations ,nn ,rr)) (,indexvar (make-array ,rr :element-type 'integer :initial-element 0))) (loop for ,i below ,npr do (loop for ,j below ,rr do (let* ((,norder (- ,nn ,j)) (,x (mod ,i ,norder))) (setf (aref ,indexvar ,j) ,x) (loop for ,k below ,j when (>= ,x (aref ,indexvar ,k)) do (incf (aref ,indexvar ,j))))) (progn ,@body))))))) ;; Same but with allowed repetition (defmacro for-permutations-repeating ((indexvar n r) &body body) "Iterates over all permutations with allowed repitition of r objects taken from n total, binding an array of r index values to indexvar and evaluating body with that binding. If you want to actually permute objects in a list/array/sequence, use the bound index array to find permutations of those objects. No safety checks are performed, so use reasonable values of n and r. Note that r can be greater than n since repetition is allowed." (alexandria:with-gensyms (npr nn rr i j) `(let* ((,nn ,n) (,rr ,r)) ;; safety check (when (and (plusp ,nn) (>= ,rr 0)) (let* ((,npr (npermutations-repeating ,nn ,rr)) (,indexvar (make-array ,rr :element-type 'integer :initial-element 0))) (loop for ,i below ,npr do (loop for ,j below ,rr do (setf (aref ,indexvar ,j) (mod (truncate ,i (expt ,nn ,j)) ,nn))) (progn ,@body))))))) ;;; Loop over all nCr combinations. E.g., ;;; ;;; (for-combinations (indices 5 2) (print indices)) ;;; ;;; would print out all of the possible 10 combination index arrays. ;;; ;;; Note that for nC0, a single iteration of body is evaluated with an ;;; empty index array. (defmacro for-combinations ((indexvar n r) &body body) "Evaluates body for every combination of r objects taken from a set of n without repetition and without caring about order of occurrence. indexvar will be set to an index array denoting the selected combination. For unreasonable values of n and r, no iterations are performed. Note that for r=0, one evaluation of the body is performed with an empty index array." (alexandria:with-gensyms (n-r nn rr i lastindex currentindex state current nextindex next delta k) `(let* ((,nn ,n) (,rr ,r) (,n-r (- ,nn ,rr))) ; useful for later ;; safety check (when (and (plusp ,nn) (<= 0 ,rr ,nn)) (let* ((,indexvar (make-array ,rr :element-type 'integer :initial-element 0))) ;; init indices (loop for ,i below ,rr do (setf (aref ,indexvar ,i) ,i)) ;; strategy: ;; ;; Indices will be strictly ordered from least to greatest. ;; This makes finding the next valid combination of indices ;; simple. ;; ;; Iteration is accomplished through a state machine with the ;; following states: ;; ;; 0. Execute combination. ;; 1. Increment. ;; 2. Halt. ;; ;; There is an additional state variable: currentindex is the ;; index currently attempted to increment. If it's not the ;; last index, then successfully finding a valid slot means ;; needing to initialize all higher indices. (let* ((,lastindex (1- ,rr)) (,currentindex ,lastindex) (,state 0)) (symbol-macrolet ((,current (aref ,indexvar ,currentindex)) (,nextindex (1+ ,currentindex)) (,next (aref ,indexvar (1+ ,currentindex)))) (loop while (not (= ,state 2)) do (case ,state ;; execute (0 ,@body (setf ,currentindex ,lastindex) (setf ,state 1)) ;; increment (1 (cond ;; out of combinations ((< ,currentindex 0) (setf ,state 2)) ;; out of room to grow for increasing currentindex ((< ,n-r (- (1+ ,current) ,currentindex)) (decf ,currentindex)) ;; can find combination (t (incf ,current) (let* ((,delta (- ,current ,currentindex))) (loop for ,k from (1+ ,currentindex) below ,rr do (setf (aref ,indexvar ,k) (+ ,k ,delta)))) (setf ,state 0) (setf ,currentindex ,lastindex))))))))))))) (defmacro for-combinations-repeating ((indexvar n r) &body body) "Evaluates body for every combination of r objects taken from a set of n with allowed repetition but without caring about order of occurrence. indexvar will be set to an index array denoting the selected combination. For unreasonable values of n and r, no iterations are performed. Note that for r=0, one evaluation of the body is performed with an empty index array." (alexandria:with-gensyms (n-1 nn rr i lastindex currentindex state current nextindex next k) `(let* ((,nn ,n) (,rr ,r) (,n-1 (1- ,nn))) ; useful for later ;; safety check (when (and (plusp ,nn) (>= ,rr 0)) (let* ((,indexvar (make-array ,rr :element-type 'integer :initial-element 0))) ;; init indices (loop for ,i below ,rr do (setf (aref ,indexvar ,i) 0)) ;; strategy: ;; ;; Indices will be strictly ordered from least to greatest. ;; This makes finding the next valid combination of indices ;; simple. ;; ;; Iteration is accomplished through a state machine with the ;; following states: ;; ;; 0. Execute combination. ;; 1. Increment. ;; 2. Halt. ;; ;; There is an additional state variable: currentindex is the ;; index currently attempted to increment. If it's not the ;; last index, then successfully finding a valid slot means ;; needing to initialize all higher indices. (let* ((,lastindex (1- ,rr)) (,currentindex ,lastindex) (,state 0)) (symbol-macrolet ((,current (aref ,indexvar ,currentindex)) (,nextindex (1+ ,currentindex)) (,next (aref ,indexvar (1+ ,currentindex)))) (loop while (not (= ,state 2)) do (case ,state ;; execute (0 ,@body (setf ,currentindex ,lastindex) (setf ,state 1)) ;; increment (1 (cond ;; out of combinations ((< ,currentindex 0) (setf ,state 2)) ;; out of room to grow for increasing currentindex ((<= ,n-1 ,current) (decf ,currentindex)) ;; can find combination (t (incf ,current) (loop for ,k from (1+ ,currentindex) below ,rr do (setf (aref ,indexvar ,k) ,current)) (setf ,state 0) (setf ,currentindex ,lastindex)))))))))))))
13,138
Common Lisp
.lisp
323
28.074303
87
0.511913
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
0224239a368a90ed03bf4d6e5760100b293c0763eec73cc5b08689c7ae0fc8ed
1,501
[ -1 ]
1,502
package.lisp
ghollisjr_cl-ana/math-functions/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage :cl-ana.math-functions (:use :cl) (:shadow :erf) (:shadow :factorial) (:export ;; distributions: :erf :sinc :normal-pdf :normal-cdf :normal-cdf-inv :uniform-cdf :uniform-cdf-inv ;; combinatorics: :factorial :npermutations :npermutations-repeating :ncombinations :ncombinations-repeating :binomial :multinomial ;; misc :logistic :logistic-derivative ;; utils: :->double-float :periodic-shift :solve-interval-bisection ;; macros: :for-permutations :for-permutations-repeating :for-combinations :for-combinations-repeating )) (cl-ana.gmath:use-gmath :cl-ana.math-functions)
1,553
Common Lisp
.lisp
55
25.381818
70
0.703877
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
a2eec3ef6bfca8bf0fc6ec7bb20f9976da19d10b34cad42c8a97bfea896f50c7
1,502
[ -1 ]
1,503
utils.lisp
ghollisjr_cl-ana/math-functions/utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.math-functions) (defmath ->double-float (x) (:documentation "Converts numerical object into a double-float form; does not need to be an actual double-float result, but where appropriate constituents are converted into double-float values.") (:method ((x real)) (float x 0d0)) (:method ((x complex)) (complex (float (realpart x) 0d0) (float (imagpart x) 0d0)))) (defun periodic-shift (x lo hi) "Shifts x into the range [lo, hi] through interval multiples of (- hi lo). Useful for shifting angles into a different range or working with periodic quantities in general." (let* ((range (- hi lo)) (k (ceiling (/ (- lo x) range)))) (+ x (* k range)))) ;;;; Solving 1-D problems with interval bisection (defun solve-interval-bisection (fn interval &key (value 0d0) (prec 1d-4)) (flet ((exists (x y) (minusp (* (signum (- (funcall fn x) value)) (signum (- (funcall fn y) value))))) (middle (x y) (* 0.5d0 (+ x y)))) (let* ((xlo (car interval)) (xhi (cdr interval)) (diff (- xhi xlo))) (cond ((zerop (- (funcall fn xlo) value)) xlo) ((zerop (- (funcall fn xhi) value)) xhi) (t (when (exists xlo xhi) (let* ((iter 0)) (loop while (> diff prec) do (let* ((xm (middle xlo xhi))) (incf iter) (if (zerop (- (funcall fn xm) value)) (return-from solve-interval-bisection xm) (if (exists xlo xm) (setf xhi xm) (setf xlo xm))) (setf diff (- xhi xlo)))) (values (middle xlo xhi) iter))))))))
2,845
Common Lisp
.lisp
72
30.416667
70
0.553991
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
f49cc08caa6d74389b0b12e9a8b118b760b9506d5f2259a441be7448dd8ceff4
1,503
[ -1 ]
1,504
distributions.lisp
ghollisjr_cl-ana/math-functions/distributions.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.math-functions) (defmath erf (x) (:documentation "the error function") (:method ((x number)) (gsll:erf (->double-float x)))) (defmath normal-pdf (x) (:documentation "Standard normal probability density function") (:method ((x number)) (/ (exp (/ (- (* x x)) 2)) (sqrt (* 2 pi))))) (defmath normal-cdf (x) (:documentation "Standard normal cumulative density function") (:method ((x number)) (gsll:gaussian-p (->double-float x) 1d0))) (defmath normal-cdf-inv (x) (:documentation "Inverse of normal CDF") (:method ((x number)) (gsll:gaussian-pinv (->double-float x) 1d0))) (defmath uniform-cdf (x lo hi) (:documentation "CDF of uniform distribution between lo and hi.") (:method ((x number) (lo number) (hi number)) (cond ((< x lo) 0) ((> x hi) 1) (t (/ (- x lo) (- hi lo)))))) (defmath uniform-cdf-inv (x lo hi) (:documentation "Inverse CDF of uniform distribution between lo and hi. Assumes x is between 0 and 1.") (:method ((x number) (lo number) (hi number)) (+ lo (* x (- hi lo)))))
2,026
Common Lisp
.lisp
57
31.877193
84
0.64595
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9c747ad292ecda362d7d8c0b8e209151666901e66525125847bd6dd486ec6805
1,504
[ -1 ]
1,505
misc.lisp
ghollisjr_cl-ana/math-functions/misc.lisp
(in-package :cl-ana.math-functions) (defun logistic (x) "Logistic sigmoid function" (expt (+ 1 (exp (- x))) -1)) (defun logistic-derivative (x) "Derivative of logistic sigmoid function" (let ((f (logistic x))) (* f (- 1 f))))
240
Common Lisp
.lisp
8
27.25
43
0.647826
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
3206fa5d92822e846a00c52f308b339c36d4d3134f3f45b0d3c5454488f39604
1,505
[ -1 ]
1,506
package.lisp
ghollisjr_cl-ana/list-utils/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.list-utils (:use :cl :alexandria :cl-ana.string-utils :cl-ana.functional-utils) (:export :range :zip :lzip :unzip :unlzip :mapzip :tree-map :intersperse :transpose :cartesian-product :every-nth :except-nth :at-indices :except-at :compress :list-less-than :list-greater-than :aref-by-list :make-offsets :ensure-lists :partition :tree-flatten ;;; alists :cars :cdrs ;; lists as sets :list->set :list->set-ht ;;; plists :plist-select-fields :plist->alist :alist->plist ;; Useful looping macros over plists: :do-plists :do-plist ;; Paul Graham's stuff (and some of my improvements) :length-equal :single :append1 :conc1 :mklist :longer :group :prune :find2 :before :after :duplicate :permute ;; miscellaneous :groupby :reduceby ))
2,124
Common Lisp
.lisp
78
19.717949
70
0.56577
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
1ca5bc7f94df42b1791a9b90ca1e0a45446dfccf4832509e95a1d9252ae11986
1,506
[ -1 ]
1,507
list-utils.lisp
ghollisjr_cl-ana/list-utils/list-utils.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.list-utils) (defun range (start end &optional (step 1)) (labels ((range-helper (s e st result) (if (> s e) result (range-helper (+ s st) e st (cons s result))))) (nreverse (range-helper start end step ())))) ;; Sorry: I learned Haskell before Common Lisp, so I like ;; zipping/unzipping lists ;; Just found out that pairlis does exactly what my zip does, except ;; that (at least in sbcl) the resulting list comes in reverse order (defun zip (x y) (mapcar #'cons x y)) (defun lzip (&rest lists) "Like zip, but uses lists instead of cons pairs thus allowing ntuples" (transpose lists)) (defun unzip (xs) "Returns a cons with the car being the cars of the zipped xs and the cdr being the cdrs." (labels ((unzip-helper (xs ls rs) (if xs (unzip-helper (cdr xs) (cons (car (car xs)) ls) (cons (cdr (car xs)) rs)) (cons (nreverse ls) (nreverse rs))))) (unzip-helper xs () ()))) (defun unlzip (xs) "lzip is an inverse (through apply) of itself, simply applies lzip to its argument, returning a list of the previously zipped lists in xs." (apply #'lzip xs)) ;; Useful for creating mappings from data to values: (defun mapzip (fn &rest lists) "Returns an alist mapping the list of corresponding elements from each input list to the value of fn for those values; it's just zipping together the arguments with the value of fn. If only one list is given, the elements are mapped directly (i.e. not in a list)" (apply #'mapcar (if (single lists) (lambda (x) (cons x (funcall fn x))) (lambda (&rest xs) (cons xs (apply fn xs)))) lists)) ;; Tree map (defun tree-map (fn &rest trees) "Maps function over identically structured trees (lists)" (when trees (cond ((null (first trees)) nil) ((or (atom (first trees)) (cdr (last (first trees)))) (apply fn trees)) ((listp (first trees)) (apply #'mapcar (lambda (&rest ts) (apply #'tree-map fn ts)) trees))))) (defun intersperse (obj lst) "Inserts obj in between each pair of elements in lst" (labels ((rec (lst &optional result) (if (null (cdr lst)) (nreverse (cons (car lst) result)) (rec (rest lst) (cons obj (cons (car lst) result)))))) (rec lst))) (defun transpose (xs) (labels ((transpose-worker (xs result) (let* ((heads (remove-if #'null (mapcar #'car xs))) (tails (remove-if #'null (mapcar #'cdr xs)))) (if xs (transpose-worker tails (cons heads result)) result)))) (nreverse (transpose-worker xs ())))) ;; Can't go without the Cartesian Product (defun cartesian-product (&rest xs) (if xs (if (single xs) (mapcar #'list (car xs)) (mapcan (lambda (c) (mapcar (lambda (x) (cons x c)) (car xs))) (apply #'cartesian-product (cdr xs)))))) ;; Selects every nth term from a list (including the first term): (defun every-nth (list n &optional (start 0)) (labels ((every-nth-worker (list n i result) ;; assumes that n > 0 (if list (if (= i 1) (every-nth-worker (rest list) n n (cons (first list) result)) (every-nth-worker (rest list) n (1- i) result)) (when result (nreverse result))))) (if (plusp n) (every-nth-worker (subseq list start) n 1 ()) (error "Negative number given to every-nth")))) ;; Until I implement the Levi-Civita tensor again, I'm using this to ;; write certain things (defun except-nth (x n) (labels ((except-nth-helper (x n result) (cond ((> n 0) (except-nth-helper (cdr x) (1- n) (cons (car x) result))) ((= n 0) (except-nth-helper (cdr x) (1- n) result)) ((< n 0) (append (reverse x) result))))) (nreverse (except-nth-helper x n ())))) (defun at-indices (lst indices) "Returns the values from lst located at positions given by indices" (loop for i in indices collecting (elt lst i))) ;; (defun at-indices (lst indices) ;; "Returns the values from lst located at positions given by indices" ;; (labels ((rec (xs inds &optional result (i 0)) ;; (cond ;; ((or (null xs) ;; (null inds)) ;; (nreverse result)) ;; ((equal (first inds) i) ;; (rec (rest xs) ;; (rest inds) ;; (cons (first xs) result) ;; (1+ i))) ;; (t ;; (rec (rest xs) ;; inds ;; result ;; (1+ i)))))) ;; (rec lst indices))) (defun except-at (xs ns &key (test #'eql) uniquely-sorted) "Yields the list of xs except for the elements at the positions in ns. Set uniquely-sorted to t if you want except-at to assume the ns are already unique and sorted least to greatest." (labels ((except-at-worker (xs ns &optional result (current-index 0)) (if xs (if ns (if (= (first ns) current-index) (except-at-worker (rest xs) (rest ns) result (1+ current-index)) (except-at-worker (rest xs) ns (cons (first xs) result) (1+ current-index))) ;; cons xs onto result and return result (nreverse (reduce (flip #'cons) xs :initial-value result))) (nreverse result)))) (let ((uniquely-sorted-ns (if uniquely-sorted ns (let ((ns-copy (copy-list ns))) (reverse (reduce (lambda (x y) (adjoin y x :test test)) (sort ns-copy #'<) :initial-value ())))))) (except-at-worker xs uniquely-sorted-ns)))) ;; Compress a list into an alist where each car is the value and each ;; cdr is the count of said value. This is a shitty algorithm btw, ;; not useful for processing intensive stuff, but for the time being ;; it works for some of my other utilities. (defun compress (list &key (key #'identity) (test 'eql) sort-by singleton-pairs) "Compress list such that duplicate elements are combined into a single pair entry which has as the car the element value and as the cdr the count. The singleton-pairs option controls whether single elements are still placed inside a pair. This is useful when the elements of the list you wish to compress are cons cells, as this would otherwise lead to ambiguity in the result." (let* ((result-table (make-hash-table :test test))) (dolist (x list) (if (gethash x result-table) (incf (gethash x result-table)) (setf (gethash x result-table) 1))) (let* ((map-fn (if singleton-pairs (lambda (x c) (cons x c)) (lambda (x c) (if (= 1 c) x (cons x c))))) (raw-alist (loop for k being the hash-keys of result-table for v being the hash-values of result-table collect (funcall map-fn k v)))) (if sort-by (sort raw-alist sort-by :key (if singleton-pairs (lambda (x) (funcall key (car x))) (lambda (x) (if (consp x) (funcall key (car x)) (funcall key x))))) raw-alist)))) (defun list-less-than (list1 list2) (let ((x1 (car list1)) (x2 (car list2))) (cond ((and (null list1) (null list2)) nil) ((null list1) t) ((null list2) nil) ((< x1 x2) t) ((= x1 x2) (list-less-than (cdr list1) (cdr list2))) (t nil)))) (defun list-greater-than (list1 list2) (let ((x1 (car list1)) (x2 (car list2))) (cond ((and (null list1) (null list2)) nil) ((null list1) nil) ((null list2) t) ((> x1 x2) t) ((= x1 x2) (list-greater-than (cdr list1) (cdr list2))) (t nil)))) (defun aref-by-list (array indexlist) "Access array element via index list instead of individual indices" (apply #'aref array indexlist)) (defun list-equal (list1 list2) (if (and (consp list1) (consp list2)) (if (equal (first list1) (first list2)) (list-equal (rest list1) (rest list2)) nil) nil)) (defun make-offsets (sizes) "Takes a list of sizes and returns a list containing 0, (first sizes), (+ (first sizes) (second sizes)), ... summing the sizes as the list goes. This pattern has turned out to be recurrent, and the result can be interpreted as finding the starting index of the ith list in the concatenation of n lists." (nreverse (rest (reduce (lambda (x y) (cons (+ y (car x)) x)) sizes :initial-value (list 0))))) ;;; useful for alists: (defun cdrs (xs) (mapcar #'cdr xs)) (defun cars (xs) (mapcar #'car xs)) ;;; lists as sets utilities: (defun list->set (list &optional (test #'eql)) "Returns list with duplicates removed" (reduce (lambda (res el) (adjoin el res :test test)) list :initial-value nil)) (defun list->set-ht (list &optional (test 'eql)) (let* ((ht (make-hash-table :test test))) (loop for x in list do (when (not (gethash x ht)) (setf (gethash x ht) t))) ht)) ;; Partitioning a list (defun partition (list &key (key #'identity) (test #'eql)) "Re-groups the contents of a list into partitions using the test function provided. Guarantees that the elements of each group pass test with every member of the partition as long as the test function is transitive. Does not necessarily preserve order of partitions, but preserves order of the elements relative to each partition. This function supports two different conceptual approaches to partitioning: * By relation: the test function is the equivalence relation operator * By association: using a key function which maps into a set of index values allows the user to partition according to association with that value." (let* (;; map from partition number to result list (resultht (make-hash-table :test 'equal)) ;; number of partitions currently found (nparts 0)) (loop for i in list do ;; Find a matching partition (let ((match nil)) (loop for n from 1 to nparts when (funcall test (funcall key i) (funcall key (first (gethash n resultht)))) do (setf match n) and return nil) ;; Either add the match or create a new partition (if match (push i (gethash match resultht)) (push i (gethash (incf nparts) resultht))))) ;; finally return the list: (loop for i from 1 to nparts collecting (nreverse (gethash i resultht))))) ;; Collects all non-nil atoms inside a tree (defun tree-flatten (tree) "Collects all non-nil atoms in a tree and returns the list of them as encountered during a depth-first search." (cond ((null tree) nil) ((atom tree) (list tree)) (t (append (tree-flatten (car tree)) (tree-flatten (cdr tree)))))) ;;; Stuff (mostly) from Paul Graham's On Lisp, as well as some of my ;;; own improvements. (declaim (inline single append1 conc1 mklist)) ;; Would include last1, but Alexandria has last-elt, which is last1 ;; for sequences (defun length-equal (list length) "Returns t/nil as soon as it is apparent that the list does not contain exactly length elements." (declare (integer length)) (labels ((rec (list length) (if (zerop length) (if (null list) t nil) (if (consp list) (length-equal (cdr list) (1- length)) nil)))) (if (< length 0) nil (rec list length)))) (defun single (list) "Checks to see if list is a list with exactly one element." (and (consp list) (null (rest list)))) (defun append1 (list object) "Creates a list containing object and appends list to it." (append list (list object))) (defun conc1 (list object) "Like append1, but uses nconc instead of append" (nconc list (list object))) (defun mklist (object) "Ensures that object is a list, if not object is packaged in a list." (if (listp object) object (list object))) (defmacro ensure-lists ((&rest list-bindings) &body body) "Ensures and rebinds variables as lists via mklist. Each list-binding must be either a symbol or a list (symbol form); for a symbol it will be bound to (mklist symbol) in the body; for a list the first element of the list-binding will be bound to (mklist (second list-binding))." `(let ,(loop for lb in list-bindings collect (if (listp lb) `(,(first lb) (mklist ,(second lb))) `(,lb (mklist ,lb)))) ,@body)) (defun longer (x y) "Efficiently compares two lists, or if they're not both lists simply calls length on each and compares. This could be sped up a bit if one argument is a list and the other not, so it's a work in progress." (labels ((compare (x y) (and (consp x) (or (null y) (compare (cdr x) (cdr y)))))) (if (and (listp x) (listp y)) (compare x y) (> (length x) (length y))))) ;; filter is (IMO) not so necessary (as Paul Graham uses the term) (defun group (source n) "Takes a list and returns a list of lists of the elements in the list grouped in lists of size n with the remainder in the last list." (if (zerop n) (error "zero length") (labels ((group-worker (source acc) (let ((rest (nthcdr n source))) (if (consp rest) (group-worker rest (cons (subseq source 0 n) acc)) (nreverse (cons source acc)))))) (if source (group-worker source nil) nil)))) ;; flatten is already provided by Alexandria. To reduce a tree just ;; flatten the list first and then reduce it. (defun prune (test tree) "Like remove-if, but for lists treated as trees." (labels ((prune-worker (tree acc) (cond ((null tree) (nreverse acc)) ((consp (car tree)) (prune-worker (cdr tree) (cons (prune-worker (car tree) nil) acc))) (t (prune-worker (cdr tree) (if (funcall test (car tree)) acc (cons (car tree) acc))))))) (prune-worker tree nil))) (defun find2 (fn list) "Like find, but it returns two values: the list element and the value that fn returned." (if (null list) nil (let ((val (funcall fn (car list)))) (if val (values (car list) val) (find2 fn (cdr list)))))) (defun before (x y list &key (test #'eql)) "Tells you if x is found before y in list." (and list (let ((first (car list))) (cond ((funcall test y first) nil) ((funcall test x first) list) (t (before x y (cdr list) :test test)))))) (defun after (x y list &key (test #'eql)) "Tells you if x is found after y in list." (let ((rest (before y x list :test test))) (and rest (member x rest :test test)))) (defun duplicate (object list &key (test #'eql)) "Tells you if the object occurs more than once in the list." (member object (cdr (member object list :test test)) :test test)) (defun permute (list permutation) "Re-arranges the elements in list according to the permutation." (mapcar (lambda (p) (elt list p)) permutation)) ;; split-if is provided by split-sequence:split-sequence-if ;;;; plist stuff (defun plist->alist (plist) "Forms an alist from a plist" (do ((lst plist (rest (rest lst))) (result nil (cons (cons (first lst) (second lst)) result))) ((null lst) (nreverse result)))) (defun alist->plist (alist) "Forms a plist from an alist" (let ((result ())) (dolist (x alist) (push (car x) result) (push (cdr x) result)) (nreverse result))) (defun plist-select-fields (plist &rest fields) "Returns a list of the fields from plist in the order specified; the element will be nil if the field is not present." (mapcar (lambda (x) (getf plist x)) fields)) ;; Operator for looping over a plist: (defmacro do-plist ((field-symbol field-value plist) &body body) "Executes body via looping over plist, binding each field symbol to field-symbol and each field value to field-value. Returns nil." (with-gensyms (lst) `(do ((,lst ,plist (rest (rest ,lst)))) ((null ,lst)) (let ((,field-symbol (first ,lst)) (,field-value (second ,lst))) ,@body)))) ;; Operator for looping over a list of plists, binding variables ;; according to the field names of each plist (defmacro do-plists (plists &body body) "Loops over a plist, binding each field in the plist to a variable of the same name as the field symbol but in the current package." (with-gensyms (lst fs fv) `(dolist (,lst ,plists) (do-plist (,fs ,fv ,lst) (set (intern (lispify ,fs)) ,fv)) ,@body))) ;; Grouping and reducing by keys ;; ;; These support any sequences, but generate lists. (defun groupby (data &key (groupkey #'identity) (valuekey #'identity) (test 'equal)) "Groups data using a hash-table and the group and value key functions provided. Return value is an alist of keys and the grouped values for each key." (let* ((ht (make-hash-table :test test))) (map nil (lambda (d) (let* ((k (funcall groupkey d))) (push (funcall valuekey d) (gethash k ht)))) data) (loop for k being the hash-keys in ht for v being the hash-values in ht collecting (cons k v)))) (defun reduceby (data fn &rest groupby-args) "Groups using groupby and then reduces each group using the reduction function provided." (let* ((grouped (apply #'groupby data groupby-args))) (map 'list (lambda (x) (destructuring-bind (type &rest amounts) x (list type (reduce fn amounts)))) grouped)))
20,164
Common Lisp
.lisp
551
29.067151
75
0.584796
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
815e8db67d484e809b696b3f1f2a17c43fb0cd0c28161dfb6bdccf7ef2652a20
1,507
[ -1 ]
1,508
package.lisp
ghollisjr_cl-ana/tensor/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] ;;;; package.lisp (defpackage #:cl-ana.tensor (:use #:cl #:alexandria #:cl-ana.list-utils #:cl-ana.symbol-utils ;; debug #:cl-ana.macro-utils) (:export :make-tensor :function->tensor :tensor-ref :tref :tensor-flat-ref ; for flattened-index reference :tfref :tensor-map :tensor-+ :tensor-- :tensor-* :tensor-/ :tensor-rank :tensor-dimensions :sequencep :tensor-contract :tensor-flatten :tensor-unflatten)) (cl-ana.gmath:use-gmath :cl-ana.tensor)
1,463
Common Lisp
.lisp
46
27.543478
70
0.65583
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
bb9a8fd863990dbf939bdee3ded844daf524c893e787f7c9f8ec96f7c336db0d
1,508
[ -1 ]
1,509
tensor.lisp
ghollisjr_cl-ana/tensor/tensor.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.tensor) ;;;; A tensor is just a recursively structured sequence of sequences ;;;; of .... It's useful for implementing things like contiguous ;;;; histograms, matrices, actual tensors, etc. The utilities ;;;; provided in this sublibrary make it convenient to use nested ;;;; sequences as multidimensional arrays in CL since the ones ;;;; provided are awkward/clumsy to use. ;;;; ;;;; To make use of the tensor functions, just define a list, or ;;;; vector of vectors, or even a list of vectors of lists of ..., you ;;;; get the idea. ;;;; ;;;; Of particular merit is the fact that everything is vectorized ;;;; automatically when using this library; you want to add a constant ;;;; value to a list? Just do (+ (list x y z ...) value). Want to ;;;; take the square root of an array of numbers? Just do (sqrt ;;;; array). (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 1))) ;;; Reader macro: #t(fn tensor1 tensor2 ...) applies tensor-map to the ;;; arguments. Can use #' or (function) on fn or not, both cases are ;;; handled. (defun tensor-map-transformer-reader-macro (stream subchar arg) (let* ((expr (read stream t)) (raw-fn (first expr)) (fn (if (symbolp raw-fn) `(function ,raw-fn) raw-fn)) (args (rest expr))) `(tensor-map ,fn ,@args))) (set-dispatch-macro-character #\# #\t #'tensor-map-transformer-reader-macro) (defun define-tensor-methods () (loop for f being the hash-keys in *gmath-generic-map* for a being the hash-values in *gmath-generic-map* do (define-tensor-method f a))) (defun define-tensor-method (fname args) (multiple-value-bind (tensor-args key-args) (let ((key-pos (position "&KEY" args :test #'equal :key #'string))) (if key-pos (values (subseq args 0 key-pos) (subseq args (1+ key-pos))) (values args nil))) (let* ((key-fields (mapcar #'keywordify key-args)) (key-applied-args (loop for a in key-args for k in key-fields append (list k a))) (tensor-specialized-args (mapcar (lambda (x) `(,x sequence)) tensor-args)) (nil-specialized-args (mapcar (lambda (x) `(,x (eql NIL))) tensor-args)) (arg-specs (remove-if-not (lambda (x) (some #'listp x)) (apply #'cartesian-product (mapcar #'list tensor-args tensor-specialized-args)))) (nil-arg-specs (remove-if-not (lambda (x) (some #'listp x)) (apply #'cartesian-product (mapcar #'list tensor-args nil-specialized-args))))) (loop for a in arg-specs do (multiple-value-bind (unspecialized specialized) (loop for i in a if (symbolp i) collect i into unspecialized else collect (first i) into specialized finally (return (values unspecialized specialized))) ;; this seems to be a necessary use of eval (eval `(defmethod ,fname (,@a ,@(when key-args (cons '&key key-args))) (tensor-map (lambda (,@specialized) (apply (function ,fname) ,@tensor-args (list ,@key-applied-args))) ,@specialized))))) ;; NIL methods: (loop for n in nil-arg-specs do (multiple-value-bind (unspecialized specialized) (loop for i in n if (symbolp i) collect i into unspecialized else collect (first i) into specialized finally (return (values unspecialized specialized))) ;; this seems to be a necessary use of eval (eval `(defmethod ,fname (,@n ,@(when key-args (cons '&key key-args))) nil)))) ))) ;; Define tensor methods; note that this should be done after all ;; generic math functions have been defined with defmath. (define-tensor-methods) ;; This version is much faster than using subtypep (defun sequencep (x) (typep x 'sequence)) (defun tensor-simple-type (type) (if (atom type) type (first type))) ;; This version does not handle type constraints on arrays, but I'm ;; keeping it here until testing is complete ;; ;; (defun make-tensor (dimension-list &key ;; (type 'vector) ;; (initial-element 0d0)) ;; "Creates a tensor with each dimension in dimension-list denoting the ;; length of the sequence at that dimension with the type of the ;; sequences given by the optional type argument." ;; (if (single dimension-list) ;; (make-sequence type (first dimension-list) :initial-element initial-element) ;; (map type ;; (lambda (&rest xs) ;; (make-tensor (rest dimension-list) :type type :initial-element initial-element)) ;; (make-sequence type (first dimension-list))))) (defun make-tensor (dimension-list &key (type 'vector) (initial-element 0d0)) "Creates a tensor with each dimension in dimension-list denoting the length of the sequence at that dimension with the type of the sequences given by the optional type argument." (if (single dimension-list) (make-sequence (tensor-simple-type type) (first dimension-list) :initial-element initial-element) (map type (lambda (&rest xs) (make-tensor (rest dimension-list) :type type :initial-element initial-element)) (make-sequence (tensor-simple-type type) (first dimension-list))))) (defun function->tensor (dimension-list fn &key (type 'vector)) (let* ((result (make-tensor dimension-list :type type)) (size (apply #'* dimension-list ))) (loop for i below size do (setf (tensor-flat-ref result i) (apply fn (unflatten-index i dimension-list)))) result)) ;; (defgeneric tensor-ref (tensor &rest subscripts) ;; (:documentation "References an object as a tensor")) ;; (defmethod tensor-ref ((tensor sequence) &rest subscripts) ;; (reduce #'elt subscripts :initial-value tensor)) ;; (defmethod tensor-ref (tensor &rest subscripts) ;; tensor) (defun tensor-ref (tensor &rest subscripts) "References tensor via subscripts" (if (sequencep tensor) (reduce #'elt subscripts :initial-value tensor) tensor)) (defun tref (tensor &rest subscripts) "Abbreviation for tensor-ref; setfable." (apply #'tensor-ref tensor subscripts)) (defun unflatten-index (index dim-sizes) (let ((sub index) (result nil)) (do* ((rdim-sze (reverse dim-sizes) (rest rdim-sze)) (dim-size (first rdim-sze) (first rdim-sze))) ((null rdim-sze) result) (push (mod sub dim-size) result) (setf sub (floor sub dim-size))))) (defun tensor-flat-ref (tensor subscript) "References tensor by single subscript; done in such a way to mimick the way multidimensional arrays are stored in memory by e.g. C. Assumes rectangular tensor." (if (sequencep tensor) (let* ((dim-list (tensor-dimensions tensor)) (subscripts (unflatten-index subscript dim-list))) (apply #'tensor-ref tensor subscripts)) tensor)) (defun tfref (tensor subscript) "Abbreviation for tensor-flat-ref; setfable." (tensor-flat-ref tensor subscript)) (defun (setf tensor-flat-ref) (value tensor subscript) (let* ((dim-list (tensor-dimensions tensor)) (subscripts (unflatten-index subscript dim-list))) (setf (apply #'tensor-ref tensor subscripts) value))) (defun (setf tfref) (value tensor subscript) (setf (tensor-flat-ref tensor subscript) value)) (defun (setf tensor-ref) (value tensor &rest subscripts) (let* ((last-sequence (apply #'tensor-ref tensor (butlast subscripts))) (last-subscript (lastcar subscripts))) (setf (elt last-sequence last-subscript) value))) (defun (setf tref) (value tensor &rest subscripts) (setf (apply #'tensor-ref tensor subscripts) value)) (defun tensor-rank (tensor) (labels ((tensor-rank-worker (tensor &optional (result 1)) (let ((first-elt (elt tensor 0))) (if (sequencep first-elt) (tensor-rank-worker first-elt (1+ result)) result)))) (if (sequencep tensor) (tensor-rank-worker tensor) 0))) (defun tensor-dimensions (tensor) "Returns a list of the sizes of the tensor for each dimension." (labels ((tensor-dimensions-worker (tensor &optional result) (if (sequencep tensor) (tensor-dimensions-worker (elt tensor 0) (cons (length tensor) result)) (nreverse result)))) (tensor-dimensions-worker tensor))) (defun tensor-size (tensor) (reduce #'* (tensor-dimensions tensor))) (defun map* (type fn &rest xs) "map* behaves like map except that non-sequences are treated as arbitrarily deep sequences with uniform value (that of the object)." (let* ((min-length (reduce #'min (loop for x in xs appending (mklist (length x))))) (result (make-tensor (list min-length) :type type))) (if (zerop min-length) nil (progn (loop for i below min-length do (setf (tensor-ref result i) (apply fn (mapcar (lambda (x) (tensor-ref x i)) xs)))) result)))) (defun tensor-map (fn &rest xs) "Maps fn across xs for arbitrarily deep sequences. Treats non-sequences as sequences of arbitrary depth." (let ((first-sequence (find-if #'sequencep xs))) (if first-sequence (apply #'map* (type-of first-sequence) (curry #'tensor-map fn) xs) (apply fn xs)))) (defun tmap (fn &rest xs) "Abbreviation for tensor-map" (apply #'tensor-map fn xs)) (defun tensor-+ (&rest xs) "Convenient nickname for mapping + over tensors." (apply #'tensor-map #'+ xs)) (defun tensor-- (&rest xs) "Convenient nickname for mapping - over tensors." (apply #'tensor-map #'- xs)) (defun tensor-* (&rest xs) "Convenient nickname for mapping * over tensors." (apply #'tensor-map #'* xs)) (defun tensor-/ (&rest xs) "Convenient nickname for mapping / over tensors." (apply #'tensor-map #'/ xs)) ;; I do apologize for this extremely ugly code, but it does in fact ;; work. If you touch this code there is something wrong with you. ;; ;; At the moment I have not implemented single tensor contraction ;; (i.e. contraction of multiple indices from a single tensor). (defun tensor-contract (tensor-index-pairs &key (type 'vector)) "Contracts each tensor along the dimension specified by the specified index, resulting in a tensor of recursively rectangular sequences of type type. Each tensor-index-pair is a cons with the car being the tensor to contract and the cdr being the index denoting the dimension to contract along for this tensor. It is just the mathematical notion of tensor contraction. Example: multiplying matrices: A . B ==> (tensor-contract (list (cons A 1) (cons B 0))) In words, contract tensors A and B along the second index of A and the first index of B." (let* ((tensors (mapcar #'car tensor-index-pairs)) (tensor-ranks (mapcar #'tensor-rank tensors)) (starting-indices (make-offsets (mapcar #'1- tensor-ranks))) (contracted-dims (mapcar #'cdr tensor-index-pairs)) (ref-fns ; a ref-fn is a function taking the final index list ; and another index, returning the value of the ; tensor for that ref-fn along the contracted ; dimension at the second index using the ; appropriate indices from the final index list (mapcar (lambda (tensor starting-index tensor-rank dim) (let ((ending-index (add starting-index (1- tensor-rank)))) (lambda (final-index-list contracting-index) (let* ((applicable-indices (subseq final-index-list starting-index ending-index)) (left-indices (subseq applicable-indices 0 dim)) (right-indices (when (< dim (- tensor-rank 1)) (subseq applicable-indices dim)))) (apply #'tensor-ref tensor (append left-indices (list contracting-index) right-indices)))))) tensors starting-indices tensor-ranks contracted-dims)) (contracted-dimension-length (reduce #'min (mapcar (lambda (tensor dim) (elt (tensor-dimensions tensor) dim)) tensors contracted-dims))) (dimension-lists (mapcar (lambda (tensor tensor-rank dim) (let ((dimensions (tensor-dimensions tensor))) (append (subseq dimensions 0 dim) (when (< dim (1- tensor-rank)) (subseq dimensions (1+ dim)))))) tensors tensor-ranks contracted-dims)) (result-dimension-list (apply #'append dimension-lists)) (final-indices (apply #'cartesian-product (loop for dim-length in result-dimension-list collect (range 0 (1- dim-length))))) (result (when final-indices (make-tensor result-dimension-list :type type)))) (if final-indices (loop for final-index in final-indices do (setf (apply #'tensor-ref result final-index) (apply #'+ (loop for contracted-index below contracted-dimension-length collect (apply #'* (mapcar (lambda (ref-fn) (funcall ref-fn final-index contracted-index)) ref-fns)))))) (setf result (apply #'+ (loop for contracted-index below contracted-dimension-length collect (apply #'* (mapcar (lambda (ref-fn) (funcall ref-fn nil contracted-index)) ref-fns)))))) result)) ;; Flatten a tensor into a rank 0 or 1 tensor (defun tensor-flatten (x) "Returns a flattened tensor along with the dimensions of original tensor so that unflattening is possible." (if (atom x) (values x nil) (let* ((dims (tensor-dimensions x)) (size (product dims)) (result (make-tensor (list size) :type (type-of x)))) (loop for i from 0 below size do (setf (tensor-ref result i) (tensor-flat-ref x i))) (values result dims)))) ;; Unflatten a tensor (defun tensor-unflatten (x dims) "Restores a flattened tensor to its original dimensionality." (if (atom x) x (let* ((size (length x)) (result (make-tensor dims :type (type-of x)))) (loop for i from 0 below size do (setf (tensor-flat-ref result i) (tensor-ref x i))) result)))
17,472
Common Lisp
.lisp
420
31.183333
103
0.572991
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
696bf88b74856b5fba911393938aa7140d9f61977c4cba4fd4aa2d7494511b4a
1,509
[ -1 ]
1,510
package.lisp
ghollisjr_cl-ana/typespec/package.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (defpackage #:cl-ana.typespec (:use :cl :alexandria :cffi :cl-ana.int-char :cl-ana.list-utils :cl-ana.string-utils :cl-ana.symbol-utils :cl-ana.tensor :cl-ana.memoization) (:export :typespec->cffi-type :typespec-foreign-alloc ;; compound typespec utilities: :typespec-compound-p :typespec-compound-field-alist :typespec-compound-field-names :typespec-compound-field-specs ;; array typespec utilities: :typespec-array-p :typespec-array-element-type :typespec-array-dim-list :typespec-array-rank :typespec-array-size ;; A function for setting the values of a foreign object ;; recursively; currently this is not directly provided by ;; CFFI :typespec->lisp-to-c ;; Returns a function which, when applied to a C-pointer, ;; returns a lisp object corresponding to the C object :typespec->c-to-lisp ;; I may decide to use this (with changes) for providing ;; automatic flattening of typespecs so that nested array ;; types can be used as well as directly specifying the ;; rank of a multi-array: :typespec-flatten-arrays ;; Function for handling strings stored as character arrays: :char-vector->string))
2,274
Common Lisp
.lisp
57
33.526316
71
0.656137
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
3261476de7332bca7cc478f54c593c6ed4c51ca7d77d5d8deb4f059dbb415df2
1,510
[ -1 ]
1,511
typespec.lisp
ghollisjr_cl-ana/typespec/typespec.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (in-package :cl-ana.typespec) (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 1))) ;;; Typespec: A typespec (as I'm referring to it) is either ;;; ;;; 1. A symbol denoting the cffi type ;;; ;;; 2. A list with the first element denoting the container type and ;;; the subsequent elements describing the members of the container ;;; type. ;;; ;;; Container types: ;;; ;;; :compound would denote that the type is a structure and the ;;; subsequent elements would be lists of the names and typespecs of ;;; the elements. (This is just the symbol :compound consed onto an ;;; alist mapping names to typespecs.) ;;; ;;; :array would denote that the type is an array type. The following ;;; elements in the typespec list are the typespec of the array ;;; elements and then the size of the array along each dimension as ;;; the rest of the typespec. Note that multidimensional array ;;; typespecs need to be flattened if you intend to use ;;; convert-from-foreign. The function flatten-array-typespec is ;;; provided for this purpose. ;;; ;;; (Note that strings are difficult: C treats character arrays as ;;; strings, and it is farirly seemless to convert between them; ;;; additionally small integers are routinely encoded as characters. ;;; However: Lisp's CFFI treats them differently, and so I have ;;; implemented the following conventions: ;;; ;;; *** Character arrays are converted to Lisp as vectors of integers. ;;; You can apply char-vector->string to convert this raw character ;;; array into a string. ;;; ;;; *** String typespecs should be that of a character array; this is ;;; necessary since most binary storage requires a fixed size for the ;;; data type. The same treatment above is necessary when the string ;;; is being read back into Lisp.) ;;; ;;; Example 1: A structure with integer x and float y: ;;; (:compound ("x" . :int) ("y" . :float)) ;;; ;;; Example 2: A 1-D array of 20 doubles: ;;; (:array :double 20) ;; Creates cstruct types recursively as per the typespec (defun-memoized typespec->cffi-type (typespec) (labels ((make-slot-spec (name-cstruct) (let* ((name (car name-cstruct)) (cstruct (cdr name-cstruct)) (type (if (typespec-array-p cstruct) (typespec-array-element-type cstruct) cstruct)) (count (if (typespec-array-p cstruct) (typespec-array-size cstruct) 1))) ;;(reduce #'* (fourth cstruct))))) ; array type (list (keywordify (intern (string name))) type :count count)))) (if (listp typespec) ;; handle arrays and compound (case (first typespec) ;;(:array typespec) ; not much to do (:array (list :array (typespec->cffi-type (typespec-array-element-type typespec)) (typespec-array-size typespec))) (:compound ;; here's where the fun happens (let* ((names (typespec-compound-field-names typespec)) (specs (typespec-compound-field-specs typespec)) (member-cstructs (mapcar #'typespec->cffi-type specs)) (names-cstructs (zip names member-cstructs)) (slotspecs (mapcar #'make-slot-spec names-cstructs))) ;; I'd like to find a better way to do this, but I have ;; to evaluate slotspecs and gensym and splice them into ;; code which will be evaluated, so a simple macro ;; doesn't seem to work. (eval `(defcstruct ,(gensym) ,@slotspecs))))) typespec))) ; since the symbol types are already known to cffi ;;;; Compound utilities: (defun typespec-compound-p (typespec) "Tests a typespec for being a compound typespec." (when (consp typespec) (equal (first typespec) :compound))) (defun typespec-compound-field-alist (typespec) "Returns the alist mapping field name to typespec." (when (typespec-compound-p typespec) (rest typespec))) (defun typespec-compound-field-names (typespec) "Returns the field names for the compound type." (when (typespec-compound-p typespec) (mapcar #'car (typespec-compound-field-alist typespec)))) (defun typespec-compound-field-specs (typespec) "Returns the typespecs for the fields in the compound type." (when (typespec-compound-p typespec) (mapcar #'cdr (typespec-compound-field-alist typespec)))) ;;;; Array utilities: (defun typespec-array-p (typespec) "Tests a typespec for being an array typespec." (when (consp typespec) (equal (first typespec) :array))) (defun typespec-array-element-type (typespec) "Returns the element type for the array type." (when (typespec-array-p typespec) (second typespec))) (defun typespec-array-dim-list (typespec) "Returns the list of dimension sizes for the array type." (when (typespec-array-p typespec) (rest (rest typespec)))) (defun typespec-array-rank (typespec) "Returns the number of dimensions (rank) of the array type." (when (typespec-array-p typespec) (length (typespec-array-dim-list typespec)))) (defun typespec-array-size (typespec) "Returns the total number of elements in the array type." (when (typespec-array-p typespec) (reduce #'* (typespec-array-dim-list typespec)))) ;; This is for automatically translating vectors into foreign arrays; ;; only works for 1-D at the moment but that is ok. Note that I had ;; to look into the CFFI code to get to this solution, so if they ;; change it significantly this may cease to work. ;; (defmethod translate-to-foreign ((value simple-vector) type) ;; (let* ((size (reduce #'* (cffi::dimensions type))) ;; (element-type (cffi::element-type type)) ;; (result (foreign-alloc element-type :count size))) ;; (loop ;; for i below size ;; do (setf (mem-aref result element-type i) ;; (elt value i))) ;; result)) (defun typespec-flatten-arrays (typespec) "Flattens an array typespec if typespec is an array typespec, otherwise returns typespec unchanged. Note that this operation is recursive, in that if there are arrays in the typespec(s) of the component type(s), then they are flattened as well." (when typespec (if (listp typespec) (cond ((typespec-array-p typespec) (list :array (typespec-flatten-arrays (typespec-array-element-type typespec)) (typespec-array-size typespec))) ((typespec-compound-p typespec) (cons :compound (mapcar (lambda (cons) (cons (car cons) (typespec-flatten-arrays (cdr cons)))) (rest typespec))))) typespec))) (defun typespec-foreign-alloc (typespec &optional (count 1)) "Allocates space for count foreign objects of type specified by typespec." (foreign-alloc (typespec->cffi-type typespec) :count count)) (defun typespec->lisp-to-c (typespec) "Returns a function which takes 1. a lisp object, 2. a corresponding C pointer and sets the fields/values of the C object recursively. The pointer to the C-object is returned." (let ((cstruct (typespec->cffi-type typespec))) (cond ;; Compound types: ((typespec-compound-p typespec) (let ((field-setters (loop for field-spec in (typespec-compound-field-specs typespec) collect (typespec->lisp-to-c field-spec)))) (lambda (plist c-pointer) (do* ((lst plist (rest (rest lst))) (fs (first lst) (first lst)) (fv (second lst) (second lst)) (setter-lst field-setters (rest setter-lst)) (field-setter (first setter-lst) (first setter-lst))) ((or (null lst) (null setter-lst)) c-pointer) (funcall field-setter fv (foreign-slot-pointer c-pointer cstruct fs)))))) ;; Array types: ((typespec-array-p typespec) (let ((element-type (typespec-array-element-type typespec)) (array-size (typespec-array-size typespec))) (if (equal element-type :char) ;; handle strings: (let ((field-setter (typespec->lisp-to-c element-type))) (lambda (tensor c-pointer) (let ((element-converter (if (typep tensor 'string) #'char-code #'identity))) (dotimes (i array-size) (funcall field-setter (funcall element-converter (tensor-flat-ref tensor i)) (mem-aptr c-pointer element-type i)))))) ;; other arrays: (let ((field-setter (typespec->lisp-to-c element-type))) (lambda (tensor c-pointer) (dotimes (i array-size) (funcall field-setter (tensor-flat-ref tensor i) (mem-aptr c-pointer element-type i)))))))) ;; Primitive types: (t (lambda (primitive c-pointer) (setf (mem-aref c-pointer cstruct) primitive)))))) (defun typespec->c-to-lisp (typespec) "Returns a function which takes a c-pointer argument and returns a lisp object containing the converted values." (cond ;; compound ((typespec-compound-p typespec) (multiple-value-bind (field-symbols field-getters) (loop for (field-name . field-spec) in (typespec-compound-field-alist typespec) collecting (keywordify (string field-name)) into field-symbols collecting (typespec->c-to-lisp field-spec) into field-getters finally (return (values field-symbols field-getters))) (let ((cstruct (typespec->cffi-type typespec))) (lambda (c-pointer) (loop for fs in field-symbols for fg in field-getters collecting fs into result collecting (funcall fg (foreign-slot-pointer c-pointer cstruct fs)) into result finally (return result)))))) ;; array ((typespec-array-p typespec) (let* ((element-type (typespec-array-element-type typespec)) (dim-list (typespec-array-dim-list typespec)) ;; these should be used whenever the lisp array version is used: ;; (dim-vector (coerce dim-list 'vector)) ;; (ndims (length dim-list)) (num-elements (typespec-array-size typespec)) (element-cffi-type (typespec->cffi-type element-type)) (element-getter (typespec->c-to-lisp element-type))) ;; function which returns an array of appropriate dimensions ;; with the foreign content. ;; ;; This function is here as an example of how to do this ;; ;; with lisp arrays, faster than using the tensors but at ;; ;; the cost of the tensor functions. ;; ;; (lambda (c-pointer) ;; (let ((result-array ;; (make-array dim-list)) ;; (indices (make-array (list (length dim-vector)) ;; :initial-element 0))) ;; (labels ((inc-indices! () ;; (inc-indices-worker! (1- ndims))) ;; (inc-indices-worker! (inc-index) ;; (if (>= (elt indices inc-index) ;; (1- (elt dim-vector inc-index))) ;; (when (plusp inc-index) ;; (setf (elt indices inc-index) 0) ;; (inc-indices-worker! (1- inc-index))) ;; (incf (elt indices inc-index))))) ;; (loop ;; for i below num-elements ;; do (progn ;; (setf (apply #'aref result-array (coerce indices 'list)) ;; (funcall element-getter ;; (mem-aptr c-pointer ;; element-cffi-type ;; i))) ;; (inc-indices!))) ;; result-array))) (lambda (c-pointer) (let ((result-tensor (make-tensor dim-list))) (loop for i below num-elements do (setf (tensor-flat-ref result-tensor i) (funcall element-getter (mem-aptr c-pointer element-cffi-type i)))) result-tensor)) )) ;; primitive (t (lambda (c-pointer) (mem-aref c-pointer typespec))))) (defun char-vector->string (char-vector &optional length) "Returns a string version of a vector of integers interpreted as the numerical codes for characters. If argument length is given, the result contains only the first length characters, or if length is longer than the char-vector, the char-vector interpreted into a string as if length were not given." (let* ((length (if length (min length (length char-vector)) (length char-vector))) (result (make-string length))) (loop for i from 0 below length for c across char-vector do (setf (elt result i) (int-char c))) result))
14,822
Common Lisp
.lisp
352
33.551136
84
0.590635
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
54e7730575551df0385a0b0b901462ae595c98f7edffa3aaaf4fe3d8eb237d58
1,511
[ -1 ]
1,512
test.lisp
ghollisjr_cl-ana/typespec/test.lisp
;;;; cl-ana is a Common Lisp data analysis library. ;;;; Copyright 2013, 2014 Gary Hollis ;;;; ;;;; This file is part of cl-ana. ;;;; ;;;; cl-ana is free software: you can redistribute it and/or modify it ;;;; under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation, either version 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-ana is distributed in the hope that it will be useful, but ;;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with cl-ana. If not, see <http://www.gnu.org/licenses/>. ;;;; ;;;; You may contact Gary Hollis (me!) via email at ;;;; [email protected] (require 'cl-ana.typespec) (in-package :cl-ana.typespec) (defparameter *ts* '(:compound ("x" . (:array :double 3 3)) ("y" . :string))) (defparameter *struct* '(:x ((1d0 2d0 3d0) (4d0 5d0 6d0) (7d0 8d0 9d0)) :y "hello")) (defparameter *x* (typespec-foreign-alloc *ts*)) (defparameter *lisp->c-converter* (typespec->lisp-to-c *ts*)) (funcall *lisp->c-converter* *struct* *x*) (defparameter *c->lisp-converter* (typespec->c-to-lisp *ts*)) (print (funcall *c->lisp-converter* *x*))
1,410
Common Lisp
.lisp
34
38.588235
70
0.671544
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
1f5528b0b4717b5a82c393178fae81a0381a692e7fb730fa2b3ca5add6034e39
1,512
[ -1 ]
1,513
common.lisp
ghollisjr_cl-ana/hdf-cffi/examples/common.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. (defpackage #:h5ex (:documentation "hdf5-examples: Common helpers for hdf5-cffi examples.") (:use #:cl) (:export close-handle close-handles create-null-dataspace create-scalar-dataspace create-simple-dataspace create-c-string-type create-c-string-type-utf8 create-f-string-type create-f-string-type-utf8 pos2D)) (in-package :h5ex) ;; handles (defun close-handle (hnd) "Close an HDF5 handle" (unless (< 0 (hdf5:h5iis-valid hnd)) (error "Invalid handle found.")) (let ((type (hdf5:h5iget-type hnd))) (cond ((eql type :H5I-ATTR) (hdf5:h5aclose hnd)) ((eql type :H5I-DATASET) (hdf5:h5dclose hnd)) ((eql type :H5I-DATASPACE) (hdf5:h5sclose hnd)) ((eql type :H5I-DATATYPE) (hdf5:h5tclose hnd)) ((eql type :H5I-FILE) (hdf5:h5fclose hnd)) ((eql type :H5I-GENPROP-LST) (hdf5:h5pclose hnd)) ((eql type :H5I-GROUP) (hdf5:h5gclose hnd)) (t (error (format nil "Can't close handle. ~a~%" type)))))) (defun close-handles (handles) (declare (type list handles)) "Close a list of handles" (dolist (h handles) (close-handle h))) ;; dataspaces (defun create-null-dataspace () "Create a null dataspace" (hdf5:h5screate :H5S-NULL)) (defun create-scalar-dataspace () "Create a scalar dataspace" (hdf5:h5screate :H5S-SCALAR)) (defun create-simple-dataspace (dims &optional maxdims) "Create a simple dataspace" ;; list arguments expected (unless (and (consp dims) (listp maxdims)) (error "List arguments expected.")) ;; rank check (when (and maxdims (not (= (list-length dims) (list-length maxdims)))) (error "Rank mismatch in simple dataspace definition.")) (when (or (< (list-length dims) 1) (> (list-length dims) 32)) (error "The dataspace rank must be between 1 and 32.")) ;; element checks (when (some #'(lambda (x) (or (not (integerp x)) (< x 1))) dims) (error "The dimensions must be positive integers.")) (when (and maxdims (some #'(lambda (x) (or (not (integerp x)) (and (not (eql x hdf5:+H5S-UNLIMITED+)) (< x 1)))) maxdims)) (error "The maximum dimensions must be positive integers.")) (when (and maxdims (some #'null (mapcar #'(lambda (x y) (if (eql y hdf5:+H5S-UNLIMITED+) T (<= x y))) dims maxdims))) (error "A dimension must not exceed it's corresponding maximum.")) ;; go (let* ((rank (list-length dims)) (dims-ptr (cffi:foreign-alloc 'hdf5:hsize-t :count rank :initial-contents dims)) (maxdims-ptr (if maxdims (cffi:foreign-alloc 'hdf5:hsize-t :count rank :initial-contents maxdims) hdf5:+NULL+)) (space (hdf5:h5screate-simple rank dims-ptr maxdims-ptr))) (cffi:foreign-free dims-ptr) (when maxdims (cffi:foreign-free maxdims-ptr)) space)) ;; common string datatypes (defun create-c-string-type (&optional length) "Create a C-style string datatype" (when length (unless (and (integerp length) (< 0 length)) (error "Length must be a positive integer."))) (let ((result (hdf5:h5tcopy hdf5:+H5T-C-S1+))) (hdf5:h5tset-size result (if length length hdf5:+H5T-VARIABLE+)) result)) (defun create-c-string-type-utf8 (&optional length) (let ((result (create-c-string-type length))) (hdf5:h5tset-cset result :H5T-CSET-UTF8) result)) (defun create-f-string-type (&optional length) "Create a FORTRAN-style string datatype" (when length (unless (and (integerp length) (< 0 length)) (error "Length must be a positive integer."))) (let ((result (hdf5:h5tcopy hdf5:+H5T-FORTRAN-S1+))) (hdf5:h5tset-size result (if length length hdf5:+H5T-VARIABLE+)) result)) (defun create-f-string-type-utf8 (&optional length) (let ((result (create-f-string-type length))) (hdf5:h5tset-cset result :H5T-CSET-UTF8) result)) ;; array access (defun pos2D (cols i j) (declare (optimize (speed 3) (safety 0))) (declare (fixnum cols i j)) "2D array access function" (the fixnum (+ (the fixnum (* cols i)) j)))
4,906
Common Lisp
.lisp
119
33.310924
78
0.611263
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
66a1b4208f8d1b562bc0552134f6480e009e931e492c1027894f0402d7db251d
1,513
[ -1 ]
1,514
h5ex-d-checksum.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-checksum.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to read and write data to a dataset ;;; using the Fletcher32 checksum filter. The program first ;;; checks if the Fletcher32 filter is available, then if it ;;; is it writes integers to a dataset using Fletcher32, then ;;; closes the file. Next, it reopens the file, reads back ;;; the data, checks if the filter detected an error and ;;; outputs the type of filter and the maximum value in the ;;; dataset to the screen. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api//hdf5-examples/1_8/C/H5D/h5ex_d_checksum.c (in-package :hdf5) (defparameter *FILE* (namestring (merge-pathnames "h5ex_d_checksum.h5" *load-pathname*))) (defparameter *DATASET* "DS1") (defparameter *DIM0* 32) (defparameter *DIM1* 64) (defparameter *CHUNK0* 4) (defparameter *CHUNK1* 8) (cffi:with-foreign-objects ((chunk 'hsize-t 2) (filter-info :unsigned-int 1) (flags :unsigned-int 1) (nelmts 'size-t 1) (wdata :int (* *DIM0* *DIM1*)) (rdata :int (* *DIM0* *DIM1*))) (setf (cffi:mem-aref nelmts 'size-t 0) 0) ;; Check if the Fletcher32 filter is available and can be used for ;; both encoding and decoding. Normally we do not perform error ;; checking in these examples for the sake of clarity, but in this ;; case we will make an exception because this filter is an ;; optional part of the hdf5 library. (if (< (h5zfilter-avail +H5Z-FILTER-FLETCHER32+) 1) (error "Fletcher32 filter not available.")) (h5zget-filter-info +H5Z-FILTER-FLETCHER32+ filter-info) (if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-ENCODE-ENABLED+)) (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-DECODE-ENABLED+))) (error "Fletcher32 filter not available for encoding and decoding.")) ;; Initialize data. (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) ;; Create a new file using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*))) (dcpl (h5pcreate +H5P-DATASET-CREATE+)) ;; Create the dataset using the dataset creation property ;; list. (dset (progn ;; Create the dataset creation property list, add the ;; Fletcher32 filter and set the chunk size. (h5pset-fletcher32 dcpl) (setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0* (cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*) (h5pset-chunk dcpl 2 chunk) ;; Create the chunked dataset. (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+)))) ;; Write the data to the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata) ;; Close and release resources. (h5ex:close-handles (list dset dcpl space))) (h5ex:close-handles (list file fapl)))) ;; Now we begin the read section of this example. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDONLY+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (dcpl (h5dget-create-plist dset)) ;; Retrieve and print the filter type. Here we only retrieve ;; the first filter because we know that we only added one ;; filter. (filter-type (h5pget-filter2 dcpl 0 flags nelmts +NULL+ 0 +NULL+ filter-info))) (format t "Filter type is: ") (cond ((eql filter-type +H5Z-FILTER-DEFLATE+) (format t "H5Z_FILTER_DEFLATE~%")) ((eql filter-type +H5Z-FILTER-SHUFFLE+) (format t "H5Z_FILTER_SHUFFLE~%")) ((eql filter-type +H5Z-FILTER-FLETCHER32+) (format t "H5Z_FILTER_FLETCHER32~%")) ((eql filter-type +H5Z-FILTER-SZIP+) (format t "H5Z_FILTER_SZIP~%")) ((eql filter-type +H5Z-FILTER-NBIT+) (format t "H5Z_FILTER_NBIT~%")) ((eql filter-type +H5Z-FILTER-SCALEOFFSET+) (format t "H5Z_FILTER_SCALEOFFSET~%"))) ;; Read the data using the default properties. ;; Check if the read was successful. Normally we do not perform ;; error checking in these examples for the sake of clarity, but in ;; this case we will make an exception because this is how the ;; fletcher32 checksum filter reports data errors. (if (< (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) 0) (prog2 (h5ex:close-handles (list dcpl dset)) (error "Dataset read failed!"))) ;; Find the maximum value in the dataset, to verify that it was ;; read correctly. (format t "Maximum value in ~a is: ~a~%" *DATASET* (reduce #'max (mapcar #'(lambda (i) (cffi:mem-aref rdata :int i)) (loop for i from 0 to (1- (* *DIM0* *DIM1*)) collect i)))) ;; Close and release resources. (h5ex:close-handles (list dcpl dset))) (h5ex:close-handles (list file fapl)))))
5,857
Common Lisp
.lisp
118
42.271186
104
0.638383
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
9b635e44a37aa76b781eb351bd9da77a9d3a8cfc72711c405f6cd6dacdf46f6f
1,514
[ -1 ]
1,515
h5ex-d-alloc.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-alloc.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to set the space allocation time ;;; for a dataset. The program first creates two datasets, ;;; one with the default allocation time (late) and one with ;;; early allocation time, and displays whether each has been ;;; allocated and their allocation size. Next, it writes data ;;; to the datasets, and again displays whether each has been ;;; allocated and their allocation size. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_alloc.c (in-package :hdf5) (defparameter *FILE* (namestring (merge-pathnames "h5ex_d_alloc.h5" *load-pathname*))) (defparameter *DATASET1* "DS1") (defparameter *DATASET2* "DS2") (defparameter *DIM0* 4) (defparameter *DIM1* 7) (defun print-space-status-et-storage-size (dset name) (cffi:with-foreign-object (space-status 'h5d-space-status-t 1) (h5dget-space-status dset space-status) (format t "Space for ~a has~abeen allocated.~%" name (if (eql :H5D-SPACE-STATUS-ALLOCATED (cffi:mem-ref space-status 'h5d-space-status-t)) " " " not ")) (format t "Storage size for ~a is: ~a bytes.~%" name (h5dget-storage-size dset)))) (cffi:with-foreign-object (wdata :int (* *DIM0* *DIM1*)) ;; initialize data (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (format t "Creating datasets...~%") (format t "~a has allocation time H5D_ALLOC_TIME_LATE~%" *DATASET1*) (format t "~a has allocation time H5D_ALLOC_TIME_EARLY~%~%" *DATASET2*) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*))) (dcpl (h5pcreate +H5P-DATASET-CREATE+)) ;; Create the dataset using the dataset creation property ;; list. (dset1 (h5dcreate2 file *DATASET1* +H5T-STD-I32LE+ space +H5P-DEFAULT+ +H5P-DEFAULT+ +H5P-DEFAULT+)) ;; Set the allocation time to "early". This way we ;; can be sure that reading from the dataset ;; immediately after creation will return the fill value. (dset2 (prog2 (h5pset-alloc-time dcpl :H5D-ALLOC-TIME-EARLY) (h5dcreate2 file *DATASET2* +H5T-STD-I32LE+ space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+)))) ;; Retrieve and print space status and storage size for dset1. (print-space-status-et-storage-size dset1 *DATASET1*) ;; Retrieve and print space status and storage size for dset2. (print-space-status-et-storage-size dset2 *DATASET2*) (format t "~%Writing data...~%~%") ;; Write the data to the datasets (h5dwrite dset1 +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata) (h5dwrite dset2 +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata) ;; Retrieve and print space status and storage size for dset1. (print-space-status-et-storage-size dset1 *DATASET1*) ;; Retrieve and print space status and storage size for dset2. (print-space-status-et-storage-size dset2 *DATASET2*) ;; Close and release resources. (h5ex:close-handles (list dset2 dset1 dcpl space))) (h5ex:close-handles (list file fapl)))))
4,068
Common Lisp
.lisp
77
44.025974
100
0.629499
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
06ab3f5ec141235fc2e538bd45433aeb136907b9f502d05cfd5d162453110f71
1,515
[ -1 ]
1,516
h5ex-d-unlimmod.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-unlimmod.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to create and extend an unlimited ;;; dataset. The program first writes integers to a dataset ;;; with dataspace dimensions of DIM0xDIM1, then closes the ;;; file. Next, it reopens the file, reads back the data, ;;; outputs it to the screen, extends the dataset, and writes ;;; new data to the entire extended dataset. Finally it ;;; reopens the file again, reads back the data, and utputs it ;;; to the screen. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_unlimmod.c (in-package :hdf5) (defparameter *FILE* (namestring (merge-pathnames "h5ex_d_unlimmod.h5" *load-pathname*))) (defparameter *DATASET* "DS1") (defparameter *DIM0* 4) (defparameter *DIM1* 7) (defparameter *EDIM0* 6) (defparameter *EDIM1* 10) (defparameter *CHUNK0* 4) (defparameter *CHUNK1* 4) (defun print-data (data rows cols) (dotimes (i rows) (format t " [") (dotimes (j cols) (format t " ~3d" (cffi:mem-aref data :int (h5ex:pos2D cols i j)))) (format t "]~%"))) (cffi:with-foreign-objects ((dims 'hsize-t 2) (extdims 'hsize-t 2) (chunk 'hsize-t 2) (wdata :int (* *DIM0* *DIM1*)) (wdata2 :int (* *EDIM0* *EDIM1*))) ;; initialize data (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) ;; Create a new file using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*) `(,+H5S-UNLIMITED+ ,+H5S-UNLIMITED+))) ;; Create the dataset creation property list, and set the chunk ;; size. (dcpl (let ((tmp (h5pcreate +H5P-DATASET-CREATE+))) (setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0* (cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*) (h5pset-chunk tmp 2 chunk) tmp)) ;; Create the unlimited dataset. (dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+))) ;; Write the data to the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata) ;; Close and release resources. (h5ex:close-handles (list dcpl dset space))) (h5ex:close-handles (list file fapl)))) ;; In this next section we read back the data, extend the dataset, ;; and write new data to the entire dataset. ;; Open file and dataset using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDWR+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (space (let ((tmp (h5dget-space dset))) (h5sget-simple-extent-dims tmp dims +NULL+) tmp)) (dims[0] (cffi:mem-aref dims 'hsize-t 0)) (dims[1] (cffi:mem-aref dims 'hsize-t 1))) ;; Allocate space for integer data. (cffi:with-foreign-object (rdata :int (* dims[0] dims[1])) ;; Read the data using the default properties (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Output the data to the screen. (format t "Dataset before extension:~%") (print-data rdata dims[0] dims[1])) ;; Extend the dataset. (setf (cffi:mem-aref extdims 'hsize-t 0) *EDIM0* (cffi:mem-aref extdims 'hsize-t 1) *EDIM1*) (h5dset-extent dset extdims) ;; Initialize data for writing to the extended dataset. (dotimes (i *EDIM0*) (dotimes (j *EDIM1*) (setf (cffi:mem-aref wdata2 :int (h5ex:pos2D *EDIM1* i j)) j))) ;; Write the data to the extended dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata2) ;; Close and release resources. (h5ex:close-handles (list space dset))) (h5ex:close-handles (list file fapl)))) ;; Now we simply read back the data and output it to the screen. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDONLY+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (space (let ((tmp (h5dget-space dset))) (h5sget-simple-extent-dims tmp dims +NULL+) tmp)) (dims[0] (cffi:mem-aref dims 'hsize-t 0)) (dims[1] (cffi:mem-aref dims 'hsize-t 1))) ;; Get dataspace and allocate memory for the read buffer as before. (cffi:with-foreign-object (rdata :int (* dims[0] dims[1])) ;; Read the data using the default properties (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Output the data to the screen. (format t "~%Dataset after extension:~%") (print-data rdata *EDIM0* *EDIM1*)) ;; Close and release resources. (h5ex:close-handles (list space dset))) (h5ex:close-handles (list file fapl)))))
5,633
Common Lisp
.lisp
124
39.16129
103
0.636861
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
415ddbdae498fbc1e45a8ea74dc54645289c007f015d3e24e2bd35b115fa35aa
1,516
[ -1 ]
1,517
h5ex-d-unlimgzip.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-unlimgzip.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to create and extend an unlimited ;;; dataset with gzip compression. The program first writes ;;; integers to a gzip compressed dataset with dataspace ;;; dimensions of DIM0xDIM1, then closes the file. Next, it ;;; reopens the file, reads back the data, outputs it to the ;;; screen, extends the dataset, and writes new data to the ;;; extended portions of the dataset. Finally it reopens the ;;; file again, reads back the data, and outputs it to the ;;; screen. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_unlimgzip.c (in-package :hdf5) (defparameter *FILE* (namestring (merge-pathnames "h5ex_d_unlimgzip.h5" *load-pathname*))) (defparameter *DATASET* "DS1") (defparameter *DIM0* 4) (defparameter *DIM1* 7) (defparameter *EDIM0* 6) (defparameter *EDIM1* 10) (defparameter *CHUNK0* 4) (defparameter *CHUNK1* 4) (defun print-data (data rows cols) (dotimes (i rows) (format t " [") (dotimes (j cols) (format t " ~3d" (cffi:mem-aref data :int (h5ex:pos2D cols i j)))) (format t "]~%"))) (cffi:with-foreign-objects ((dims 'hsize-t 2) (extdims 'hsize-t 2) (chunk 'hsize-t 2) (start 'hsize-t 2) (count 'hsize-t 2) (nelmts 'size-t 1) (filter-info :unsigned-int 1) (flags :unsigned-int 1) (wdata :int (* *DIM0* *DIM1*)) (wdata2 :int (* *EDIM0* *EDIM1*))) (setf (cffi:mem-aref nelmts 'size-t 0) 0) ;; Check if gzip compression is available and can be used for both ;; compression and decompression. Normally we do not perform error ;; checking in these examples for the sake of clarity, but in this ;; case we will make an exception because this filter is an ;; optional part of the hdf5 library. (if (< (h5zfilter-avail +H5Z-FILTER-DEFLATE+) 1) (error "gzip filter not available.")) (h5zget-filter-info +H5Z-FILTER-DEFLATE+ filter-info) (if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-ENCODE-ENABLED+)) (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-DECODE-ENABLED+))) (error "gzip filter not available for encoding and decoding.")) ;; initialize data (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) ;; Create a new file using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*) `(,+H5S-UNLIMITED+ ,+H5S-UNLIMITED+))) ;; Create the dataset creation property list, add the gzip ;; compression filter and set the chunk size. (dcpl (let ((tmp (h5pcreate +H5P-DATASET-CREATE+))) (h5pset-deflate tmp 9) (setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0* (cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*) (h5pset-chunk tmp 2 chunk) tmp)) ;; Create the compressed unlimited dataset. (dset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+))) ;; Write the data to the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ wdata) ;; Close and release resources. (h5ex:close-handles (list dcpl dset space))) (h5ex:close-handles (list file fapl)))) ;; In this next section we read back the data, extend the dataset, ;; and write new data to the extended portions. ;; Open file and dataset using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDWR+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (space (let ((tmp (h5dget-space dset))) (h5sget-simple-extent-dims tmp dims +NULL+) tmp)) (dims[0] (cffi:mem-aref dims 'hsize-t 0)) (dims[1] (cffi:mem-aref dims 'hsize-t 1))) ;; Allocate space for integer data. (cffi:with-foreign-object (rdata :int (* dims[0] dims[1])) ;; Read the data using the default properties (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Output the data to the screen. (format t "~%Dataset before extension:~%") (print-data rdata dims[0] dims[1])) (h5sclose space) ;; Extend the dataset. (setf (cffi:mem-aref extdims 'hsize-t 0) *EDIM0* (cffi:mem-aref extdims 'hsize-t 1) *EDIM1*) (h5dset-extent dset extdims) ;; Retrieve the dataspace for the newly extended dataset. (setq space (h5dget-space dset)) ;; Initialize data for writing to the extended dataset. (dotimes (i *EDIM0*) (dotimes (j *EDIM1*) (setf (cffi:mem-aref wdata2 :int (h5ex:pos2D *EDIM1* i j)) j))) ;; Select the entire dataspace. (h5sselect-all space) ;; Subtract a hyperslab reflecting the original dimensions from the ;; selection. The selection now contains only the newly extended ;; portions of the dataset. (setf (cffi:mem-aref start 'hsize-t 0) 0 (cffi:mem-aref start 'hsize-t 1) 0 (cffi:mem-aref count 'hsize-t 0) (cffi:mem-aref dims 'hsize-t 0) (cffi:mem-aref count 'hsize-t 1) (cffi:mem-aref dims 'hsize-t 1)) (h5sselect-hyperslab space :H5S-SELECT-NOTB start +NULL+ count +NULL+) ;; Write the data to the selected portion of the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata2) ;; Close and release resources. (h5ex:close-handles (list space dset))) (h5ex:close-handles (list file fapl)))) ;; Now we simply read back the data and output it to the screen. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDONLY+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (dcpl (h5dget-create-plist dset)) ;; Retrieve and print the filter type. Here we only retrieve ;; the first filter because we know that we only added one ;; filter. (filter-type (prog2 (setf (cffi:mem-aref nelmts 'size-t 0) 0) (h5pget-filter2 dcpl 0 flags nelmts +NULL+ 0 +NULL+ filter-info))) (space (let ((tmp (h5dget-space dset))) (h5sget-simple-extent-dims tmp dims +NULL+) tmp)) (dims[0] (cffi:mem-aref dims 'hsize-t 0)) (dims[1] (cffi:mem-aref dims 'hsize-t 1))) (format t "~%Filter type is: ") (cond ((eql filter-type +H5Z-FILTER-DEFLATE+) (format t "H5Z_FILTER_DEFLATE~%")) ((eql filter-type +H5Z-FILTER-SHUFFLE+) (format t "H5Z_FILTER_SHUFFLE~%")) ((eql filter-type +H5Z-FILTER-FLETCHER32+) (format t "H5Z_FILTER_FLETCHER32~%")) ((eql filter-type +H5Z-FILTER-SZIP+) (format t "H5Z_FILTER_SZIP~%")) ((eql filter-type +H5Z-FILTER-NBIT+) (format t "H5Z_FILTER_NBIT~%")) ((eql filter-type +H5Z-FILTER-SCALEOFFSET+) (format t "H5Z_FILTER_SCALEOFFSET~%"))) ;; Get dataspace and allocate memory for the read buffer as before. (cffi:with-foreign-object (rdata :int (* dims[0] dims[1])) ;; Read the data using the default properties (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Output the data to the screen. (format t "Dataset after extension:~%") (print-data rdata *EDIM0* *EDIM1*)) ;; Close and release resources. (h5ex:close-handles (list space dset))) (h5ex:close-handles (list file fapl)))))
8,225
Common Lisp
.lisp
179
40.083799
104
0.653865
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
ebe6ca5b1e98d9de7724d4cdb1163c159a8bf6d6d6b42365b8d40c4f999e9ebc
1,517
[ -1 ]
1,518
h5ex-d-extern.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-extern.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to read and write data to an ;;; external dataset. The program first writes integers to an ;;; external dataset with dataspace dimensions of DIM0xDIM1, ;;; then closes the file. Next, it reopens the file, reads ;;; back the data, and outputs the name of the external data ;;; file and the data to the screen. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_extern.c (in-package :hdf5) (defvar *FILE* (namestring (merge-pathnames "h5ex_d_extern.h5" *load-pathname*))) (defvar *EXTERNAL* (namestring (merge-pathnames "h5ex_d_extern.data" *load-pathname*))) (defvar *DATASET* "DS1") (defvar *DIM0* 4) (defvar *DIM1* 7) (defvar *NAME-BUF-SIZE* 32) (cffi:with-foreign-objects ((name :char *NAME-BUF-SIZE*) (wdata :int (* *DIM0* *DIM1*)) (rdata :int (* *DIM0* *DIM1*))) ;; Initialize data. (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) ;; Create a new file using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*))) (dcpl (h5pcreate +H5P-DATASET-CREATE+)) (dset (prog2 ;; Create the dataset creation property list, and ;; set the external file. (h5pset-external dcpl *EXTERNAL* 0 +H5F-UNLIMITED+) ;; Create the external dataset (h5dcreate2 file *DATASET* +H5T-STD-I32LE+ space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+)))) ;; Write the data to the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata) ;; Close and release resources. (h5ex:close-handles (list dset dcpl space))) (h5ex:close-handles (list file fapl)))) ;; Now we begin the read section of this example. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDONLY+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (dcpl (h5dget-create-plist dset))) ;; Retrieve and print the name of the external file. Here we ;; manually set the last field in name to null, in case the name of ;; the file is longer than the buffer. (h5pget-external dcpl 0 *NAME-BUF-SIZE* name +NULL+ +NULL+) (setf (cffi:mem-aref name :char (1- *NAME-BUF-SIZE*)) 0) (format t "~a is stored in file: ~a~%" *DATASET* (cffi:foreign-string-to-lisp name)) ;;Read the data using the default properties. (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Output the data to the screen. (format t "~a:~%" *DATASET*) (dotimes (i *DIM0*) (format t " [") (dotimes (j *DIM1*) (format t " ~3d" (cffi:mem-aref rdata :int (h5ex:pos2D *DIM1* i j)))) (format t "]~%")) ;; Close and release resources. (h5ex:close-handles (list dcpl dset))) (h5ex:close-handles (list file fapl)))))
3,783
Common Lisp
.lisp
77
41.974026
101
0.626424
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
2da5fb4a353ea0f67bab6cbd308613e63b849e4bd555b0fc092ef38c9cc840e5
1,518
[ -1 ]
1,519
h5ex-d-nbit.lisp
ghollisjr_cl-ana/hdf-cffi/examples/datasets/h5ex-d-nbit.lisp
;;;; Copyright by The HDF Group. ;;;; All rights reserved. ;;;; ;;;; This file is part of hdf5-cffi. ;;;; The full hdf5-cffi copyright notice, including terms governing ;;;; use, modification, and redistribution, is contained in the file COPYING, ;;;; which can be found at the root of the source code distribution tree. ;;;; If you do not have access to this file, you may request a copy from ;;;; [email protected]. ;;; This example shows how to read and write data to a dataset ;;; using the N-Bit filter. The program first checks if the ;;; N-Bit filter is available, then if it is it writes ;;; integers to a dataset using N-Bit, then closes the file. ;;; Next, it reopens the file, reads back the data, and ;;; outputs the type of filter and the maximum value in the ;;; dataset to the screen. ;;; http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5D/h5ex_d_nbit.c (in-package :hdf5) (defparameter *FILE* (namestring (merge-pathnames "h5ex_d_nbit.h5" *load-pathname*))) (defparameter *DATASET* "DS1") (defparameter *DIM0* 32) (defparameter *DIM1* 64) (defparameter *CHUNK0* 4) (defparameter *CHUNK1* 8) (cffi:with-foreign-objects ((chunk 'hsize-t 2) (filter-info :unsigned-int 1) (flags :unsigned-int 1) (nelmts 'size-t 1) (wdata :int (* *DIM0* *DIM1*)) (rdata :int (* *DIM0* *DIM1*))) (setf (cffi:mem-aref nelmts 'size-t 0) 0) ;; Check if N-Bit compression is available and can be used for both ;; compression and decompression. Normally we do not perform error ;; checking in these examples for the sake of clarity, but in this ;; case we will make an exception because this filter is an ;; optional part of the hdf5 library. (if (< (h5zfilter-avail +H5Z-FILTER-NBIT+) 1) (error "N-Bit filter not available.")) (h5zget-filter-info +H5Z-FILTER-NBIT+ filter-info) (if (or (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-ENCODE-ENABLED+)) (eql 0 (logand (cffi:mem-ref filter-info :unsigned-int) +H5Z-FILTER-CONFIG-DECODE-ENABLED+))) (error "N-Bit filter not available for encoding and decoding.")) ;; Initialize data. (dotimes (i *DIM0*) (dotimes (j *DIM1*) (setf (cffi:mem-aref wdata :int (h5ex:pos2D *DIM1* i j)) (- (* i j) j)))) ;; Create a new file using the default properties. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fcreate *FILE* +H5F-ACC-TRUNC+ +H5P-DEFAULT+ fapl)))) (unwind-protect (let* ((space (h5ex:create-simple-dataspace `(,*DIM0* ,*DIM1*))) ;; Create the datatype to use with the N-Bit filter. It has an ;; uncompressed size of 32 bits, but will have a size of 16 bits ;; after being packed by the N-Bit filter. (dtype (let ((tmp (h5tcopy +H5T-STD-I32LE+))) (h5tset-precision tmp 16) (h5tset-offset tmp 5) tmp)) (dcpl (h5pcreate +H5P-DATASET-CREATE+)) ;; Create the dataset using the dataset creation property ;; list. (dset (progn ;; Create the dataset creation property list, add the ;; N-Bit filter and set the chunk size. (h5pset-nbit dcpl) (setf (cffi:mem-aref chunk 'hsize-t 0) *CHUNK0* (cffi:mem-aref chunk 'hsize-t 1) *CHUNK1*) (h5pset-chunk dcpl 2 chunk) ;; Create the chunked dataset. (h5dcreate2 file *DATASET* dtype space +H5P-DEFAULT+ dcpl +H5P-DEFAULT+)))) ;; Write the data to the dataset. (h5dwrite dset +H5T-NATIVE-INT+ +H5S-ALL+ space +H5P-DEFAULT+ wdata) ;; Close and release resources. (h5ex:close-handles (list dset dcpl dtype space))) (h5ex:close-handles (list file fapl)))) ;; Now we begin the read section of this example. (let* ((fapl (h5pcreate +H5P-FILE-ACCESS+)) (file (prog2 (h5pset-fclose-degree fapl :H5F-CLOSE-STRONG) (h5fopen *FILE* +H5F-ACC-RDONLY+ fapl)))) (unwind-protect (let* ((dset (h5dopen2 file *DATASET* +H5P-DEFAULT+)) (dcpl (h5dget-create-plist dset)) ;; Retrieve and print the filter type. Here we only retrieve ;; the first filter because we know that we only added one ;; filter. (filter-type (h5pget-filter2 dcpl 0 flags nelmts +NULL+ 0 +NULL+ filter-info))) (format t "Filter type is: ") (cond ((eql filter-type +H5Z-FILTER-DEFLATE+) (format t "H5Z_FILTER_DEFLATE~%")) ((eql filter-type +H5Z-FILTER-SHUFFLE+) (format t "H5Z_FILTER_SHUFFLE~%")) ((eql filter-type +H5Z-FILTER-FLETCHER32+) (format t "H5Z_FILTER_FLETCHER32~%")) ((eql filter-type +H5Z-FILTER-SZIP+) (format t "H5Z_FILTER_SZIP~%")) ((eql filter-type +H5Z-FILTER-NBIT+) (format t "H5Z_FILTER_NBIT~%")) ((eql filter-type +H5Z-FILTER-SCALEOFFSET+) (format t "H5Z_FILTER_SCALEOFFSET~%"))) ;; Read the data using the default properties. (h5dread dset +H5T-NATIVE-INT+ +H5S-ALL+ +H5S-ALL+ +H5P-DEFAULT+ rdata) ;; Find the maximum value in the dataset, to verify that it was ;; read correctly. (format t "Maximum value in ~a is: ~a~%" *DATASET* (reduce #'max (mapcar #'(lambda (i) (cffi:mem-aref rdata :int i)) (loop for i from 0 to (1- (* *DIM0* *DIM1*)) collect i)))) ;; Close and release resources. (h5ex:close-handles (list dcpl dset))) (h5ex:close-handles (list file fapl)))))
5,663
Common Lisp
.lisp
117
41.153846
99
0.632808
ghollisjr/cl-ana
196
18
8
GPL-3.0
9/19/2024, 11:25:22 AM (Europe/Amsterdam)
e3afdf0e176d91d40e871874b22c04ef077f2123df9482466b5216e28968c5dd
1,519
[ -1 ]