From 0a89320b8726ae628f981a4bc13ba2c62d40e86b Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 18 Jul 2024 00:25:27 +0000 Subject: [PATCH] build based on 7dba109 --- dev/.documenter-siteinfo.json | 2 +- dev/api/index.html | 34 +++++++++++++++++----------------- dev/index.html | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 7f5414c..e9bdc82 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-18T00:23:14","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-18T00:25:23","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 2078338..72a7afa 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,11 +1,11 @@ -API/Reference · CCDReduction.jl

API/Reference

For now, here is a list of all documented functions.

Index

API/Reference

CCDReduction.AbstractCCDDataType
abstract type AbstractCCDData{T} <: AbstractMatrix{T}

Supertype for CCDData based on AbstractMatrix interface.

Every subtype of this type should have methods data and hdr defined.

source
CCDReduction.CCDDataType
CCDData <: AbstractCCDData
+API/Reference · CCDReduction.jl

API/Reference

For now, here is a list of all documented functions.

Index

API/Reference

CCDReduction.AbstractCCDDataType
abstract type AbstractCCDData{T} <: AbstractMatrix{T}

Supertype for CCDData based on AbstractMatrix interface.

Every subtype of this type should have methods data and hdr defined.

source
CCDReduction.CCDDataType
CCDData <: AbstractCCDData
 CCDData(data::AbstractMatrix, [hdr::FITSHeader])

Struct to store ImageHDU, derived from AbstractCCDData.

CCDData acts like a matrix with a header associated.

ccd = CCDData(zeros(4, 4))
 
 ccd[1]

This accesses the 1st element in matrix associated with ccd.

ccd["SIMPLE"]

One can also access the header directly from ccd, the key can be Symbol as well.

ccd[:SIMPLE] = false

Header values can be directly modified from ccd.

One can perform arithmetic operations on it as well:

ccd1 = CCDData(zeros(4, 4))
 ccd2 = CCDData(ones(4, 4))
 sum_ccd1 = ccd1 + ccd2
-sum_ccd2 = ccd2 + ccd1

sum_ccd1 has the header of ccd1 whereas sum_ccd2 has the header ccd2.

If header is not provided in the CCDData constructor, default_header is used to generate the header.

source
CCDReduction.CCDDataMethod
CCDData(path::AbstractString; hdu = 1)

Loads HDU from hdu index in FITS file at path as CCDData.

source
CCDReduction.arraysFunction
arrays(collection)

Generator for arrays of images of entries in data frame.

Iterates over collection using each path and hdu to load data into an Array.

Examples

collection = fitscollection("~/data/tekdata")
+sum_ccd2 = ccd2 + ccd1

sum_ccd1 has the header of ccd1 whereas sum_ccd2 has the header ccd2.

If header is not provided in the CCDData constructor, default_header is used to generate the header.

source
CCDReduction.CCDDataMethod
CCDData(path::AbstractString; hdu = 1)

Loads HDU from hdu index in FITS file at path as CCDData.

source
CCDReduction.arraysFunction
arrays(collection)

Generator for arrays of images of entries in data frame.

Iterates over collection using each path and hdu to load data into an Array.

Examples

collection = fitscollection("~/data/tekdata")
 data = arrays(collection) |> collect

This returns all image arrays present in collection. This can also be used via a for-loop

collection = fitscollection("~/data/tekdata")
 for arr in arrays(collection)
     @assert arr isa Array
@@ -15,7 +15,7 @@
 # output
 (1048, 1068)
 (1048, 1068)
