From 094936c0b740505d8385eb1f513f0d3fc7298a75 Mon Sep 17 00:00:00 2001 From: "Gonzalez, Miguel" Date: Fri, 2 Aug 2019 11:53:23 +0200 Subject: [PATCH] Changes to handle D16 calling straight_2d with no datp.z. Extra comments in lamp_reading_unit_test --- lamp_mac/D2B/straight_2d.pro | 12 +++--------- test_unit/lamp_reading_unit_test.pro | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lamp_mac/D2B/straight_2d.pro b/lamp_mac/D2B/straight_2d.pro index 5d3d544..9324426 100644 --- a/lamp_mac/D2B/straight_2d.pro +++ b/lamp_mac/D2B/straight_2d.pro @@ -78,20 +78,14 @@ if (size(win))[0] eq 3 then kz = (size(win))[3]-1 else kz = 0 ; Deal with the Hexapod case in Salsa, where the point information is stored as a string chain -if typename(datp.z) eq 'STRING' then mod_datp, datp, 'z', fix(indgen(n_elements(datp.z)) + 1) +tags = tag_names(datp) +idx = where(tags eq 'Z', found) +if found then if typename(datp.z) eq 'STRING' then mod_datp, datp, 'z', fix(indgen(n_elements(datp.z)) + 1) ; Function works only with regular 2thetha !!! regul = "" regu = 0 if not keyword_set(inter) then begin - ; Regular will fail if an axis value is not numeric (e.g. Hexapod scan in Salsa) - if typename(datp.x) eq 'STRING' or typename(datp.y) eq 'STRING' or typename(datp.z) eq 'STRING' then begin - lamp_journal, 'Non numeric axis (hexapod scan?)' - lamp_journal, 'Convert to numeric axis before calling straight_2d,' - lamp_journal, 'e.g. z1 = indgen(n_elements(z1)).' - lamp_journal, 'Returning input workspace!' - return, win - endif Sxyz = regular(win, dY=0, dX=deltaX, datp=datp, /GetNewSize) regul = " regular" if Sxyz[0] ne (size(win))[1] then begin diff --git a/test_unit/lamp_reading_unit_test.pro b/test_unit/lamp_reading_unit_test.pro index 115e670..9a23bbe 100644 --- a/test_unit/lamp_reading_unit_test.pro +++ b/test_unit/lamp_reading_unit_test.pro @@ -1,3 +1,20 @@ +;+ +;** ******************************************** +;** Test reading routines with old and new files +;** +;** Instructions: +;** Start Lamp first, +;** then launch Idl> lamp_reading_unit_test +;** +;** To check just a single instrument, pass it using the inst keyword, e.g. +;** Idl> lamp_reading_unit_test, inst='in16' +;** +;** Results will appear in a pop-up window and will also be +;** written into the working directory, into a file named +;** lamp_reading_unit_test.txt +;- + + pro unittest_error_reading, error_mess, test_string, fails_count, failed_tests, user_directory, test_directory, unit ;+ ;** ****************************************** @@ -984,7 +1001,7 @@ pro lamp_reading_unit_test, inst=inst ;** You should start Lamp first, ;** then launch this procedure without parameter or ;** giving an instrument keyword, e.g. -;** lamp_reading_unit_test, inst='in10' +;** lamp_reading_unit_test, inst='in16' ;** ;** See results in the file lamp_reading_unit_test.txt ;- -- GitLab