 }
 
 extension Line {
-  fileprivate init(fromFile file: URL) throws {
+  fileprivate init?(fromFile file: URL) throws {
     let rows = try String(contentsOf: file, encoding: .utf8)
       .components(separatedBy: .newlines)
       .dropFirst()
       .map { $0.components(separatedBy: "\t") }
       .filter { $0.count == 2 }
+    if rows.isEmpty { return nil }
     self.x = [Float](unsafeUninitializedCapacity: rows.count) { buffer, initializedCount in
       for i in rows.indices { buffer[i] = Float(rows[i][0])! }
       initializedCount = rows.count

      // The following index is used for picking the color for the corresponding lines in the plot.
      let observationIndex: Int = {
        switch observation {
        case .vision: return 1
        case .scent: return 2
        case .visionAndScent: return 0
        }
      }()

fileprivate let sns = Python.import("seaborn")

fileprivate let redPalette = sns.color_palette("Reds", 4)
fileprivate let bluePalette = sns.color_palette("Blues_d", 5)

public struct ResultsPlot {
  public let reward: Reward
