Closed aviL221 closed 3 months ago
Yes, I've encountered this error as I've made other calculators.
The issue arises from the fact that when documents are converted to JSON and back, vectors that are not character arrays are always turned into columns. The best solution is to actually edit the calculator so that vectors are made as columns, so there is no difference between how they are at creation and how they come back after being read from the database or JSON file.
You can use vlt.data.column(v)
to convert a vector v
into a column (or leave it unchanged if it is already a column). One just has to make sure not to treat matrixes this way (or they will be smooshed into a column). So only the vector data should be put through vlt.data.column
.
When you fix it, you can close the issue. You can also reference the issue in your commit by saying something like:
commit -am "changed vectors to columns in output of contrast_calc; closes #25"
I ran the following on the command line:
[b,errormsg,b_expected,doc_output,doc_expected_output] = contrast_tuning_calc.test('standard',1,1);
While b_expected was 1, b was 0. Errormsg contained 17 errors. Most were of the variety "Arrays of insert_field are not the same size". I compared doc_output and doc_expected_output by comparing the fields ofdoc_output.document_properties.contrast_tuning
anddoc_expected_output.document_properties.contrast_tuning
. The dimensions of fields indoc_output.document_properties.contrast_tuning.fit
anddoc_expected_output.document_properties.contrast_tuning.fit
are flipped - that is, the row vectors in one are column vectors in the other, and vice versa. This seems to be interpreted by ndi.calc.vis.contrast_tuning/compare_mock_docs as having arrays of different size. The dimensions of fields indoc_output.document_properties.contrast_tuning.tuning_curve
anddoc_expected_output.document_properties.contrast_tuning.tuning_curve
are also flipped - except for one field:doc_output.document_properties.contrast_tuning.tuning_curve.individual
is a 1x10 cell array, whiledoc_expected_output.document_properties.contrast_tuning.tuning_curve.individual
is a 10x10 array of type double. Hence, these are also interpreted as arrays of different sizes.