Commit c4f7112c authored by Carl Schaffer's avatar Carl Schaffer
Browse files

Merge branch '268-documentation-add-documentation-for-scripts-in-bin-folder' into 'master'

Resolve "Documentation: add documentation for scripts in bin folder"

Closes #268

See merge request !210
parents 61c91bb3 72fd54ab
# Commandline Tools
## bbi_gen_gifs
Collects images created by the BBI speckle pipeline and generated GIF and mp4 files from them.
Looks for png files containing one of the markers 'reco' 'alpha' or 'location'
```shell
usage: bbi_gen_gifs [-h] [-v] folder_in
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
```
## bbi_header_conversion
Runs BBI header conversion. Requires renaming and sorting beforehand. Kis tools provides functionality to do this,
albeit not in an automated way, only using the REPL.
```shell
usage: bbi_header_conversion [-h] [-v] [-o FOLDER_OUT] folder_in
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
-o FOLDER_OUT, --folder_out FOLDER_OUT
Output folder, all output files will be stored here, (default: /dat/sdc/bbi/)
```
## gris_gen_maps
Generate preview images for gris observations. Target a day-level gris folder with this utility to generate
png files containing continuum maps for the observations within.
```shell
usage: gris_gen_maps [-h] [-v] [-o OUTFOLDER] [-r RUN] folder_in
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
-o OUTFOLDER, --output OUTFOLDER
target folder for storing generated maps. All maps are stored in a subfolder 'day/context/data/map.png'. If no folder is specified, a context data folder in each day will be
createdto store results
-r RUN, --run RUN run number
```
## gris_location_plot
Generate location preview images for gris observations. Target a day-level gris folder with this utility to generate
png files containing HMI continuum images with the extent of the observation overplotted.
```shell
usage: gris_location_plot [-h] [-v] [-r RUN_NUMBER] [-o OUTPUT_FOLDER] [--disable-hmi-cache] folder_in
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
-r RUN_NUMBER, --run-number RUN_NUMBER
run number
-o OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER
folder to use for storing results
--disable-hmi-cache Disable caching of HMI data in /dat. Context data is copied to the user's home directory instead.
```
## gris_penumbral_thumbs
Generate preview images for GRIS penumbral masks, targets '*pen_mask.sav' files in the folder and produces .png versions.
```shell
usage: gris_penumbral_thumbs [-h] [-v] folder_in
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
```
## gris_plot_cont_corr
Plot the contents of `*cont_corr.sav` files to visualize the fitting process of the continuum correction.
```shell
usage: gris_plot_cont_corr [-h] [--store] files [files ...]
positional arguments:
files list of input files
optional arguments:
-h, --help show this help message and exit
--store If set, plot will not be shown but stored to the same path as the input file but as as .png
```
## gris_translate_header
Perform header conversion on GRIS split files. The files need to be generated using the `grs_split` functionality in
`grisred`. If files are already translated they are skipped.
```shell
usage: gris_translate_header [-h] [--folder_out FOLDER_OUT] [-r RUN] [-v] folder_in
positional arguments:
folder_in folder to be processed, needs to be a GRIS level1_split folder
optional arguments:
-h, --help show this help message and exit
--folder_out FOLDER_OUT
path where output is written. Defaults to input folder
-r RUN, --run RUN run number
-v, --verbose don't silence warnings
```
## grisplot
## gristagger
## lars_gen_preview
Generate preview images for LARS data. Might only be useful for data structured as in the
center limb variation measurements. The folder is required to contain `*.chvtt.sum.fits` files.
```shell
positional arguments:
folder_in folder to be processed
optional arguments:
-h, --help show this help message and exit
-v, --verbose don't silence warnings
```
## lars_logbook
LARS logbooks are stored in full files, this utility splits them into daily files which can be
ingested by the LARS importer.
```shell
usage: lars_logbook [-h] folder_in folder_out
positional arguments:
folder_in folder to be processed
folder_out folder to use for storing results
optional arguments:
-h, --help show this help message and exit
This is a commandline tool to split lars logbook files into daily files.
```
\ No newline at end of file
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from os.path import isdir
from kis_tools.bbi.plotting import bbi_gen_gif
from kis_tools.bbi.plot_utils import bbi_gen_gif
from kis_tools.interface import BasicArgParser
from kis_tools.util.swag import greeter
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from kis_tools.bbi.plotting import run_bbi_preview
from kis_tools.util.swag import greeter
if __name__ == '__main__':
print(greeter)
run_bbi_preview(sys.argv[1:])
......@@ -4,9 +4,10 @@ Created by schaffer at 2020-04-22
"""
import argparse
from kis_tools.interface.commandline_interface import add_arg_inputfolder, add_arg_outputfolder
from kis_tools.lars.createLogbook import CreateLogbook
from kis_tools.uitl.swg import greeter
from kis_tools.util.swag import greeter
print(greeter)
help_text = """This is a commandline tool to split lars logbook files into daily files."""
......
import re
from glob import glob
from itertools import groupby
from os.path import join, basename
from pprint import pprint
from kis_tools.bbi.util import get_wl
from kis_tools.util.util import merge_to_gif, gif_to_mp4
def bbi_gen_gif(folder):
"""Check a folder and merge all images of the same type into gifs and mp4s"""
outfiles = []
for pattern in ["reco", "location", "alpha"]:
files = glob(join(folder, f"*{pattern}*.png"))
if not files:
continue
files.sort(key=get_wl)
grouped = groupby(files, get_wl)
for group, grouped_files in grouped:
grouped_files = list(grouped_files)
fn = basename(grouped_files[0])
fn = re.sub(r"-\d{6}", "", fn)
fn = fn.replace(".png", ".gif")
print(fn)
outfile = join(folder, fn)
merge_to_gif(sorted(grouped_files), outfile)
gif_to_mp4(outfile)
outfiles.append(outfile)
print(f"Finished BBI gif generation, {len(outfiles)} were created:")
pprint(outfiles)
print(f"Mp4 conversion was performed for {len(outfiles)} files")
......@@ -6,20 +6,15 @@ Created by schaffer at 9/9/19
"""
import argparse
import re
import warnings
from glob import glob
from itertools import groupby
from os.path import join, basename
from os.path import basename
from warnings import catch_warnings
import matplotlib as mpl
from pypeline import pipeline
from tqdm import tqdm
from .util import get_wl
from ..util.util import merge_to_gif, gif_to_mp4
mpl.use("Agg")
import matplotlib.pyplot as plt # noqa: E402
from ..generic.fits import FitsFile # noqa: E402
......@@ -70,27 +65,6 @@ def alpha_preview(fits_file, fn_out):
return fn_out
def bbi_gen_gif(folder):
"""Check a folder and merge all images of the same type into gifs and mp4s"""
for pattern in ["reco", "location", "alpha"]:
files = glob(join(folder, f"*{pattern}*.png"))
if not files:
continue
files.sort(key=get_wl)
grouped = groupby(files, get_wl)
for group, grouped_files in grouped:
grouped_files = list(grouped_files)
fn = basename(grouped_files[0])
fn = re.sub(r"-\d{6}", "", fn)
fn = fn.replace(".png", ".gif")
print(fn)
merge_to_gif(sorted(grouped_files), join(folder, fn))
gif_to_mp4(join(folder, fn))
def run_bbi_preview(cmd_line_args):
mpl.use("Agg")
from ..interface.commandline_interface import add_arg_infiles
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment