Ticket #9779 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Stitch1D special values

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: critical Milestone: Release 3.2
Component: Reflectometry Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Reuter

Description

Message from Tim:

It looks like most of my problems with stitching boils down to how NaN’s and Inf’s are handled. Is there a way to disregard them when calculating the scale factors but propagate them in the final data for consistency?  This way they would not  block the scaling or visualization of the rest of the curve.

Yes. This could either be done by throwing those values away, or using ReplaceSpecialValues.

Change History

comment:1 Changed 6 years ago by Owen Arnold

This doesn't work but should

import numpy
goodx = numpy.array([0.0, 1.0, 2.0,  3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
goody = numpy.array([0.8, 0.7, 0.6,  0.5, 0.4, 0.3, 0.2, 0.1, 0.0])
bady = numpy.array([0.7, 0.6,  0.5, 0.4, float('nan'), 0.2, 0.1, 0.0, -0.1])


ws1 = CreateWorkspace(DataX=goodx, DataY=goody)
ws2 = CreateWorkspace(DataX=goodx, DataY=bady)

stitched, sf = Stitch1D(ws1, ws2, Params=1.0, StartOverlap=3.0, EndOverlap=6.0)

plotSpectrum([ws1, ws2, stitched], 0)

This does work

import numpy
goodx = numpy.array([0.0, 1.0, 2.0,  3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
goody = numpy.array([0.8, 0.7, 0.6,  0.5, 0.4, 0.3, 0.2, 0.1, 0.0])
bady = numpy.array([0.7, 0.6,  0.5, 0.4, 0.3, 0.2, 0.1, 0.0, -0.1])


ws1 = CreateWorkspace(DataX=goodx, DataY=goody)
ws2 = CreateWorkspace(DataX=goodx, DataY=bady)

stitched, sf = Stitch1D(ws1, ws2, Params=1.0, StartOverlap=3.0, EndOverlap=6.0)

plotSpectrum([ws1, ws2, stitched], 0)


Last edited 6 years ago by Owen Arnold (previous) (diff)

comment:2 Changed 6 years ago by Nick Draper

  • Status changed from new to assigned

comment:3 Changed 6 years ago by Owen Arnold

  • Status changed from assigned to inprogress

refs #9779. Add failing tests.

Changeset: 4fd0fbe94eb9a2b6c08ed74fb82fd65e61af5156

comment:4 Changed 6 years ago by Owen Arnold

refs #9779. Make fix using ReplaceSpecialValues.

Changeset: e3061c3c055134559616383b6e3c9374be4cc119

comment:5 Changed 6 years ago by Owen Arnold

Tester:

The script below should print a real-number scale factor. This would not work previously.

import numpy
goodx = numpy.array([0.0, 1.0, 2.0,  3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
goody = numpy.array([0.8, 0.7, 0.6,  0.5, 0.4, 0.3, 0.2, 0.1, 0.0])
bady = numpy.array([0.7, 0.6,  0.5, 0.4, float('NaN'), 0.2, 0.1, 0.0, -0.1])


ws1 = CreateWorkspace(DataX=goodx, DataY=goody)
ws2 = CreateWorkspace(DataX=goodx, DataY=bady)

stitched, sf = Stitch1D(ws1, ws2, Params=1.0, StartOverlap=3.0, EndOverlap=6.0)

plotSpectrum([ws1, ws2, stitched], 0)

print sf

Unit tests have been added to cover this functionality.

comment:6 Changed 6 years ago by Owen Arnold

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:7 Changed 6 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester set to Michael Reuter

comment:8 Changed 6 years ago by Michael Reuter

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/9779_stitch_special_values'

Full changeset: 2288c1865ecb5a083d3da9ce131ebd0b104dc20b

comment:9 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10621

Note: See TracTickets for help on using tickets.