tkp.stream
– Streaming telescope data¶
tkp.stream
¶
Code for parsing streaming telescope data. For now we only support AARTFAAC data version 1. We implemented an emulator for this stream in testutil.stream_emu.
-
tkp.stream.
connection_handler
(socket_, image_queue)[source]¶ Handles the connection, waits until a windows is returned and puts it in the queue.
Daemon thread, will loop forever.
Parameters: - socket (socket.socket) – socket used for reading
- image_queue (Queue.Queue) – used for putting images in
-
tkp.stream.
connector
(host, port, image_queue)[source]¶ Tries to connect to a specific host and port, if succesfull will call connection_handler() with the connection.
Parameters:
-
tkp.stream.
extract_timestamp
(hdulist)[source]¶ Parameters: hdulist (astropy.io.fits.HDUList) – fits header to extract timestamp from Returns: extracted timestamp Return type: datetime.datetime
-
tkp.stream.
getbytes
(socket_, bytes_)[source]¶ Read an amount of bytes from the socket
Parameters: - socket (socket.socket) – socket to use for reading
- bytes (int) – amount of bytes to read
Returns: raw bytes from socket
Return type:
-
tkp.stream.
merger
(image_queue, grouped_queue)[source]¶ Will monitor image_queue for images and group them by timestamp. When an image with an successive timestamp is received the group is put on the grouped queue.
Parameters: - image_queue (Queue) – the incoming image queue
- grouped_queue (Queue) – the outgoing grouped image queue
-
tkp.stream.
read_window
(socket_)[source]¶ read raw aarfaac protocol window
Parameters: socket (socket.socket) – socket to read from Returns: fits_bytes, image_bytes