prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bug in indoor_converter
  If `pkl_prefix=='sunrgbd'` we go to this [else](https://github.com/open-mmlab/mmdetection3d/blob/master/tools/data_converter/indoor_converter.py#L89) for `s3dis` and get `FileNotFoundError`.
  
  </issue>
  <code>
  [start of tools/data_converter/indoor_converter.py]
  1 import mmcv
  2 import numpy as np
  3 import os
  4 
  5 from tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData
  6 from tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData
  7 from tools.data_converter.sunrgbd_data_utils import SUNRGBDData
  8 
  9 
  10 def create_indoor_info_file(data_path,
  11                             pkl_prefix='sunrgbd',
  12                             save_path=None,
  13                             use_v1=False,
  14                             workers=4):
  15     """Create indoor information file.
  16 
  17     Get information of the raw data and save it to the pkl file.
  18 
  19     Args:
  20         data_path (str): Path of the data.
  21         pkl_prefix (str): Prefix of the pkl to be saved. Default: 'sunrgbd'.
  22         save_path (str): Path of the pkl to be saved. Default: None.
  23         use_v1 (bool): Whether to use v1. Default: False.
  24         workers (int): Number of threads to be used. Default: 4.
  25     """
  26     assert os.path.exists(data_path)
  27     assert pkl_prefix in ['sunrgbd', 'scannet', 's3dis'], \
  28         f'unsupported indoor dataset {pkl_prefix}'
  29     save_path = data_path if save_path is None else save_path
  30     assert os.path.exists(save_path)
  31 
  32     # generate infos for both detection and segmentation task
  33     if pkl_prefix in ['sunrgbd', 'scannet']:
  34         train_filename = os.path.join(save_path,
  35                                       f'{pkl_prefix}_infos_train.pkl')
  36         val_filename = os.path.join(save_path, f'{pkl_prefix}_infos_val.pkl')
  37         if pkl_prefix == 'sunrgbd':
  38             # SUN RGB-D has a train-val split
  39             train_dataset = SUNRGBDData(
  40                 root_path=data_path, split='train', use_v1=use_v1)
  41             val_dataset = SUNRGBDData(
  42                 root_path=data_path, split='val', use_v1=use_v1)
  43         else:
  44             # ScanNet has a train-val-test split
  45             train_dataset = ScanNetData(root_path=data_path, split='train')
  46             val_dataset = ScanNetData(root_path=data_path, split='val')
  47             test_dataset = ScanNetData(root_path=data_path, split='test')
  48             test_filename = os.path.join(save_path,
  49                                          f'{pkl_prefix}_infos_test.pkl')
  50 
  51         infos_train = train_dataset.get_infos(
  52             num_workers=workers, has_label=True)
  53         mmcv.dump(infos_train, train_filename, 'pkl')
  54         print(f'{pkl_prefix} info train file is saved to {train_filename}')
  55 
  56         infos_val = val_dataset.get_infos(num_workers=workers, has_label=True)
  57         mmcv.dump(infos_val, val_filename, 'pkl')
  58         print(f'{pkl_prefix} info val file is saved to {val_filename}')
  59 
  60     if pkl_prefix == 'scannet':
  61         infos_test = test_dataset.get_infos(
  62             num_workers=workers, has_label=False)
  63         mmcv.dump(infos_test, test_filename, 'pkl')
  64         print(f'{pkl_prefix} info test file is saved to {test_filename}')
  65 
  66     # generate infos for the semantic segmentation task
  67     # e.g. re-sampled scene indexes and label weights
  68     # scene indexes are used to re-sample rooms with different number of points
  69     # label weights are used to balance classes with different number of points
  70     if pkl_prefix == 'scannet':
  71         # label weight computation function is adopted from
  72         # https://github.com/charlesq34/pointnet2/blob/master/scannet/scannet_dataset.py#L24
  73         train_dataset = ScanNetSegData(
  74             data_root=data_path,
  75             ann_file=train_filename,
  76             split='train',
  77             num_points=8192,
  78             label_weight_func=lambda x: 1.0 / np.log(1.2 + x))
  79         # TODO: do we need to generate on val set?
  80         val_dataset = ScanNetSegData(
  81             data_root=data_path,
  82             ann_file=val_filename,
  83             split='val',
  84             num_points=8192,
  85             label_weight_func=lambda x: 1.0 / np.log(1.2 + x))
  86         # no need to generate for test set
  87         train_dataset.get_seg_infos()
  88         val_dataset.get_seg_infos()
  89     else:
  90         # S3DIS doesn't have a fixed train-val split
  91         # it has 6 areas instead, so we generate info file for each of them
  92         # in training, we will use dataset to wrap different areas
  93         splits = [f'Area_{i}' for i in [1, 2, 3, 4, 5, 6]]
  94         for split in splits:
  95             dataset = S3DISData(root_path=data_path, split=split)
  96             info = dataset.get_infos(num_workers=workers, has_label=True)
  97             filename = os.path.join(save_path,
  98                                     f'{pkl_prefix}_infos_{split}.pkl')
  99             mmcv.dump(info, filename, 'pkl')
  100             print(f'{pkl_prefix} info {split} file is saved to {filename}')
  101             seg_dataset = S3DISSegData(
  102                 data_root=data_path,
  103                 ann_file=filename,
  104                 split=split,
  105                 num_points=4096,
  106                 label_weight_func=lambda x: 1.0 / np.log(1.2 + x))
  107             seg_dataset.get_seg_infos()
  108
  [end of tools/data_converter/indoor_converter.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/tools/data_converter/indoor_converter.py b/tools/data_converter/indoor_converter.py
  --- a/tools/data_converter/indoor_converter.py
  +++ b/tools/data_converter/indoor_converter.py
  @@ -86,7 +86,7 @@
           # no need to generate for test set
           train_dataset.get_seg_infos()
           val_dataset.get_seg_infos()
  -    else:
  +    elif pkl_prefix == 's3dis':
           # S3DIS doesn't have a fixed train-val split
           # it has 6 areas instead, so we generate info file for each of them
           # in training, we will use dataset to wrap different areas
  
verification_info: {"golden_diff": "diff --git a/tools/data_converter/indoor_converter.py b/tools/data_converter/indoor_converter.py\n--- a/tools/data_converter/indoor_converter.py\n+++ b/tools/data_converter/indoor_converter.py\n@@ -86,7 +86,7 @@\n         # no need to generate for test set\n         train_dataset.get_seg_infos()\n         val_dataset.get_seg_infos()\n-    else:\n+    elif pkl_prefix == 's3dis':\n         # S3DIS doesn't have a fixed train-val split\n         # it has 6 areas instead, so we generate info file for each of them\n         # in training, we will use dataset to wrap different areas\n", "issue": "Bug in indoor_converter\nIf `pkl_prefix=='sunrgbd'` we go to this [else](https://github.com/open-mmlab/mmdetection3d/blob/master/tools/data_converter/indoor_converter.py#L89) for `s3dis` and get `FileNotFoundError`.\n", "before_files": [{"content": "import mmcv\nimport numpy as np\nimport os\n\nfrom tools.data_converter.s3dis_data_utils import S3DISData, S3DISSegData\nfrom tools.data_converter.scannet_data_utils import ScanNetData, ScanNetSegData\nfrom tools.data_converter.sunrgbd_data_utils import SUNRGBDData\n\n\ndef create_indoor_info_file(data_path,\n                            pkl_prefix='sunrgbd',\n                            save_path=None,\n                            use_v1=False,\n                            workers=4):\n    \"\"\"Create indoor information file.\n\n    Get information of the raw data and save it to the pkl file.\n\n    Args:\n        data_path (str): Path of the data.\n        pkl_prefix (str): Prefix of the pkl to be saved. Default: 'sunrgbd'.\n        save_path (str): Path of the pkl to be saved. Default: None.\n        use_v1 (bool): Whether to use v1. Default: False.\n        workers (int): Number of threads to be used. Default: 4.\n    \"\"\"\n    assert os.path.exists(data_path)\n    assert pkl_prefix in ['sunrgbd', 'scannet', 's3dis'], \\\n        f'unsupported indoor dataset {pkl_prefix}'\n    save_path = data_path if save_path is None else save_path\n    assert os.path.exists(save_path)\n\n    # generate infos for both detection and segmentation task\n    if pkl_prefix in ['sunrgbd', 'scannet']:\n        train_filename = os.path.join(save_path,\n                                      f'{pkl_prefix}_infos_train.pkl')\n        val_filename = os.path.join(save_path, f'{pkl_prefix}_infos_val.pkl')\n        if pkl_prefix == 'sunrgbd':\n            # SUN RGB-D has a train-val split\n            train_dataset = SUNRGBDData(\n                root_path=data_path, split='train', use_v1=use_v1)\n            val_dataset = SUNRGBDData(\n                root_path=data_path, split='val', use_v1=use_v1)\n        else:\n            # ScanNet has a train-val-test split\n            train_dataset = ScanNetData(root_path=data_path, split='train')\n            val_dataset = ScanNetData(root_path=data_path, split='val')\n            test_dataset = ScanNetData(root_path=data_path, split='test')\n            test_filename = os.path.join(save_path,\n                                         f'{pkl_prefix}_infos_test.pkl')\n\n        infos_train = train_dataset.get_infos(\n            num_workers=workers, has_label=True)\n        mmcv.dump(infos_train, train_filename, 'pkl')\n        print(f'{pkl_prefix} info train file is saved to {train_filename}')\n\n        infos_val = val_dataset.get_infos(num_workers=workers, has_label=True)\n        mmcv.dump(infos_val, val_filename, 'pkl')\n        print(f'{pkl_prefix} info val file is saved to {val_filename}')\n\n    if pkl_prefix == 'scannet':\n        infos_test = test_dataset.get_infos(\n            num_workers=workers, has_label=False)\n        mmcv.dump(infos_test, test_filename, 'pkl')\n        print(f'{pkl_prefix} info test file is saved to {test_filename}')\n\n    # generate infos for the semantic segmentation task\n    # e.g. re-sampled scene indexes and label weights\n    # scene indexes are used to re-sample rooms with different number of points\n    # label weights are used to balance classes with different number of points\n    if pkl_prefix == 'scannet':\n        # label weight computation function is adopted from\n        # https://github.com/charlesq34/pointnet2/blob/master/scannet/scannet_dataset.py#L24\n        train_dataset = ScanNetSegData(\n            data_root=data_path,\n            ann_file=train_filename,\n            split='train',\n            num_points=8192,\n            label_weight_func=lambda x: 1.0 / np.log(1.2 + x))\n        # TODO: do we need to generate on val set?\n        val_dataset = ScanNetSegData(\n            data_root=data_path,\n            ann_file=val_filename,\n            split='val',\n            num_points=8192,\n            label_weight_func=lambda x: 1.0 / np.log(1.2 + x))\n        # no need to generate for test set\n        train_dataset.get_seg_infos()\n        val_dataset.get_seg_infos()\n    else:\n        # S3DIS doesn't have a fixed train-val split\n        # it has 6 areas instead, so we generate info file for each of them\n        # in training, we will use dataset to wrap different areas\n        splits = [f'Area_{i}' for i in [1, 2, 3, 4, 5, 6]]\n        for split in splits:\n            dataset = S3DISData(root_path=data_path, split=split)\n            info = dataset.get_infos(num_workers=workers, has_label=True)\n            filename = os.path.join(save_path,\n                                    f'{pkl_prefix}_infos_{split}.pkl')\n            mmcv.dump(info, filename, 'pkl')\n            print(f'{pkl_prefix} info {split} file is saved to {filename}')\n            seg_dataset = S3DISSegData(\n                data_root=data_path,\n                ann_file=filename,\n                split=split,\n                num_points=4096,\n                label_weight_func=lambda x: 1.0 / np.log(1.2 + x))\n            seg_dataset.get_seg_infos()\n", "path": "tools/data_converter/indoor_converter.py"}]}