Giter VIP home page Giter VIP logo

tuglib's Introduction

tuglib

Yet another Astronomical Reduction and Analysis Tool.

FitsCollection

Basic usage

from tuglib.io import FitsCollection


# Get all fits file from directory.
images = FitsCollection(
    location='/Users/oguzhan/tmp/20180901N/', gain=0.57, read_noise=4.11)

# Get 'ccd' objects from collection where 'object' keyword equal 'BIAS'.
biases = images.ccds(OBJECT='BIAS')

# Filtered search example.
# Select 'filename' and 'exptime' columns from collection
# where 'object' or 'imagetyp' keywords equals 'FLAT' and
# 'filter' keyword equals 'W1:03 V W2:00 Empty' and
# 'exptime' keyword less than 0.06 seconds.

f0 = images['OBJECT'] == 'FLAT'
f1 = images['IMAGETYP'] == 'FLAT
f2 = images['FILTER'] == 'W1:03 V W2:00 Empty'
f3 = images['EXPTIME'] < 0.06

filtered_flats = images[(f0 | f1) & f2 & f3]['filename', 'EXPTIME']
print(filtered_flats)
                     filename                     EXPTIME
                      str64                       float64
------------------------------------------------- -------
/Users/oguzhan/tmp/20180901N/BDF/FLAT_0018_V.fits    0.05
/Users/oguzhan/tmp/20180901N/BDF/FLAT_0019_V.fits    0.05
# Get 'ccd' objects from 'filtered_flats' collection.
flats = images(filtered_flats)

Concatenate two collection

from tuglib.io import FitsCollection

c1 = FitsCollection(location='/home/user/datas/20190620')
c2 = FitsCollection(location='/home/user/datas/20190621')

c = c1 + c2

files = c.files_filtered(OBJECT='BIAS')

Uploading 'fits' files to remote computer

from tuglib.io import FitsCollection

images = FitsCollection(location='/home/user/datas/20190621')

images.upload(hostname='192.168.0.1', username='guest', password='1234',
              remote_path='/home/guest/works', OBJECT='BIAS')

Image Combine

Generic Combine

from tuglib.io import FitsCollection
from tuglib.reduction import image_combine


images = FitsCollection('/home/user/data/m31')

ccds = images.ccds(OBJECT='M31_R')
master_image = image_combine(ccds, method='sum', output='master.fits')

Bias, Dark and Flat Combine

from tuglib.io import FitsCollection
from tuglib.reduction import bias_combine, dark_combine, flat_combine


path = '/home/user/data/20181026'
masks = ['[:, 1023:1025]', '[:1023, 56:58]']
trim = '[:, 24:2023]'

images = FitsCollection(location=path, gain=0.57, read_noise=4.11)

bias_ccds = images.ccds(OBJECT='BIAS', trim=trim, masks=masks)
dark_ccds = images.ccds(OBJECT='DARK', EXPTIME=10, trim=trim, masks=masks)
flat_ccds = images.ccds(OBJECT='FLAT', FILTER='V', trim=trim, masks=masks)

master_bias = bias_combine(bias_ccds, method='median')
master_dark = dark_combine(dark_ccds, master_bias, method='median')
master_flat = flat_combine(flat_ccds, master_bias, master_dark, method='median')

Basic Reduction (Bias, Dark and Flat Corrections)

from tuglib.reduction import ccdproc


sci_ccds = images.ccds(OBJECT='Star', FILTER='V', trim=trim, masks=masks)

# Yield a generator which point reduced images.
reduced_ccds = ccdproc(sci_ccds, master_bias, master_dark, master_flat)

tuglib's People

Contributors

ookuyan avatar yucelkilic avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.