Skip to content

Commit

Permalink
Fix generated HK file had no header/wrong file name read in lambda fo…
Browse files Browse the repository at this point in the history
…r EM import
  • Loading branch information
Peter Nemere committed Nov 11, 2024
1 parent 4265fe6 commit 9870ae4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/dataimport/internal/converters/pixlem/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (p PIXLEM) Import(importPath string, pseudoIntensityRangesPath string, data

beamPath := filepath.Join(importPath, beamName)
// HK file should be here too...
hkPath := filepath.Join(importPath, "housekeeping-"+rttStr+".csv")
hkPath := filepath.Join(importPath, "HK-"+rttStr+".csv")
data, err := importEMData(rttStr, beamPath, hkPath, imageList, bulkMaxList, msaList, &fs, log)
if err != nil {
log.Errorf("Import failed for %v: %v", beamName, err)
Expand Down
13 changes: 9 additions & 4 deletions api/dataimport/sdfToRSI/sdfToRSI.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ func sdfToRSI(sdfPath string, rtt int64, startLine int, endLine int, outPath str
return fmt.Errorf("Failed to create output RSI CSV %v: %v", outPath, err)
}

_, err = fout.WriteString(fmt.Sprintf("Spatial information from PIXL SDF or dat files %v for RTT: %v\n", sdfPath, rtt) +
"SCLK, RTT, PMC, PDP category, PDP name, PDP information (content varies)\n" +
"comment,,,, Housekeeping columns, Mtr1, Mtr2, Mtr3, Mtr4, Mtr5, Mtr6, SDD1_V, SDD2_V, Arm_R, SDD1_T, SDD2_T, SDD1_TEC_T, SDD2_TEC_T, Yellow_T, AFE_T, LVCM_T, HVMM_T, Fil_V, Fil_I, HV, Em_I\n")

if err != nil {
return fmt.Errorf("Failed to write output CSV headers for %v: %v", outPath, err)
}

fout_hk, err := os.Create(outPath_Housekeeping)
if err != nil {
return fmt.Errorf("Failed to create output housekeeping CSV %v: %v", outPath, err)
}

_, err = fout.WriteString(fmt.Sprintf("Spatial information from PIXL SDF or dat files %v for RTT: %v\n", sdfPath, rtt) +
"SCLK, RTT, PMC, PDP category, PDP name, PDP information (content varies)\n" +
"comment,,,, Housekeeping columns, Mtr1, Mtr2, Mtr3, Mtr4, Mtr5, Mtr6, SDD1_V, SDD2_V, Arm_R, SDD1_T, SDD2_T, SDD1_TEC_T, SDD2_TEC_T, Yellow_T, AFE_T, LVCM_T, HVMM_T, Fil_V, Fil_I, HV, Em_I\n")

_, err = fout_hk.WriteString("SCLK,PMC,hk_fcnt,f_pixl_sdd_1_conv,f_pixl_sdd_2_conv,f_pixl_arm_resist_conv,f_head_sdd_1_conv,f_head_sdd_2_conv,f_hvps_fvmon_conv,f_hvps_fimon_conv,f_hvps_hvmon_conv,f_hvps_himon_conv,i_motor_1_conv,i_motor_2_conv,i_motor_3_conv,i_motor_4_conv,i_motor_5_conv,i_motor_6_conv\n")
if err != nil {
return fmt.Errorf("Failed to write output CSV headers for %v: %v", outPath, err)
}
Expand Down
4 changes: 2 additions & 2 deletions api/ws/handlers/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,11 @@ func processEM(importId string, zipReader *zip.Reader, zippedData []byte, destBu
// Upoad the output files (beam locations, log and surface)
files := []string{filepath.Join(localTemp, hkFile), rxlPath, logPath, surfPath}
name := []string{"housekeeping", "beam location", "log", "surface"}
for _, file := range files {
for i, file := range files {
data, err := os.ReadFile(file)
if err != nil {
// Don't fail on errors for these - we may have run beam location tool on some incomplete scan, so failure isn't terrible!
logger.Errorf("Failed to read generated %v file: %v. Error: %v", name, file, err)
logger.Errorf("Failed to read generated %v file: %v. Error: %v", name[i], file, err)
continue
}

Expand Down

0 comments on commit 9870ae4

Please sign in to comment.