コード例 #1
0
ファイル: frb.py プロジェクト: JayChittidi/FRB
    def from_json(cls, json_file, **kwargs):
        """
        Instantiate from a JSON file
          A simple wrapper to the from_dict method

        Args:
            json_file (str):
            **kwargs: Passed to from_dict()

        Returns:
            slf

        """
        idict = utils.loadjson(json_file)
        slf = cls.from_dict(idict, **kwargs)
        return slf
コード例 #2
0
ファイル: frbgalaxy.py プロジェクト: KshitijAggarwal/FRB
    def from_json(cls, json_file, **kwargs):
        """

        Args:
            json_file:
            **kwargs:

        Returns:
            FRBGalaxy or None

        """
        try:
            idict = utils.loadjson(json_file)
        except FileNotFoundError:
            warnings.warn("File {} not found.  This galaxy probably does not exist yet.".format(json_file))
            return None
        slf = cls.from_dict(idict, **kwargs)
        return slf