File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,30 @@ function generate_weights(
90
90
initialise_target_dataframe :: Function = initialise_target_dataframe_scotland_2022,
91
91
make_target_row! :: Function = make_target_row_scotland_2022! ) :: Vector
92
92
93
+ function check_data ( d, nrows, ncols )
94
+ zrows = Int[]
95
+ for r in 1 : nrows
96
+ if sum ( d[r,:] ) == 0
97
+ push! (zrows,r)
98
+ end
99
+ end
100
+ zcols = Int[]
101
+ @assert length (zrows) == 0 " data has all-zero rows for rows $(zrows) "
102
+ for c in 1 : ncols
103
+ if sum ( d[:,c] ) == 0
104
+ push! (zcols,c)
105
+ end
106
+ end
107
+ @assert length (zcols) == 0 " data has all-zero cols $(zcols) "
108
+ end
109
+
93
110
data :: Matrix = make_target_dataset (
94
111
nhhlds,
95
112
initialise_target_dataframe,
96
113
make_target_row! )
97
114
# println( data )
98
- nrows = size ( data )[ 1 ]
99
- ncols = size ( data )[ 2 ]
115
+ nrows, ncols = size ( data )
116
+ check_data ( data, nrows, ncols )
100
117
# # FIXME parameterise this
101
118
initial_weights = ones (nhhlds)* household_total/ nhhlds
102
119
println ( " initial_weights $(initial_weights[1 ]) " )
You can’t perform that action at this time.
0 commit comments