Error in Load function

Hello, I am trying to loop through and collect data from some older ISIS instrument run files. When I try and loop through the raw files for HRPD cycle 98_0 I get this error
Error in execution of algorithm LoadRaw:
byte rel comp error: nin <= 0
Error in execution of algorithm Load:
byte rel comp error: nin <= 0
I use a try/except block to skip over files that don’t load properly but after a while of getting the above error python crashes. Does anyone know what causes this error? Is there anyway I could check the files before I try loading them?

Hi,
I’m not familiar with this error. Do you only get it after having loaded in a certain number of files or everytime? If it’s everytime then you could check if this error comes up just loading one file (from script or the GUI).
Can I ask what information you are looking to extract? It seems like you’re trying to Load in every file in one cycle! That is a lot. Is it possible that something like Journalviewer would be more approriate for the job? I know this is an Old Cycle so not sure if that’s possible.

To Load in a sensible number of files you could use something like this: I looked up the run numbers in this cycle (69-16446). As long as “Search Data Archive” is set to all in Manage User Directories then this should work!

import numpy as np
cycle98 = np.arange(69,101) #Run numbers in cycle 98_0, really should end at 16446
print cycle98
for index, value in enumerate(cycle98):
    filename = "HRP{0}.RAW".format(cycle98[index])
    WSname = "HRP{0}".format(cycle98[index])
    print filename
    try:
        Load(filename, OutputWorkspace = WSname)
        print "Complete"
    except: 
        print "File Not Found"

I am trying to get the normalised integrated count for every cycle for every instrument in TS1 as well as some other parameters. I have been able to get the data from nearly every instrument but am running into some problems with ALF, SURF and HRPD.
The code you showed is essentially what I am using to load the files except I am using glob to get the full paths instead and I am clearing all mantid workspaces after every loop.

For HRPD I always encounter the error written above for a large number of files in the directory before mantid workbench crashes. Initially it was crashing at file 2939 so I changed my script to skip this file but then mantid workbench crashed at file 2940. Maybe whatever the error is, it is building up and then crashing. I dunno. I tried loading the file 2940 and those before it in mantid plot and got the same error as before but it didnt cause mantid plot to crash.

For surf file 76634 causes mantid workbench and Plot to crash and I cant figure out why their is no warning it just crashes every time I try and load it.

For ALF I can’t remember what the exact error was but mantid wasn’t crashing at the same file each time I ran the script but was crashing around the same area, cycle 9.2. It always caused my computer to slow down massively before the crash. I looked at the raw file sizes in cycle 9.2 and there wasnt anything out of the ordinary. I also tried loading the nxs files instead of the RAW files but that didnt work it still slowed down and then crashed.

Sorry I know this is a lot but if you can help with any of the crashes it would be helpful.

Hi, Can you send me your script, either on here or to daniel.murphy@stfc.ac.uk

I’ve been trying to play around and make a script that works for you but I may as well be doing this on your actual script!

My attempt to recreate your script is:

from mantid.simpleapi import *
import numpy as np
cycle98 = np.arange(2938,3000) #Run numbers in cycle 98_0, really should end at 16446
print cycle98
Count = 0
for index, value in enumerate(cycle98):
    filename = "HRP{0}.RAW".format(cycle98[index])
    WSname = "HRP{0}".format(cycle98[index])
    print filename
    try:
        ws = Load(filename, OutputWorkspace = WSname)
        ws = Integration(ws)
        ws = SumSpectra(ws)
        Count += ws.readY(0)[0]
        DeleteWorkspace(ws)
        DeleteWorkspace(WSname)
        print "Count = ", Count
    except: 
        print "File Not Found"

I’ve not found it crashing on relatively short runs but I’ll try it overnight and see what happens!