Git Product home page Git Product logo

ccd-data-reducer's Introduction

astro_reduction_tool

astro_reduction_tool is a command-line progam for astro data reduction.

Requirements

  • Python 3.10.8+
  • Miniconda 22.11.1+
  • Ccdproc 2.3.2+
  • Astropy 5.2+

Installation

install ccdproc using

conda install -c conda-forge ccdproc

install astropy using

conda install astropy

Usage

Data format

This program needs a specific data format. (year_month_day/object_objectid) and there must be subfolder with flats named 'flat'

Reduction

To start use:

python astro_reduction_tool.py -d main_folder_dir -md master_dark_dir -mb master_bias_dir
Argument Required Description
-d Yes The path to the directory
-mb Yes The path to the master_bias
-md Yes The path to the master_dark
-mf No The path to the master_flats. if you already made master_flats and you don't want to make new ones just add -mf dir-to-flat-subfolder

Make sure to replace main_folder_dir, master_dark_dir, and master_bias_dir with the actual file paths on your system. For example:

python astro_reduction_tool.py -d 2023_01_05/ -md ../dark_mode3_usb50_gain0_offset10_temp-5.fit -mb ../bias_mode3_usb50_gain0_offset10_temp-5.fit 

Development

Imports are organized with isort.

Code is formatted with black.

Master_flats are saved in flat folder.

ccd-data-reducer's People

Contributors

janandrzejewski avatar michalzg avatar

Stargazers

 avatar

Watchers

 avatar

ccd-data-reducer's Issues

rewrite read_path_into function

idea how to rewrite function

def read_path_into_CCDData(data_path, keys, _filter=None):
    ccd_list = []

    if not os.path.isdir(data_path): # better to add pattern  glob_include and ext parameters
        logger.error(f"No directory {data_path}")
        raise ValueError(f"No directory {data_path}")

    logger.info(f"Loading data from: {data_path}")
    ccd_collection = ccdp.ImageFileCollection(data_path, keywords=keys)

    if _filter:
        ccd_collection = ccd_collection.files_filtered(filter=_filter)

    for ccd_path in ccd_collection:
        dir = os.path.join(data_path, ccd_path)
        
        ccd_file = CCDData(
            fits.getdata(dir), meta=fits.getheader(dir, keywords=keys), unit="adu"
            )

        ccd_list.append(ccd_file)   
        
        logger.info(
                # for timestamp use 
                # logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
                # or similar,
                ccd_file.header["IMAGETYP"],
                dir,
                # h + 1, 
                # len(ccd_p), do you need this?
            )

    return ccd_list # even if one file return it as list, unique return type is simpler later

Logger and formatting

Few propositions for a code

  • I think it would be a good idea to split the code into functions
  • I suggest using a logger, here you can find a nice tutorial -> https://realpython.com/python-logging/
  • Try Black "uncompromising Python code formatter."
  • Use only English language in a code, it will be easier for everyone to understand the code.

Cheers,

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.