File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,18 @@ func getBucketSizesFromHex(hex string) ([]int, error) {
217217 return bucketSizes , nil
218218}
219219
220+ // padFrequencies adds items to the frequencies slice until it reaches the desired length.
221+ // The value of the added items is the same as the last item in the original slice.
222+ func padFrequencies (freqs []int , desiredLength int ) ([]int , error ) {
223+ if len (freqs ) == 0 {
224+ return nil , fmt .Errorf ("cannot pad empty frequencies slice" )
225+ }
226+ for len (freqs ) < desiredLength {
227+ freqs = append (freqs , freqs [len (freqs )- 1 ])
228+ }
229+ return freqs , nil
230+ }
231+
220232// getSpecFrequencyBuckets
221233// returns slice of rows
222234// first row is header
@@ -304,6 +316,12 @@ func getSpecFrequencyBuckets(outputs map[string]script.ScriptOutput) ([][]string
304316 freqs [i ] = 0
305317 }
306318 }
319+ if len (freqs ) != len (bucketCoreCounts ) {
320+ freqs , err = padFrequencies (freqs , len (bucketCoreCounts ))
321+ if err != nil {
322+ return nil , fmt .Errorf ("failed to pad frequencies: %w" , err )
323+ }
324+ }
307325 for _ , freq := range freqs {
308326 // convert freq to GHz
309327 freqf := float64 (freq ) / 10.0
You can’t perform that action at this time.
0 commit comments