From 2c5829f16c15f1d992b6b515368be8fe21b93ce3 Mon Sep 17 00:00:00 2001 From: Marco Frailis <marco.frailis@inaf.it> Date: Wed, 10 Oct 2018 15:12:56 +0200 Subject: [PATCH] Updating jupyter notebook --- imagedb_objects.ipynb | 207 ------------------------------------------ 1 file changed, 207 deletions(-) diff --git a/imagedb_objects.ipynb b/imagedb_objects.ipynb index f4600b2..6dff79e 100644 --- a/imagedb_objects.ipynb +++ b/imagedb_objects.ipynb @@ -114,213 +114,6 @@ "source": [ "d = NispDetector(detectorId = \"11\", gain = 1.0, readoutNoise = 0.0, rawFrame = image)" ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'category': 'SCIENCE', 'firstType': 'OBJECT', 'secondType': 'STD'}" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "it = image.imageType\n", - "repr(it)\n", - "it.to_dict()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "from imagedb.serializers import NispRawFrameSerializer\n", - "\n", - "s = NispRawFrameSerializer()" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "OrderedDict([('id', IntegerField(label='ID', read_only=True)),\n", - " ('detectors', NispDetectorSerializer(many=True, read_only=True):\n", - " id = IntegerField(label='ID', read_only=True)\n", - " detectorId = ChoiceField(choices=[('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('21', '21'), ('22', '22'), ('23', '23'), ('24', '24'), ('31', '31'), ('32', '32'), ('33', '33'), ('34', '34'), ('41', '41'), ('42', '42'), ('43', '43'), ('44', '44')], label='DetectorId')\n", - " gain = FloatField()\n", - " readoutNoise = FloatField(label='ReadoutNoise')),\n", - " ('exposureTime', FloatField(label='ExposureTime')),\n", - " ('imgNumber', IntegerField(label='ImgNumber')),\n", - " ('naxis1', IntegerField()),\n", - " ('naxis2', IntegerField()),\n", - " ('imageType_category',\n", - " ChoiceField(choices=[('SCIENCE', 'SCIENCE'), ('CALIBRATION', 'CALIBRATION'), ('SIMULATION', 'SIMULATION')], label='ImageType category')),\n", - " ('imageType_firstType',\n", - " ChoiceField(choices=[('OBJECT', 'OBJECT'), ('STD', 'STD'), ('BIAS', 'BIAS'), ('DARK', 'DARK'), ('FLAT', 'FLAT'), ('LINEARITY', 'LINEARITY'), ('OTHER', 'OTHER')], label='ImageType firstType')),\n", - " ('imageType_secondType',\n", - " ChoiceField(choices=[('SKY', 'SKY'), ('LAMP', 'LAMP'), ('DOME', 'DOME'), ('OTHER', 'OTHER')], label='ImageType secondType')),\n", - " ('observationDateTime',\n", - " DateTimeField(label='ObservationDateTime')),\n", - " ('commandedPointing_rightAscension',\n", - " FloatField(label='CommandedPointing rightAscension')),\n", - " ('commandedPointing_declination',\n", - " FloatField(label='CommandedPointing declination')),\n", - " ('commandedPointing_pointingAngle',\n", - " FloatField(label='CommandedPointing pointingAngle')),\n", - " ('filterWheelPosition',\n", - " ChoiceField(choices=[('Y', 'Y'), ('J', 'J'), ('H', 'H'), ('OPEN', 'OPEN'), ('CLOSE', 'CLOSE')], label='FilterWheelPosition')),\n", - " ('grismWheelPosition',\n", - " ChoiceField(choices=[('BLUE0', 'BLUE0'), ('RED0', 'RED0'), ('RED90', 'RED90'), ('RED180OPENCLOSE', 'RED180OPENCLOSE')], label='GrismWheelPosition')),\n", - " ('instrument', NestedSerializer(read_only=True):\n", - " id = IntegerField(label='ID', read_only=True)\n", - " instrumentName = CharField(label='InstrumentName', max_length=100)\n", - " telescopeName = CharField(label='TelescopeName', max_length=100))])" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "s.get_fields()" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "from composite_field.rest_framework_support import CompositeFieldSerializer\n", - "\n", - "c = CompositeFieldSerializer()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'category': 'SCIENCE', 'firstType': 'OBJECT', 'secondType': 'STD'}" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c.to_representation(it)" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [], - "source": [ - "m = NispRawFrameSerializer.Meta.model" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "m._meta.concrete_model._meta.fields[15].serialize" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "imagedb.models.Pointing" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "type(p)" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": {}, - "outputs": [], - "source": [ - "from composite_field import CompositeField" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(p, CompositeField)" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { -- GitLab