# Path: py/fiberassign/test/simulate.py
# def sim_data_dir():
# def test_subdir_create(name):
# def sim_science_fractions():
# def sim_focalplane(rundate=None, fakepos=False):
# def sim_stuck_sky(dirnm, hw, tiles):
#     def radec2xyz(r, d):
# def sim_tiles(path, selectfile=None):
# def sim_targets(path, tgtype, tgoffset, density=5000.0, science_frac=None):
# def petal_rotation(npos, reverse=False):
#         J = np.flatnonzero(r2 < maxr2)


import os
import unittest
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from fiberassign.hardware import load_hardware
from fiberassign.vis import (
    plot_positioner,
    plot_positioner_simple,
    Shape,
    set_matplotlib_pdf_backend
)
from .simulate import test_subdir_create, sim_focalplane, test_assign_date
                else:
                    plot_positioner(
                        ax, patrol_rad, lid, center, shptheta, shpphi,
                        color=color, linewidth=linewidth
                    )

        outfile = os.path.join(dir, "test_plotfp_{}.pdf".format(suffix))
        ax.set_xlabel("Millimeters", fontsize="large")
        ax.set_ylabel("Millimeters", fontsize="large")
        plt.savefig(outfile, dpi=300, format="pdf")
        plt.close()

    def test_plotfp(self):
        test_dir = test_subdir_create("vis_test_plotfp")
        time = test_assign_date
        hw = load_hardware(rundate=time)
        suffix = "{}_simple".format(time)
        self._load_and_plotfp(hw, test_dir, suffix, simple=True)
        suffix = "{}".format(time)
        self._load_and_plotfp(hw, test_dir, suffix, simple=False)
        # time = "2012-12-12T00:00:00"
        # hw = load_hardware(rundate=time)
        # suffix = "{}_simple".format(time)
        # self._load_and_plotfp(hw, test_dir, suffix, simple=True)
        # suffix = "{}".format(time)
        # self._load_and_plotfp(hw, test_dir, suffix, simple=False)
        return

    def test_plot_fakefp(self):
        test_dir = test_subdir_create("vis_test_fakefp")

# Path: py/fiberassign/test/simulate.py
# def sim_data_dir():
# def test_subdir_create(name):
# def sim_science_fractions():
# def sim_focalplane(rundate=None, fakepos=False):
# def sim_stuck_sky(dirnm, hw, tiles):
#     def radec2xyz(r, d):
# def sim_tiles(path, selectfile=None):
# def sim_targets(path, tgtype, tgoffset, density=5000.0, science_frac=None):
# def petal_rotation(npos, reverse=False):
#         J = np.flatnonzero(r2 < maxr2)


# Path: py/fiberassign/test/test_vis.py
import os
import unittest
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
from fiberassign.hardware import load_hardware
from fiberassign.vis import (
    plot_positioner,
    plot_positioner_simple,
    Shape,
    set_matplotlib_pdf_backend
)
from .simulate import test_subdir_create, sim_focalplane, test_assign_date

                else:
                    plot_positioner(
                        ax, patrol_rad, lid, center, shptheta, shpphi,
                        color=color, linewidth=linewidth
                    )

        outfile = os.path.join(dir, "test_plotfp_{}.pdf".format(suffix))
        ax.set_xlabel("Millimeters", fontsize="large")
        ax.set_ylabel("Millimeters", fontsize="large")
        plt.savefig(outfile, dpi=300, format="pdf")
        plt.close()

    def test_plotfp(self):
        test_dir = test_subdir_create("vis_test_plotfp")
        time = test_assign_date
        hw = load_hardware(rundate=time)
        suffix = "{}_simple".format(time)
        self._load_and_plotfp(hw, test_dir, suffix, simple=True)
        suffix = "{}".format(time)
        self._load_and_plotfp(hw, test_dir, suffix, simple=False)
        # time = "2012-12-12T00:00:00"
        # hw = load_hardware(rundate=time)
        # suffix = "{}_simple".format(time)
        # self._load_and_plotfp(hw, test_dir, suffix, simple=True)
        # suffix = "{}".format(time)
        # self._load_and_plotfp(hw, test_dir, suffix, simple=False)
        return

    def test_plot_fakefp(self):
        test_dir = test_subdir_create("vis_test_fakefp")

        time = test_assign_date