hey!, the image that i attached is in RGB24, when I open it with KSTARS I can see the colors, however, I would like to know if it is possible to obtain a real color image in png or jpg from the .fit file, i understand that the fit file is a 3D color cube, but I searched and could not find more information about convert this to RGB image, i gratefull if you can help me.

Read More...

Thanx for answer! I have managed to adjust the gain, but i can't get the image in color, only in black and white, can you help me with this?
my code:

import PyIndi
import time
import sys
import threading

class IndiClient(PyIndi.BaseClient):
    def __init__(self):
        super(IndiClient, self).__init__()
    def newDevice(self, d):
        pass
    def newProperty(self, p):
        pass
    def removeProperty(self, p):
        pass
    def newBLOB(self, bp):
        global blobEvent
        print("new BLOB ", bp.name)
        blobEvent.set()
        pass
    def newSwitch(self, svp):
        pass
    def newNumber(self, nvp):
        pass
    def newText(self, tvp):
        pass
    def newLight(self, lvp):
        pass
    def newMessage(self, d, m):
        pass
    def serverConnected(self):
        pass
    def serverDisconnected(self, code):
        pass

#connect server
indiclient=IndiClient()
indiclient.setServer("localhost",7624)

#test connection
if (not(indiclient.connectServer())):
     print("No indiserver running on "+indiclient.getHost()+":"+str(indiclient.getPort())+" - Try to run")
     print("  indiserver indi_simulator_telescope indi_simulator_ccd")
     sys.exit(1)

#connect to ccd device
#define device type and find connected camera
ccd="ZWO CCD ASI120MC-S"
device_ccd=indiclient.getDevice(ccd)
while not(device_ccd):
    print 'No CCD'
    time.sleep(0.5)
    device_ccd=indiclient.getDevice(ccd)

print 'CCD ZWO detected'

#stablish connection with device
ccd_connect=device_ccd.getSwitch("CONNECTION")
while not(ccd_connect):
    time.sleep(0.5)
    print 'Connection in progress...'
    ccd_connect=device_ccd.getSwitch("CONNECTION")
if not(device_ccd.isConnected()):
    ccd_connect[0].s=PyIndi.ISS_ON  # the "CONNECT" switch
    ccd_connect[1].s=PyIndi.ISS_OFF # the "DISCONNECT" switch
    indiclient.sendNewSwitch(ccd_connect)

print 'Connection stablish'

#get exposure value from device
ccd_exposure=device_ccd.getNumber("CCD_EXPOSURE")
while not(ccd_exposure):
    time.sleep(0.5)
    ccd_exposure=device_ccd.getNumber("CCD_EXPOSURE")

print str(ccd_exposure[0].value)

#get ccd control values from device
ccd_controls=device_ccd.getNumber("CCD_CONTROLS")
while not(ccd_controls):
    time.sleep(0.5)
    ccd_controls=device_ccd.getNumber("CCD_CONTROLS")

#print type(ccd_controls)
print str(ccd_controls[0].value)

#get ccd switch details and change video format to get COLOR
ccd_video_format=device_ccd.getSwitch("CCD_VIDEO_FORMAT")
while not(ccd_video_format):
    time.sleep(0.5)
    ccd_video_format=device_ccd.getSwitch("CCD_VIDEO_FORMAT")

#print(ccd_video_format[0].name,ccd_video_format[0].label,ccd_video_format[0].s)
#print(ccd_video_format[1].name,ccd_video_format[1].label,ccd_video_format[1].s)
#print(ccd_video_format[2].name,ccd_video_format[2].label,ccd_video_format[2].s)
#print(ccd_video_format[3].name,ccd_video_format[3].label,ccd_video_format[3].s)
#config new format value
#ccd_video_format[0].s=0
#ccd_video_format[1].s=1 #activate RGB_24
#ccd_video_format[2].s=0
#ccd_video_format[3].s=0
#indiclient.sendNewSwitch(ccd_video_format)

#get ccd switch details and change compression option
ccd_compression=device_ccd.getSwitch("CCD_COMPRESSION")
while not(ccd_compression):
    time.sleep(0.5)
    ccd_compression=device_ccd.getSwitch("CCD_COMPRESSION")
#print values read
#print(ccd_compression[0].name,ccd_compression[0].label,ccd_compression[0].s)
#print(ccd_compression[1].name,ccd_compression[1].label,ccd_compression[1].s)
#config new state
#ccd_compression[0].s=1
#ccd_compression[1].s=0
#indiclient.sendNewSwitch(ccd_compression)

#get ccd switch details and change ccd estream  options
ccd_stream_encoder=device_ccd.getSwitch("CCD_STREAM_ENCODER")
while not(ccd_stream_encoder):
    time.sleep(0.5)
    ccd_stream_encoder=device_ccd.getSwitch("CCD_STREAM_ENCODER")
#print values read
print(ccd_stream_encoder[0].name,ccd_stream_encoder[0].label,ccd_stream_encoder[0].s)
print(ccd_stream_encoder[1].name,ccd_stream_encoder[1].label,ccd_stream_encoder[1].s)
#config new state
ccd_stream_encoder[0].s=0
ccd_stream_encoder[1].s=1
indiclient.sendNewSwitch(ccd_stream_encoder)

#verify active devices
ccd_active_devices=device_ccd.getText("ACTIVE_DEVICES")
while not(ccd_active_devices):
    time.sleep(0.5)
    ccd_active_devices=device_ccd.getText("ACTIVE_DEVICES")

# we should inform the indi server that we want to receive the
# "CCD1" blob from this device
indiclient.setBLOBMode(PyIndi.B_ALSO, ccd, "CCD1")

ccd_ccd1=device_ccd.getBLOB("CCD1")
while not(ccd_ccd1):
    time.sleep(0.5)
    ccd_ccd1=device_ccd.getBLOB("CCD1")

# we use here the threading.Event facility of Python
# we define an event for newBlob event
blobEvent=threading.Event()
blobEvent.clear()
#define a new exposure time
ccd_exposure[0].value=0.002
print str(ccd_exposure[0].value)
indiclient.sendNewNumber(ccd_exposure)
#define a new gain value to CCD
ccd_controls[0].value=1
print str(ccd_controls[0].value)
indiclient.sendNewNumber(ccd_controls)
# wait for the time exposure
blobEvent.wait()
# we can start immediately the next one
blobEvent.clear()
# and meanwhile process the received one
for blob in ccd_ccd1:
    print("name: ", blob.name," size: ", blob.size," format: ", blob.format)
    # pyindi-client adds a getblobdata() method to IBLOB item
    # for accessing the contents of the blob, which is a bytearray in Python
    fits=blob.getblobdata()

    print("fits data type: ", type(fits))
    print str(fits[1000])
    import cStringIO
    #write image data to StringIO buffer
    blobfile = cStringIO.StringIO(fits)
    # open a file and save buffer to disk
    with open("frame.fit", "wb") as f:
        f.write(blobfile.getvalue())

the image that i get looks:

Read More...

Hey guys!, i'm trying interfacing a ZWO ASI120MC-S CCD with Indi and pyIndi client, there is done, but i can't change the gain value yet, and this is a parameter that i need for the application,
If someone could help me with this I would appreciate it!, i'm attached my code.

Read More...