Skip to content

Commit

Permalink
Merge pull request #358 from pixlise/feature/em-import
Browse files Browse the repository at this point in the history
Feature/em import
  • Loading branch information
pnemere authored Nov 12, 2024
2 parents c4ecd8a + 3a98b7e commit 74d0036
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions api/dataimport/internal/converters/pixlem/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions api/piquant/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion api/ws/handlers/detector-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74d0036

Please sign in to comment.