Opened 3 years ago

Closed 3 years ago

#276 closed enhancement (fixed)

Provide better error message when CanSAS file has invalid units

Reported by: smk78 Owned by:
Priority: major Milestone: SasView 3.1.0
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

Currently, if a CanSAS file with unsupported units is loaded into
SasView? - for example, <I unit="count"> where "count" is not defined
in the standard - the following error message is returned when one
attempts to plot/fit the data:

'Plotting Error: Plottable.View: Given y and x are not of the same
length'

This is confusing (as it insinuates either Q or I data is missing)
but also draws attention away from the underlying problem.

Some form of syntactic checking is required and failure should respond
with a sensible error message.

Attachments (1)

xg022435_001.xml (21.6 KB) - added by krzywon 3 years ago.
Adrian's data file this ticket is based off of.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 3 years ago by smk78

ARR (who reported the above bug) adds:

My real point is there seems to be no strong reason for SasView? to reject canSAS data files that do not conform if it could read them. A warning might help people but rejection if a more useful path is feasible seems to be likely to put off users.

SMK78 holds the view that:

If the SasView? loader is rejecting (leaving aside how gracefully it is doing so) canSAS format data that isn't actually compliant with the agreed standard then it is doing its job! Otherwise, why have a standard?! If people see a need to wrap non-compliant data in the canSAS format then the proper course of action should surely be to discuss possible extensions of the format with canSAS, rather than request arbitrary adaptions of SasView??

comment:2 Changed 3 years ago by butler

  • Milestone changed from SasView Next Release +1 to SasView 3.1

Changed 3 years ago by krzywon

Adrian's data file this ticket is based off of.

comment:3 Changed 3 years ago by krzywon

  • Resolution set to fixed
  • Status changed from new to closed

To accommodate better error reporting, I modified the data_loader 'plugin' to give better errors. The data_loader now reads the Data(1/2)D.errors list and reports the errors within the console log. These errors are independent of incorrect format errors that preclude the data from loading. By doing this, data can be loaded but with certain caveats. TO tell the user, a warning box pops up whether or not the data set was loaded.

To make the CanSAS reader more robust, I added the ability to load data with *ANY* units regardless of the specification. The above actions occur when invalid units are given but the data are available to be plotted and fit.

Example console log error:
"""
Errors occurred while loading xg022435_001.xml
The data file loaded but with errors.
Error: CanSAS reader: unexpected "I" unit [count]; expecting [1/cm]
"""

Note: See TracTickets for help on using tickets.