@classmethod
def fromYaml(cls, filename):
    """Load an `Optic` (commonly a complete telescope) from the given yaml
        file.  This is the most common way to create an `Optic`.  If the file
        is not initially found, then look in the ``batoid.datadir`` directory
        and subdirectories for the first matching filename and use that.

        Look in ``batoid.datadir`` for examples of how to format a batoid optic
        yaml file.

        Parameters
        ----------
        filename : str
            Name of yaml file to load

        Returns
        -------
        `Optic`
        """
    import os
    import yaml
    try:
        with open(filename) as f:
            config = yaml.safe_load(f)
    except FileNotFoundError:
        import glob
        from . import datadir
        filenames = glob.glob(os.path.join(datadir, '**', '*.yaml'))
        for candidate in filenames:
            if os.path.basename(candidate) == filename:
                with open(candidate) as f:
                    config = yaml.safe_load(f)
                break
        else:
            raise FileNotFoundError(filename)
    from .parse import parse_optic
    return parse_optic(config['opticalSystem'])
