diff --git a/api/dataimport/internal/converters/pixlem/import.go b/api/dataimport/internal/converters/pixlem/import.go index 8d71b851..ddf27cd3 100644 --- a/api/dataimport/internal/converters/pixlem/import.go +++ b/api/dataimport/internal/converters/pixlem/import.go @@ -219,6 +219,14 @@ func importEMData(creatorId string, rtt string, beamLocPath string, hkPath strin return nil, err } + // Remove any images which don't have beam locations + for pmc, img := range contextImgsPerPMC { + if _, ok := beamLookup[pmc]; !ok { + logger.Infof("Excluding image due to not having beam locations: %v", img) + delete(contextImgsPerPMC, pmc) + } + } + hkData, err := importerutils.ReadHousekeepingFile(hkPath, 0, logger) if err != nil { return nil, err diff --git a/api/piquant/configuration.go b/api/piquant/configuration.go index 94eb2f76..14f7fb4d 100644 --- a/api/piquant/configuration.go +++ b/api/piquant/configuration.go @@ -99,9 +99,11 @@ func ReadFieldFromPIQUANTConfigMSA(msaContents string, fieldName string) (float3 idx = strings.Index(line, " ") if idx >= 0 { line = line[0:idx] - val, err := strconv.ParseFloat(line, 32) - return float32(val), err } + + // Read it as a float + val, err := strconv.ParseFloat(line, 32) + return float32(val), err } } } diff --git a/api/ws/handlers/detector-config.go b/api/ws/handlers/detector-config.go index f380ad68..ac7fba21 100644 --- a/api/ws/handlers/detector-config.go +++ b/api/ws/handlers/detector-config.go @@ -48,7 +48,13 @@ func HandleDetectorConfigReq(req *protos.DetectorConfigReq, hctx wsHelpers.Handl piquantCfgFileStr := string(piquantCfgFile) angle, err := piquant.ReadFieldFromPIQUANTConfigMSA(piquantCfgFileStr, "#ELEVANGLE") if err != nil { - return nil, fmt.Errorf("Failed to read ELEVANGLE from Piquant config file: %v", cfgPath) + hctx.Svcs.Log.Errorf("Failed to read ELEVANGLE from Piquant config file: %v, trying emerg_angle", cfgPath) + + // EM config has a value "emerg_angle" which is also set to 70, maybe it's an interchangeable name? + angle, err = piquant.ReadFieldFromPIQUANTConfigMSA(piquantCfgFileStr, "emerg_angle") + if err != nil { + return nil, fmt.Errorf("Failed to read ELEVANGLE and emerg_angle from Piquant config file: %v", cfgPath) + } } cfg.ElevAngle = angle