Exemple #1
0
    def _build_schema(self):
        """Build the schema, encorporating the core."""
        # Determine the schema path
        filename = os.path.abspath(inspect.getfile(self.__class__))
        base_url = os.path.join(
            os.path.dirname(filename), 'schemas', '')
        schema_path = os.path.join(base_url, self.schema_url)
        core_schema_path = os.path.join(base_url, self.core_schema_url)

        # Get the schemas
        schema = asdf_schema.load_schema(
            schema_path,
            resolve_references=True
        )
        core_schema = asdf_schema.load_schema(
            core_schema_path,
            resolve_references=True
        )

        # Create a new core.meta that will co-locate
        # with each exposure entry. This is done
        # by saving the meta information in a separate
        # FITS HDU.
        core_meta_schema = deepcopy(core_schema['properties']['meta'])
        treeutil.walk(core_meta_schema, remove_fits)
        exposure_schema = schema['allOf'][1]['properties']['exposures']['items']
        exposure_meta_schema = exposure_schema['allOf'][1]['properties']['meta']
        exposure_meta_schema.update(core_meta_schema)

        # That's all folks
        return schema
    def _build_schema(self):
        """Build the schema, incorporating the core."""
        # Get the schemas
        schema = asdf_schema.load_schema(
            self.schema_url,
            resolver=AsdfFile().resolver,
            resolve_references=True
        )
        core_schema = asdf_schema.load_schema(
            self.core_schema_url,
            resolver=AsdfFile().resolver,
            resolve_references=True
        )

        # Create a new core.meta that will co-locate
        # with each exposure entry. This is done
        # by saving the meta information in a separate
        # FITS HDU.
        core_meta_schema = deepcopy(core_schema['properties']['meta'])
        treeutil.walk(core_meta_schema, remove_fits)
        exposure_schema = schema['allOf'][1]['properties']['exposures']['items']
        exposure_meta_schema = exposure_schema['allOf'][1]['properties']['meta']
        exposure_meta_schema.update(core_meta_schema)

        # That's all folks
        return schema