Debian Codegraph @

texmf-dist/tex/latex/lwarp/lwarp-statistics.sty

raw
1 %%
2 %% This is file `lwarp-statistics.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% lwarp.dtx (with options: `statistics')
8 %% This is a generated file.
9 %% Copyright 2016-2026 Brian Dunn
10 %%
11 %% This work may be distributed and/or modified under the
12 %% conditions of the LaTeX Project Public License, either version 1.3
13 %% of this license or (at your option) any later version.
14 %% The latest version of this license is in
15 %% http://www.latex-project.org/lppl.txt
16 %% and version 1.3 or later is part of all distributions of LaTeX
17 %% version 2005/12/01 or later.
18
19 \LWR@ProvidesPackagePass{statistics}[2019/09/29]
20 \ExplSyntaxOn
21 \VerifyCommand[lwarp][statistics]{\__statistics_table_make:nn}
22 {DC8BA2460EA83AE75FA0C0F00E775B5E}
23
24 \StartDefiningTabulars% lwarp, no other changes below
25 \cs_set_protected_nopar:Nn \__statistics_table_make:nn {
26 \int_compare:nT
27 { 0 < \l__statistics_table_maxcols_int
28 = \l__statistics_nbvals_int } {
29 \__statistics_table_end:
30 \tl_use:N \l__statistics_table_sep_tl
31 \__statistics_table_start:
32 }
33 \int_incr:N \l__statistics_nbvals_int
34 \int_incr:N \l__statistics_currange_int
35 \fp_add:Nn \l__statistics_curtotal_fp { #2 }
36 \__statistics_set_if_shown:N \l_tmpa_bool
37 \tl_set:Nx \l_tmpa_tl {
38 \exp_not:n { & \tl_set:Nn \currentcolumn } {
39 \int_use:N \l__statistics_currange_int
40 }
41 }
42 \bool_if:NTF \l_tmpa_bool {
43 \tl_put_right:Nn \l_tmpa_tl
44 {\__statistics_table_shown_format:n}
45 }{
46 \tl_put_right:Nn \l_tmpa_tl
47 {\__statistics_table_hidden_format:n}
48 }
49 \seq_put_right:Nn \l__statistics_store_values_seq { #1 }
50 \bool_if:NT \l__statistics_table_values_bool {
51 \tl_put_right:Nx \l__statistics_table_values_tl {
52 \exp_not:V \l_tmpa_tl {
53 \exp_not:n {
54 \__statistics_table_values_format:n { #1 }
55 }
56 }
57 }
58 }
59 \seq_put_right:Nx \l__statistics_store_counts_seq { \fp_eval:n {#2} }
60 \bool_if:NT \l__statistics_table_counts_bool {
61 \tl_put_right:Nx \l__statistics_table_counts_tl {
62 \exp_not:V \l_tmpa_tl {
63 \exp_not:n {
64 \__statistics_table_counts_format:n {
65 { \__statistics_table_allcounts_format:n { #2 } }
66 }
67 }
68 }
69 }
70 }
71 \bool_if:NT \l__statistics_table_icc_bool {
72 \tl_put_right:Nx \l__statistics_table_icc_tl {
73 \exp_not:V \l_tmpa_tl {
74 \exp_not:n { \__statistics_table_icc_format:n }
75 {
76 \exp_not:n{ \__statistics_table_allcounts_format:n }
77 { \fp_use:N \l__statistics_curtotal_fp }
78 }
79 }
80 }
81 }
82 \bool_if:NT \l__statistics_table_dcc_bool {
83 \tl_put_right:Nx \l__statistics_table_dcc_tl {
84 \exp_not:V \l_tmpa_tl {
85 \exp_not:n { \__statistics_table_dcc_format:n }
86 {
87 \exp_not:n{ \__statistics_table_allcounts_format:n }
88 {
89 \fp_eval:n {
90 \l__statistics_total_fp
91 - \l__statistics_curtotal_fp
92 + #2
93 }
94 }
95 }
96 }
97 }
98 }
99 \fp_set:Nn \l__statistics_table_curICF_fp {
100 round(\l__statistics_curtotal_fp
101 / \l__statistics_total_fp,
102 \l__statistics_table_round_int)
103 }
104 \bool_if:NT \l__statistics_table_frequencies_bool {
105 \tl_put_right:Nx \l__statistics_table_frequencies_tl {
106 \exp_not:V \l_tmpa_tl {
107 \exp_not:n { \__statistics_table_frequencies_format:n }
108 {
109 \exp_not:n{ \__statistics_table_allfreqs_format:n }
110 {
111 \fp_eval:n {
112 \l__statistics_table_curICF_fp
113 - \l__statistics_table_prevICF_fp
114 }
115 }
116 }
117 }
118 }
119 }
120 \bool_if:NT \l__statistics_table_icf_bool {
121 \tl_put_right:Nx \l__statistics_table_icf_tl {
122 \exp_not:V \l_tmpa_tl {
123 \exp_not:n { \__statistics_table_icf_format:n }
124 {
125 \exp_not:n{ \__statistics_table_allfreqs_format:n }
126 { \fp_to_decimal:N \l__statistics_table_curICF_fp }
127 }
128 }
129 }
130 }
131 \bool_if:NT \l__statistics_table_dcf_bool {
132 \tl_put_right:Nx \l__statistics_table_dcf_tl {
133 \exp_not:V \l_tmpa_tl {
134 \exp_not:n { \__statistics_table_dcf_format:n }
135 {
136 \exp_not:n{ \__statistics_table_allfreqs_format:n }
137 {
138 \fp_eval:n {
139 1 - \l__statistics_table_prevICF_fp
140 }
141 }
142 }
143 }
144 }
145 }
146 \fp_set_eq:NN
147 \l__statistics_table_prevICF_fp
148 \l__statistics_table_curICF_fp
149 }
150 \StopDefiningTabulars% lwarp
151
152 \VerifyCommand[lwarp][statistics]{\__statistics_table_end:}
153 {B2F9FC5A36B44E6E06A8D9807FCBAA6D}
154
155 \cs_set_protected_nopar:Nn \__statistics_table_end: {
156 \tl_set:Nx \l__statistics_table_preamble_tl {
157 \exp_not:n {\begin{tabular}[ }% lwarp
158 \exp_not:V \l__statistics_table_valign_tl
159 \exp_not:n { ] }
160 { \exp_not:V \l__statistics_table_headcoltype_tl
161 \prg_replicate:nn { \l__statistics_nbvals_int }
162 { \exp_not:V \l__statistics_table_coltype_tl } }
163 }
164 \seq_clear:N \l__statistics_table_contents_seq
165 \clist_map_inline:nn { values, counts, icc, dcc, frequencies, icf, dcf } {
166 \bool_if:cT { l__statistics_table_##1_bool } {
167 \seq_put_right:Nv
168 \l__statistics_table_contents_seq
169 { l__statistics_table_##1_tl }
170 }
171 }
172 \tl_use:N \l__statistics_table_preamble_tl
173 \hline% lwarp
174 \seq_use:Nn
175 \l__statistics_table_contents_seq
176 { \l__statistics_table_newline_tl }
177 \\
178 \hline% lwarp
179 \end{tabular}% lwarp
180 }
181
182 \VerifyCommand[lwarp][statistics]{\__statistics_table_start:}
183 {624FAC0783057B481861D9F02764F6C5}
184
185 \cs_set_protected_nopar:Nn \__statistics_table_start: {
186 \int_zero:N \l__statistics_nbvals_int
187 \clist_pop:NNT \l__statistics_table_maxcols_clist \l_tmpa_tl {
188 \int_set:Nn \l__statistics_table_maxcols_int { \l_tmpa_tl }
189 }
190 \clist_map_inline:nn { values, counts, frequencies, icc, icf, dcc, dcf } {
191 \tl_set:cx { l__statistics_table_##1_tl } {
192 \exp_not:N \hbox {
193 \exp_not:c { l__statistics_table_##1_name_tl }
194 }
195 }
196 }
197 }
198
199 \VerifyCommand[lwarp][statistics]{\__statistics_IN:w}
200 {DD1B22587CFB4DEDBEE4D8E9A1E0CCAF}
201
202 \RenewDocumentCommand \__statistics_IN:w { m u{;} u{;} m } {
203 #1 #2 ; #3 #4% lwarp
204 }
205
206 \__statistics_setup:nn { table } {
207 values/format = {#1},% lwarp
208 }
209 \VerifyCommand[lwarp][statistics]{\StatsGraph}
210 {998267D2E90514DBDFD5544FB69AD6C8}
211
212 \RenewDocumentCommand \StatsGraph { +O{} +m +O{} } {
213 \group_begin:
214 \int_gincr:N \g__statistics_graph_last_int
215 \tl_set:Nx \l_tmpa_tl {
216 \exp_not:n { g__statistics_graph_xstep_ }
217 \int_use:N \g__statistics_graph_last_int
218 \exp_not:n { _tl }
219 }
220 \tl_if_exist:cTF { \l_tmpa_tl } {
221 \fp_gset:Nn \g__statistics_graph_xstep_fp
222 { \tl_use:c {\l_tmpa_tl} }
223 }{
224 \fp_gset:Nn \g__statistics_graph_xstep_fp { \c_one_int }
225 }
226 \__statistics_setup:nn { graph } { #1, #3 }
227 \tl_if_single:nTF { #2 } {
228 \cs_if_exist:NF #2 { #2 }
229 \tl_set_eq:NN \l__statistics_data_tl #2
230 }{
231 \tl_set:Nn \l__statistics_data_tl { #2 }
232 }
233 \fp_zero:N \l__statistics_graph_maxheight_fp
234 \fp_set:Nn \l__statistics_graph_minvalue_fp {inf}
235 \fp_set:Nn \l__statistics_graph_maxvalue_fp {-inf}
236 \fp_zero:N \l__statistics_total_fp
237 \int_zero:N \l__statistics_nbvals_int
238 \bool_set_true:N \l__statistics_graph_allranges_bool
239 \keyval_parse:NNV
240 \__statistics_graph_prepare:n
241 \__statistics_graph_prepare:nn
242 \l__statistics_data_tl
243 \tl_clear:N \l__statistics_graph_tikzdata_tl
244 \tl_clear:N \l__statistics_graph_tikzinfo_tl
245 \int_zero:N \l__statistics_currange_int
246 \bool_if:NTF \l__statistics_graph_allranges_bool {
247 \bool_if:NTF \l__statistics_graph_cumulative_bool {
248 \ExplSyntaxOn% lwarp
249 \__statistics_graph_dopicture_cumulative:
250 \ExplSyntaxOff% lwarp
251 }{
252 \ExplSyntaxOn% lwarp
253 \__statistics_graph_dopicture_hist:
254 \ExplSyntaxOff% lwarp
255 }
256 }{
257 \ExplSyntaxOn% lwarp
258 \__statistics_graph_dopicture_comb:
259 \ExplSyntaxOff% lwarp
260 }
261 \iow_now:Nx \@auxout {
262 \exp_not:n {
263 \ExplSyntaxOn
264 \tl_gset:cn
265 }
266 {
267 \exp_not:n {g__statistics_graph_xstep_}
268 \int_use:N \g__statistics_graph_last_int
269 \exp_not:n {_tl}
270 }
271 {
272 \fp_to_decimal:N \g__statistics_graph_xstep_fp
273 }
274 \exp_not:n {
275 \ExplSyntaxOff
276 }
277 }
278 \group_end:
279 }
280
281 \ExplSyntaxOff
282 \endinput
283 %%
284 %% End of file `lwarp-statistics.sty'.