-...
source
CCDReduction.arraysMethod
arrays(f,
        collection;
        path = nothing,
        save_prefix = nothing,
@@ -28,10 +28,10 @@
     trim(arr, (:, 1040:1059))
 end

The above generates processed_images which consists of trimmed versions of image arrays present in collection. For saving the processed_images simultaneously with the operations performed

processed_images = map(arrays(collection; path = "~/data/tekdata", save_prefix = "trimmed")) do img
     trim(img, (:, 1040:1059))
-end

The trimmed image arrays are saved as trimmed_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.ccdsFunction
ccds(collection)

Generator for CCDDatas of entries in data frame.

Iterates over collection using each path and hdu to load data into a CCDData.

Examples

collection = fitscollection("~/data/tekdata")
+end

The trimmed image arrays are saved as trimmed_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.ccdsFunction
ccds(collection)

Generator for CCDDatas of entries in data frame.

Iterates over collection using each path and hdu to load data into a CCDData.

Examples

collection = fitscollection("~/data/tekdata")
 for hdu in ccds(collection)
     @assert hdu isa CCDData
-end
source
CCDReduction.ccdsMethod
ccds(f,
      collection;
      path = nothing,
      save_prefix = nothing,
@@ -44,7 +44,7 @@
     trim(img, (:, 1040:1059))
 end

The above generates processed_images which consists of trimmed versions of images present in collection.

For saving the processed_images simultaneously with the operations performed

processed_images = map(ccds(collection; path = "~/data/tekdata", save_prefix = "trimmed")) do img
     trim(img, (:, 1040:1059))
-end

The trimmed images are saved as trimmed_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.combineMethod
combine(frames...; method = median, [hdu = 1], [header_hdu = 1])
+end

The trimmed images are saved as trimmed_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.combineMethod
combine(frames...; method = median, [hdu = 1], [header_hdu = 1])
 combine(frames; method = median, [hdu = 1], [header_hdu = 1])

Combine multiple frames using method. Multiple frames can also be passed in a vector or as generators for combining.

To pass a custom method, it must have a signature like method(::AbstractArray; dims).

If frames are strings, they will be loaded into CCDDatas first. The HDU indices can be specified with hdu as either an integer or a tuple corresponding to each file.

Header of output file (if applicable) is specified by header_hdu which by default is 1.

Examples

julia> frame = [reshape(1.0:4.0, (2, 2)) for i = 1:4];
 
 julia> combine(frame)
@@ -56,7 +56,7 @@
 2×2 Matrix{Float64}:
  4.0  12.0
  8.0  16.0
-
source
CCDReduction.cropMethod
crop(frame, shape; force_equal = true, [hdu = 1])

Crops frame to the size specified by shape anchored by the frame center.

This will remove rows/cols of the frame equally on each side. When there is an uneven difference in sizes (e.g. size 9 -> 6 can't be removed equally) the default is to increase the output size (e.g. 6 -> 7) so there is equal removal on each side. To disable this, set force_equal=false, which will remove the extra slice from the end of the axis.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = reshape(1:25, (5, 5));
+
source
CCDReduction.cropMethod
crop(frame, shape; force_equal = true, [hdu = 1])

Crops frame to the size specified by shape anchored by the frame center.

This will remove rows/cols of the frame equally on each side. When there is an uneven difference in sizes (e.g. size 9 -> 6 can't be removed equally) the default is to increase the output size (e.g. 6 -> 7) so there is equal removal on each side. To disable this, set force_equal=false, which will remove the extra slice from the end of the axis.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = reshape(1:25, (5, 5));
 
 julia> crop(frame, (3, 3))
 3×3 Matrix{Int64}:
@@ -69,7 +69,7 @@
  6  11  16
  7  12  17
  8  13  18
- 9  14  19

See Also

cropview

source
CCDReduction.cropviewMethod
cropview(frame, shape; force_equal = true)

Crops frame to the size specified by shape anchored by the frame center.

This function is same as the crop function but returns a view of the frame.

Note

This function returns a view of the frame, so any modification to output array will result in modification of frame.

See Also

crop

source
CCDReduction.filenamesFunction
filenames(collection)

Generator for filenames of entries in data frame.

Iterates over collection using each path.

Examples

collection = fitscollection("~/data/tekdata")
+ 9  14  19

See Also

cropview

source
CCDReduction.cropviewMethod
cropview(frame, shape; force_equal = true)

Crops frame to the size specified by shape anchored by the frame center.

This function is same as the crop function but returns a view of the frame.

Note

This function returns a view of the frame, so any modification to output array will result in modification of frame.

See Also

crop

source
CCDReduction.filenamesFunction
filenames(collection)

Generator for filenames of entries in data frame.

Iterates over collection using each path.

Examples

collection = fitscollection("~/data/tekdata")
 for path in filenames(collection)
     @assert path isa String
     println(path)
@@ -78,7 +78,7 @@
 # output
 "~/data/tekdata/tek001.fits"
 "~/data/tekdata/tek002.fits"
-...
source
CCDReduction.filenamesMethod
filenames(f,
           collection;
           path = nothing,
           save_prefix = nothing,
@@ -97,7 +97,7 @@
     data = getdata(fh[1]) # assuming all 1-hdu are ImageHDUs
     close(fh)
     data
-end

The retrieved data is saved as retrieved_from_filename_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.fitscollectionMethod
fitscollection(dir;
+end

The retrieved data is saved as retrieved_from_filename_(original_name) (FITS files) at path = "~/data/tekdata" as specified by the user.

source
CCDReduction.fitscollectionMethod
fitscollection(dir;
                recursive=true,
                abspath=true,
                keepext=true,
@@ -111,7 +111,7 @@
 
  root    dir     base   ext
 [----][-------][------][---]
-/data/test/sci/tek0001.fits

If keepext is true, name=base * ext, otherwise it is just base. If abspath is true, the path will be root * dir * base * ext, otherwise it will be dir * base * ext. These options allow flexility in creating a table that can be easily saved and loaded to avoid having to manually filter files. Especially consider how abspath can allow keeping tables that will transfer easily between computers or between data sources with common structures.

source
CCDReduction.flat_correctMethod
flat_correct(frame, flat_frame; norm_value = mean(flat_frame), [hdu = 1])

Correct frame for non-uniformity using the calibrated flat_frame.

By default, the flat_frame is normalized by its mean, but this can be changed by providing a custom norm_value.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Note

This function may introduce non-finite values if flat_frame contains values very close to 0 due to dividing by zero. The default behavior will return Inf if the frame value is non-zero, and Nan if the frame value is 0.

Examples

julia> frame = ones(3, 3);
+/data/test/sci/tek0001.fits

If keepext is true, name=base * ext, otherwise it is just base. If abspath is true, the path will be root * dir * base * ext, otherwise it will be dir * base * ext. These options allow flexility in creating a table that can be easily saved and loaded to avoid having to manually filter files. Especially consider how abspath can allow keeping tables that will transfer easily between computers or between data sources with common structures.

source
CCDReduction.flat_correctMethod
flat_correct(frame, flat_frame; norm_value = mean(flat_frame), [hdu = 1])

Correct frame for non-uniformity using the calibrated flat_frame.

By default, the flat_frame is normalized by its mean, but this can be changed by providing a custom norm_value.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Note

This function may introduce non-finite values if flat_frame contains values very close to 0 due to dividing by zero. The default behavior will return Inf if the frame value is non-zero, and Nan if the frame value is 0.

Examples

julia> frame = ones(3, 3);
 
 julia> flat = fill(2.0, (3, 3));
 
@@ -125,14 +125,14 @@
 3×3 Matrix{Float64}:
  1.0  1.0  1.0
  1.0  1.0  1.0
- 1.0  1.0  1.0

See Also

flat_correct!

source
CCDReduction.getdataMethod
CCDReduction.getdata(::FITSIO.ImageHDU)

Loads the given HDU as an Array, permuting the dimensions appropriately.

FITSIO.jl takes over memory read in by cfitsio, which reads in row-major form, whereas when Julia takes that memory, it is assumed as column major. Therefore all data read by FITSIO.read is transposed. This function allows the user to read data in a consistent way to Array by transposing after reading.

source
CCDReduction.subtract_biasMethod
subtract_bias(frame, bias_frame; [hdu = 1])

Subtract the bias_frame from frame.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Examples

julia> frame = [1.0 2.2 3.3 4.5];
+ 1.0  1.0  1.0

See Also

flat_correct!

source
CCDReduction.getdataMethod
CCDReduction.getdata(::FITSIO.ImageHDU)

Loads the given HDU as an Array, permuting the dimensions appropriately.

FITSIO.jl takes over memory read in by cfitsio, which reads in row-major form, whereas when Julia takes that memory, it is assumed as column major. Therefore all data read by FITSIO.read is transposed. This function allows the user to read data in a consistent way to Array by transposing after reading.

source
CCDReduction.subtract_biasMethod
subtract_bias(frame, bias_frame; [hdu = 1])

Subtract the bias_frame from frame.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Examples

julia> frame = [1.0 2.2 3.3 4.5];
 
 julia> bias = [0.0 0.2 0.3 0.5];
 
 julia> subtract_bias(frame, bias)
 1×4 Matrix{Float64}:
  1.0  2.0  3.0  4.0
-

See Also

subtract_bias!

source
CCDReduction.subtract_darkMethod
subtract_dark(frame, dark_frame; data_exposure = 1, dark_exposure = 1, [hdu = 1])

Subtract the dark_frame from frame.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Examples

julia> frame = ones(3, 3);
+

See Also

subtract_bias!

source
CCDReduction.subtract_darkMethod
subtract_dark(frame, dark_frame; data_exposure = 1, dark_exposure = 1, [hdu = 1])

Subtract the dark_frame from frame.

If either are strings, they will be loaded into CCDData first. The HDU loaded can be specified by hdu as either an integer or a tuple corresponding to each file.

Examples

julia> frame = ones(3, 3);
 
 julia> dark_frame = ones(3, 3);
 
@@ -147,7 +147,7 @@
  0.75  0.75  0.75
  0.75  0.75  0.75
  0.75  0.75  0.75
-

See Also

subtract_dark!

source
CCDReduction.subtract_overscanMethod
subtract_overscan(frame, idxs; dims = axes_min_length(idxs), [hdu = 1])

Subtract the overscan frame from image.

dims is the dimension along which overscan_frame is combined. The default value of dims is the axis with smaller length in overscan region. If idxs is a string it will be parsed as FITS-style indices.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = [4.0 2.0 3.0 1.0 1.0];
+

See Also

subtract_dark!

source
CCDReduction.subtract_overscanMethod
subtract_overscan(frame, idxs; dims = axes_min_length(idxs), [hdu = 1])

Subtract the overscan frame from image.

dims is the dimension along which overscan_frame is combined. The default value of dims is the axis with smaller length in overscan region. If idxs is a string it will be parsed as FITS-style indices.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = [4.0 2.0 3.0 1.0 1.0];
 
 julia> subtract_overscan(frame, (:, 4:5), dims = 2)
 1×5 Matrix{Float64}:
@@ -155,7 +155,7 @@
 
 julia> subtract_overscan(frame, "[4:5, 1:1]", dims = 2)
 1×5 Matrix{Float64}:
- 3.0  1.0  2.0  0.0  0.0

See Also

subtract_overscan!

source
CCDReduction.trimMethod
trim(frame, idxs; [hdu = 1])

Trims the frame to remove the region specified by idxs.

This function trims the array in a manner such that final array should be rectangular. The indices follow standard Julia convention, so (:, 45:60) trims all columns from 45 to 60 and (1:20, :) trims all the rows from 1 to 20. The function also supports FITS-style indices.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = ones(5, 5);
+ 3.0  1.0  2.0  0.0  0.0

See Also

subtract_overscan!

source
CCDReduction.trimMethod
trim(frame, idxs; [hdu = 1])

Trims the frame to remove the region specified by idxs.

This function trims the array in a manner such that final array should be rectangular. The indices follow standard Julia convention, so (:, 45:60) trims all columns from 45 to 60 and (1:20, :) trims all the rows from 1 to 20. The function also supports FITS-style indices.

If frame is a string, it will be loaded into CCDData first. The HDU loaded can be specified by hdu which by default is 1.

Examples

julia> frame = ones(5, 5);
 
 julia> trim(frame, (:, 2:5))
 5×1 Matrix{Float64}:
@@ -172,5 +172,5 @@
  1.0
  1.0
  1.0
-

See Also

trimview

source
CCDReduction.trimviewMethod
trimview(frame, idxs)

Trims the frame to remove the region specified by idxs.

This function is same as the trim function but returns a view of the frame.

Note

This function returns a view of the frame, so any modification to output array will result in modification of frame.

See Also

trim

source
CCDReduction.writefitsMethod
CCDReduction.writefits(file_path, data; header = nothing)
-CCDReduction.writefits(file_path, ccd::CCDData)

Writes data/ccd in FITS format at file_path.

FITSIO takes over memory write in by cfitsio, which writes in row-major form, whereas when Julia gives that memory, it is assumed as column major. Therefore all data written by FITSIO.write is transposed. This function allows the user to write the data in a consistent way to FITS file by transposing before writing.

source
+

See Also

trimview

source
CCDReduction.trimviewMethod
trimview(frame, idxs)

Trims the frame to remove the region specified by idxs.

This function is same as the trim function but returns a view of the frame.

Note

This function returns a view of the frame, so any modification to output array will result in modification of frame.

See Also

trim

source
CCDReduction.writefitsMethod
CCDReduction.writefits(file_path, data; header = nothing)
+CCDReduction.writefits(file_path, ccd::CCDData)

Writes data/ccd in FITS format at file_path.

FITSIO takes over memory write in by cfitsio, which writes in row-major form, whereas when Julia gives that memory, it is assumed as column major. Therefore all data written by FITSIO.write is transposed. This function allows the user to write the data in a consistent way to FITS file by transposing before writing.

source
diff --git a/dev/index.html b/dev/index.html index b752a05..f3ba3b7 100644 --- a/dev/index.html +++ b/dev/index.html @@ -27,4 +27,4 @@ subtract_bias(__, "master_bias.fits") # apply pipeline to images using broadcast syntax -calib_imgs = pipeline.(imgs)

License

This work is distributed under the MIT "expat" license. See LICENSE for more information.

+calib_imgs = pipeline.(imgs)

License

This work is distributed under the MIT "expat" license. See LICENSE for more information.