<s> import os <EOL> from astropy import units as u <EOL> from . camera import AbstractGPhotoCamera <EOL> from . . utils import error <EOL> from . . utils import current_time <EOL> class Camera ( AbstractGPhotoCamera ) : <EOL> def __init__ ( self , config , ** kwargs ) : <EOL> super ( ) . __init__ ( config , ** kwargs ) <EOL> self . logger . debug ( "<STR_LIT>" ) <EOL> def connect ( self ) : <EOL> """<STR_LIT>""" <EOL> self . logger . debug ( '<STR_LIT>' ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_property ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_property ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:9> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:9> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:9> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:3> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . set_property ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . _serial_number = self . get_property ( '<STR_LIT>' ) <EOL> self . _connected = True <EOL> @ property <EOL> def uid ( self ) : <EOL> return self . _serial_number [ <NUM_LIT:0> : <NUM_LIT:6> ] <EOL> def construct_filename ( self ) : <EOL> """<STR_LIT>""" <EOL> now = current_time ( ) . datetime . strftime ( "<STR_LIT>" ) <EOL> date , time = now . split ( '<STR_LIT:T>' ) <EOL> filename = os . path . join ( <EOL> self . _image_dir , self . _serial_number , date , "<STR_LIT>" . format ( time ) ) <EOL> return filename <EOL> @ property <EOL> def is_connected ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _connected <EOL> def take_exposure ( self , seconds = <NUM_LIT:1.0> * u . second , filename = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> self . logger . debug ( '<STR_LIT>' . format ( seconds , self . name ) ) <EOL> if not isinstance ( seconds , u . Quantity ) : <EOL> seconds = seconds * u . second <EOL> if filename is None : <EOL> filename = self . construct_filename ( ) <EOL> cmd = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' . format ( int ( seconds . value ) ) , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . format ( filename ) , <EOL> ] <EOL> try : <EOL> self . command ( cmd ) <EOL> except error . InvalidCommand as e : <EOL> self . logger . warning ( e ) <EOL> return filename </s>
