Ticket #9082 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Copy instrument parameters does not work if Instrument_Parameter_XXX.xml files have different validity scopes

Reported by: Alex Buts Owned by: Alex Buts
Priority: critical Milestone: Release 3.2
Component: Framework Keywords:
Cc: anders.markvardsen@…, martyn.gigg@… Blocked By:
Blocking: #9364 Tester: Karl Palmen

Description (last modified by Alex Buts) (diff)

Assume you have LET_Definition.xml file and LET_Parameters.xml file valid for now and LET_Definition_2to7.xml file and LET_Parameters_2to7.xml file valid in the past (these files are attached to the ticket.)

CopyInstrumentParameters algorithm then nullifies instrument parameters map as illustrated by the scrip below (the files used by this script are in SystemTests->Data folder.

This may be reasonable behaviour in some situations but not in the one illustrated by the script -- if this is the case, a parameter explicitly requesting overwriting parameter map should be introduced.

wb= LoadRaw(Filename='LET0000'+str(5545)+'.raw');
iwb = wb.getInstrument();
print '**************** Wanadium parameters : \n',iwb.getParameterNames();
print ' monitor 1: ',iwb.getParameterType('ei-mon1-spec'),' number =',iwb.getIntParameter('ei-mon1-spec')
fname='LET0000'+str(14305)+'.nxs'
w1,w1_monitors=Load(Filename=fname,OutputWorkspace='w1',LoadMonitors='1');
iws = w1.getInstrument();
print '**************** Run parameters : \n',iws.getParameterNames();
print ' monitor 1: ',iws.getParameterType('ei-mon1-spec'),' number =',iws.getIntParameter('ei-mon1-spec')

CopyInstrumentParameters(InputWorkspace=wb,OutputWorkspace=w1)

w1=mtd['w1'];
iws = w1.getInstrument();
print '**************** Run calibrated parameters : \n',iws.getParameterNames();


Attachments

LET_Definition.xml (25.2 KB) - added by Alex Buts 7 years ago.
LET_Parameters.xml (15.2 KB) - added by Alex Buts 7 years ago.
LET_Definition_dr2to7.xml (25.2 KB) - added by Alex Buts 7 years ago.
LET_Parameters_dr2to7.xml (15.2 KB) - added by Alex Buts 7 years ago.

Change History

Changed 7 years ago by Alex Buts

Changed 7 years ago by Alex Buts

Changed 7 years ago by Alex Buts

Changed 7 years ago by Alex Buts

comment:1 Changed 7 years ago by Alex Buts

  • Cc anders.markvardsen@…, martyn.gigg@… added
  • Description modified (diff)

comment:2 Changed 7 years ago by Nick Draper

  • Owner set to Alex Buts
  • Status changed from new to assigned
  • Milestone changed from Backlog to Release 3.2

Sample output from the example above

**************** Wanadium parameters : 
set('DelayTime','TubePressure','TubeThickness','abs_units_van_range','apply_detector_eff','apply_kikf_correction','background_range','bkgd-range-max','bkgd-range-min','check_background','data_file_ext','deltaE-mode','det_cal_file','diag_background_test_range','diag_bleed_maxrate','diag_bleed_pixels','diag_bleed_test','diag_huge','diag_samp_hi','diag_samp_lo','diag_samp_sig','diag_samp_zero','diag_spectra','diag_tiny','diag_van_hi','diag_van_lo','diag_van_out_hi','diag_van_out_lo','diag_van_sig','diag_variation','ei-mon1-spec','ei-mon2-spec','ei_mon_spectra','fixei','hard_mask_file','map_file','mask_run','mono_correction_factor','monovan_hi_bound','monovan_hi_frac','monovan_hi_value','monovan_lo_bound','monovan_lo_frac','monovan_lo_value','monovan_mapfile','norm-mon1-max','norm-mon1-min','norm-mon1-spec','norm_mon_integration_range','normalise_method','run_diagnostics','sample_mass','sample_rmm','save_and_reuse_masks','save_format','scale-factor','sum_runs','synonims','use_hard_mask_only','use_sam_msk_on_monovan','vanadium-mass','wb-integr-max','wb-integr-min','wb-scale-factor','wb_integr_range')
 monitor 1:  int  number = [40966]
**************** Run parameters : 
set('DelayTime','TubePressure','TubeThickness','abs_units_van_range','apply_detector_eff','apply_kikf_correction','background_range','bkgd-range-max','bkgd-range-min','check_background','data_file_ext','deltaE-mode','det-pos-source','det_cal_file','diag_background_test_range','diag_bleed_maxrate','diag_bleed_pixels','diag_bleed_test','diag_huge','diag_samp_hi','diag_samp_lo','diag_samp_sig','diag_samp_zero','diag_spectra','diag_tiny','diag_van_hi','diag_van_lo','diag_van_out_hi','diag_van_out_lo','diag_van_sig','diag_variation','ei-mon1-spec','ei-mon2-spec','ei_mon_spectra','fixei','hard_mask_file','map_file','mask_run','mono_correction_factor','monovan_hi_bound','monovan_hi_frac','monovan_hi_value','monovan_lo_bound','monovan_lo_frac','monovan_lo_value','monovan_mapfile','norm-mon1-max','norm-mon1-min','norm-mon1-spec','norm_mon_integration_range','normalise_method','run_diagnostics','sample_mass','sample_rmm','save_and_reuse_masks','save_format','scale-factor','sum_runs','synonims','use_hard_mask_only','use_sam_msk_on_monovan','vanadium-mass','wb-integr-max','wb-integr-min','wb-scale-factor','wb_integr_range')
 monitor 1:  int  number = [40966]
**************** Run calibrated parameters : 
set('DelayTime','TubePressure','TubeThickness','abs_units_van_range','apply_detector_eff','apply_kikf_correction','background_range','bkgd-range-max','bkgd-range-min','check_background','data_file_ext','deltaE-mode','det_cal_file','diag_background_test_range','diag_bleed_maxrate','diag_bleed_pixels','diag_bleed_test','diag_huge','diag_samp_hi','diag_samp_lo','diag_samp_sig','diag_samp_zero','diag_spectra','diag_tiny','diag_van_hi','diag_van_lo','diag_van_out_hi','diag_van_out_lo','diag_van_sig','diag_variation','ei-mon1-spec','ei-mon2-spec','ei_mon_spectra','fixei','hard_mask_file','map_file','mask_run','mono_correction_factor','monovan_hi_bound','monovan_hi_frac','monovan_hi_value','monovan_lo_bound','monovan_lo_frac','monovan_lo_value','monovan_mapfile','norm-mon1-max','norm-mon1-min','norm-mon1-spec','norm_mon_integration_range','normalise_method','run_diagnostics','sample_mass','sample_rmm','save_and_reuse_masks','save_format','scale-factor','sum_runs','synonims','use_hard_mask_only','use_sam_msk_on_monovan','vanadium-mass','wb-integr-max','wb-integr-min','wb-scale-factor','wb_integr_range')
---------------------------------------------------------------------------
Mon 3. Mar 11:00:31 2014: Script execution finished.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Mon 3. Mar 11:05:55 2014: Script execution started.
---------------------------------------------------------------------------
**************** Wanadium parameters : 
set('DelayTime','TubePressure','TubeThickness','abs_units_van_range','apply_detector_eff','apply_kikf_correction','background_range','bkgd-range-max','bkgd-range-min','check_background','data_file_ext','deltaE-mode','det_cal_file','diag_background_test_range','diag_bleed_maxrate','diag_bleed_pixels','diag_bleed_test','diag_huge','diag_samp_hi','diag_samp_lo','diag_samp_sig','diag_samp_zero','diag_spectra','diag_tiny','diag_van_hi','diag_van_lo','diag_van_out_hi','diag_van_out_lo','diag_van_sig','diag_variation','ei-mon1-spec','ei-mon2-spec','ei_mon_spectra','fixei','hard_mask_file','map_file','mask_run','mono_correction_factor','monovan_hi_bound','monovan_hi_frac','monovan_hi_value','monovan_lo_bound','monovan_lo_frac','monovan_lo_value','monovan_mapfile','norm-mon1-max','norm-mon1-min','norm-mon1-spec','norm_mon_integration_range','normalise_method','run_diagnostics','sample_mass','sample_rmm','save_and_reuse_masks','save_format','scale-factor','spectra_to_monitors_list','sum_runs','synonims','use_hard_mask_only','use_sam_msk_on_monovan','vanadium-mass','wb-integr-max','wb-integr-min','wb-scale-factor','wb_integr_range')
 monitor 1:  int  number = [40966]
**************** Run parameters : 
set('abs_units_van_range','apply_detector_eff','apply_kikf_correction','background_range','bkgd-range-max','bkgd-range-min','check_background','data_file_ext','deltaE-mode','det-pos-source','det_cal_file','diag_background_test_range','diag_bleed_maxrate','diag_bleed_pixels','diag_bleed_test','diag_huge','diag_samp_hi','diag_samp_lo','diag_samp_sig','diag_samp_zero','diag_spectra','diag_tiny','diag_van_hi','diag_van_lo','diag_van_out_hi','diag_van_out_lo','diag_van_sig','diag_variation','ei-mon1-spec','ei-mon2-spec','ei_mon_spectra','fixei','hard_mask_file','map_file','mask_run','mono_correction_factor','monovan_hi_bound','monovan_hi_frac','monovan_hi_value','monovan_lo_bound','monovan_lo_frac','monovan_lo_value','monovan_mapfile','norm-mon1-max','norm-mon1-min','norm-mon1-spec','norm_mon_integration_range','normalise_method','run_diagnostics','sample_mass','sample_rmm','save_and_reuse_masks','save_format','scale-factor','spectra_to_monitors_list','sum_runs','synonims','use_hard_mask_only','use_sam_msk_on_monovan','vanadium-mass','wb-integr-max','wb-integr-min','wb-scale-factor','wb_integr_range')
 monitor 1:  int  number = [57350]
**************** Run calibrated parameters : 
set()

comment:3 Changed 6 years ago by Alex Buts

  • Status changed from assigned to inprogress

refs #9082 the changes which illustrate the problem

will be replaced back later on.

Changeset: 0aad7348de4588cf80ba38b82fc7a2d3bd450d04

comment:4 Changed 6 years ago by Alex Buts

refs #9082 Unit test illustrating the problem

Changeset: ba8d014a683f8da603a985f1336a877e8dcd3d56

comment:5 Changed 6 years ago by Alex Buts

refs #9082 Intermediate checkout.

fighting with instrument components/etc.

Changeset: 285f66bed0dbfbf1b1f42fa8c6dab384c5d8975d

comment:6 Changed 6 years ago by Alex Buts

refs #9082 Intermediate checkout

Should compile, but copying algorithm is incomplete&needs a bit more thinking.

Changeset: 5977de5c3f25d7a34182dba82287547f63e1c4c6

comment:7 Changed 6 years ago by Alex Buts

refs #9082 Intermediate checkout

Test for desired behavior and some simplification in CopyInstrumentParameters algorithm (will need further improvement)

Changeset: 1ec7c45653e4e9206b463224005df106959f7c58

comment:8 Changed 6 years ago by Alex Buts

refs #9082 Ineffective but working version

Changeset: a3568f2d924b88f0fe630b704907e152a52ce542

comment:9 Changed 6 years ago by Alex Buts

refs #9082 Unit test for new instrument method

Changeset: 86472a1f413581d3161dcc1438b01c161c0d150a

comment:10 Changed 6 years ago by Alex Buts

refs #9082 removed methods which were not finally used

Changeset: 6da8a608286395364dc3ff9fbb1abab799201b02

comment:11 Changed 6 years ago by Alex Buts

refs #9082 Trivial change should fix at least some failing tests

Changeset: 0b5b339e23c075e8e30ad9299aa67978b2b76f61

comment:12 Changed 6 years ago by Alex Buts

refs #9082 Returned old LAT definition and LET parameters

Changeset: 57e839efcab0239c8d6753b5a2cf38c2e9be7d86

comment:13 Changed 6 years ago by Alex Buts

  • Blocking 9364 added

comment:14 Changed 6 years ago by Alex Buts

refs #9082 fixed problem with detector in instrument ParameterMap

Changeset: 297694998d6ee54866937176ce090e188cd09980

comment:15 Changed 6 years ago by Alex Buts

refs #9082 Unix compilation error

Changeset: b2313477c55d05cb888026cfdd76a24078b75150

comment:16 Changed 6 years ago by Alex Buts

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

The essence of the ticket is to modify CopyInstrimentParameters to accept different base instruments. And different base instruments are build at loading when Instrument_Parameter.xml files have different validity scopes. In the script example above, these come from nexus file vs IDF.xml file.

The new behaviour is demonstrated by modified unit test for CopyInstrumentParameters working with different instruments.

Script above works now and produces expected results (copied instrument parameters appear on target instrument). The instrument parameters present on the instrument earlier are rejected completely (see unit test for proof of this)

Code effectiveness is addressed by follow-up ticket #9364.

comment:17 Changed 6 years ago by Karl Palmen

  • Status changed from verify to verifying
  • Tester set to Karl Palmen

comment:18 Changed 6 years ago by Karl Palmen

Code review shows some commented out code, which I expect will be fixed in ticket #9364.

Script works (after copying files to my default folder).

Unit test appears to be good.

comment:19 Changed 6 years ago by Karl Palmen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/9082_IDFandCopyIDF'

Full changeset: 8f9b079b01d2c281b3f775d0a2a522682f49b536

comment:20 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9925

Note: See TracTickets for help on using tickets.