galfitools.batch package¶
Submodules¶
galfitools.batch.batchGetBT module¶
Process a list of GALFIT files and compute B/T quantities.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies get_bt() to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetBT.BTResult(relative_path: str, bulge_total: float | None, totmag: float | None, n_components: int | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetBT.mainbatchGetBT() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetBT.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetBT.print_summary(results: Iterable[BTResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[BTResult]) – Results to summarize.
- galfitools.batch.batchGetBT.process_file(file_path: Path, base_dir: Path, dis: float, num_comp: int) BTResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetBT.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, num_comp: int) list[BTResult][source]¶
Process all files in the input iterable.
- Parameters:
- Returns:
Collected results for all files.
- Return type:
galfitools.batch.batchGetBarSize module¶
- class galfitools.batch.batchGetBarSize.BarResult(relative_path: Path, input_galfit: Path, bar_size: float | None, bar_size_arcsec: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one input file.
- galfitools.batch.batchGetBarSize.getMulBarSize(list_file: str, dis: int, numcomp: int, plot: bool, ranx: list, out: str, red: bool, scale: float, method: str, output_file: str) float[source]¶
gets the bar length of the spiral galaxies
It runs getBarSize to estimate the barlength over multiple files given the path of each one in a file.
It assumes the bar model is the second component of the GALFIT file. Bar model can be a Sersic or Ferrer function. The rest of components must be Sersic (or related) models.
- Parameters:
file (str) – file containing the paths of every GALFIT file
dis (int) – maximum list among components
numcomp (int) – Number of component where it’ll obtain center of all components. in other words it selects the galaxy that contains the bar if simultaneous fitting of galaxies was used.
plot (bool) – If True, it draws plots of the break and kappa radius
ranx (list) – range of search (xmin to xmax) for the kappa radius and break radius. If None, it will search in a range of r=1 to 2.5*Re of effetive radius of the bar model.
out (str) – Name of the output file for the DS9 ellipse region marking the bar.
output_file (str) – Name of the output file for the output barlength results
red (bool) – If True, draws DS9 region ellipse as red color
scale (float) – constant to multiply the bar length. Default =1
method (str) – indicates which method is used to measure the bar length. Options include ‘break_kappa’, ‘break’ ‘kappa’,’re’, ‘retot’. Default=’break_kappa’
- Returns:
Exit status code.
- Return type:
See also
getBarSizeget the bar length
- galfitools.batch.batchGetBarSize.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetBarSize.print_summary(results: Iterable[BarResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[BarResult]) – Results to summarize.
- galfitools.batch.batchGetBarSize.process_file(file_path: Path, base_dir: Path, dis, numcomp, plot, ranx, out, red, scale, method) BarResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – File to process.
base_dir (Path) – Directory from which relative paths are computed.
parameters (rest of)
- Returns:
Result object with status, computed bar size, and message.
- Return type:
- galfitools.batch.batchGetBarSize.process_files(file_paths: Iterable[Path], base_dir: Path, dis, numcomp, plot, ranx, out, red, scale, method) list[BarResult][source]¶
Process all files in the input iterable.
- galfitools.batch.batchGetBarSize.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- Parameters:
list_file (Path) – Path to the file containing the list of input file paths.
encoding (str, optional) – File encoding.
- Returns:
List of resolved input paths.
- Return type:
list[Path]
- Raises:
FileNotFoundError – If the list file does not exist.
ValueError – If no valid file paths are found.
galfitools.batch.batchGetBreak module¶
Process a list of GALFIT files and compute the break radius using the second-derivative method.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies getBreak2 to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetBreak.Break2Result(relative_path: str, rbreak: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetBreak.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchGetBreak.mainbatchGetBreak() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetBreak.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetBreak.print_summary(results: Iterable[Break2Result]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[Break2Result]) – Results to summarize.
- galfitools.batch.batchGetBreak.process_file(file_path: Path, base_dir: Path, dis: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) Break2Result[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create diagnostic plots.
ranx (tuple[float, float] | None) – Range for plotting and searching.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetBreak.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) list[Break2Result][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create diagnostic plots.
ranx (tuple[float, float] | None) – Range for plotting and searching.
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchGetBreak.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchGetBreak.write_results(results: Iterable[Break2Result], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[Break2Result]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batchGetKappa module¶
Process a list of GALFIT files and compute the kappa radius.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies get_kappa2() to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetKappa.Kappa2Result(relative_path: str, rkappa: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetKappa.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchGetKappa.mainbatchGetKappa() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetKappa.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetKappa.print_summary(results: Iterable[Kappa2Result]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[Kappa2Result]) – Results to summarize.
- galfitools.batch.batchGetKappa.process_file(file_path: Path, base_dir: Path, dis: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) Kappa2Result[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create diagnostic plots.
ranx (tuple[float, float] | None) – Range for plotting and searching.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetKappa.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) list[Kappa2Result][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create diagnostic plots.
ranx (tuple[float, float] | None) – Range for plotting and searching.
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchGetKappa.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchGetKappa.write_results(results: Iterable[Kappa2Result], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[Kappa2Result]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batchGetMeRad module¶
Process a list of GALFIT files and compute surface-brightness values at a given radius.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies getMeRad() to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetMeRad.MeRadResult(relative_path: str, totmag: float | None, meanmerad: float | None, merad: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetMeRad.mainbatchGetMeRad() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetMeRad.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetMeRad.print_summary(results: Iterable[MeRadResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[MeRadResult]) – Results to summarize.
- galfitools.batch.batchGetMeRad.process_file(file_path: Path, base_dir: Path, dis: float, rad: float, angle: float, num_comp: int, mecorr: float) MeRadResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
rad (float) – Radius at which the surface brightness is computed.
angle (float) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component from which the center is determined.
mecorr (float) – Surface-brightness correction for universe expansion.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetMeRad.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, rad: float, angle: float, num_comp: int, mecorr: float) list[MeRadResult][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
rad (float) – Radius at which the surface brightness is computed.
angle (float) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component from which the center is determined.
mecorr (float) – Surface-brightness correction for universe expansion.
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchGetMeRad.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchGetMeRad.write_results(results: Iterable[MeRadResult], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[MeRadResult]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batchGetN module¶
Process a list of GALFIT files and estimate the Sersic index.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies getN() to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetN.NResult(relative_path: str, sersic: float | None, mean_ns: float | None, std_ns: float | None, totmag: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetN.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchGetN.mainbatchGetN() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetN.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetN.print_summary(results: Iterable[NResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[NResult]) – Results to summarize.
- galfitools.batch.batchGetN.process_file(file_path: Path, base_dir: Path, dis: float, frac: float, angle: float | None, num_comp: int, plot: bool, const: float) NResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
frac (float) – Fraction of light.
angle (float | None) – Angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create the Sersic-index plot.
const (float) – Constant subtracted from the plot.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetN.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, frac: float, angle: float | None, num_comp: int, plot: bool, const: float) list[NResult][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
frac (float) – Fraction of light.
angle (float | None) – Angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create the Sersic-index plot.
const (float) – Constant subtracted from the plot.
- Returns:
Collected results for all files.
- Return type:
galfitools.batch.batchGetReComp module¶
Process a list of GALFIT files and compute the effective radius or another light-fraction radius.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies getReComp to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetReComp.ReCompResult(relative_path: str, effrad: float | None, totmag: float | None, meanme: float | None, me: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetReComp.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchGetReComp.mainbatchGetReComp() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetReComp.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetReComp.print_summary(results: Iterable[ReCompResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[ReCompResult]) – Results to summarize.
- galfitools.batch.batchGetReComp.process_file(file_path: Path, base_dir: Path, dis: float, eff: float, angle: float | None, num_comp: int, mecorr: float) ReCompResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
eff (float) – Fraction of total light.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
mecorr (float) – Surface-brightness correction for universe expansion.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetReComp.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, eff: float, angle: float | None, num_comp: int, mecorr: float) list[ReCompResult][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
eff (float) – Fraction of total light.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
mecorr (float) – Surface-brightness correction for universe expansion.
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchGetReComp.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchGetReComp.write_results(results: Iterable[ReCompResult], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[ReCompResult]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batchGetSlope module¶
Process a list of GALFIT files and compute the slope radius.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies getSlope to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
Python 3.11+
- class galfitools.batch.batchGetSlope.SlopeResult(relative_path: str, rgam: float | None, n_components: int | None, theta: float | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchGetSlope.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchGetSlope.mainbatchGetSlope() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchGetSlope.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchGetSlope.print_summary(results: Iterable[SlopeResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[SlopeResult]) – Results to summarize.
- galfitools.batch.batchGetSlope.process_file(file_path: Path, base_dir: Path, dis: float, slope: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) SlopeResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
file_path (Path) – GALFIT file to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
slope (float) – Value of the slope at which the radius is determined.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create a diagnostic plot.
- Returns:
Result object with rounded outputs and status information.
- Return type:
- galfitools.batch.batchGetSlope.process_files(file_paths: Iterable[Path], base_dir: Path, dis: float, slope: float, angle: float | None, num_comp: int, plot: bool, ranx: tuple[float, float] | None) list[SlopeResult][source]¶
Process all files in the input iterable.
- Parameters:
file_paths (Iterable[Path]) – Files to process.
base_dir (Path) – Directory from which relative paths are computed.
dis (float) – Maximum distance among components.
slope (float) – Value of the slope at which the radius is determined.
angle (float | None) – Position angle of the major axis of the galaxy.
num_comp (int) – Number of component used to define the center.
plot (bool) – If True, create a diagnostic plot.
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchGetSlope.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchGetSlope.write_results(results: Iterable[SlopeResult], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[SlopeResult]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batchSersic2Ferrer module¶
script to process a list of GALFIT files and convert Sersic bar components to Ferrer components.
This script reads a text file containing one GALFIT file path per line, changes to the directory of each file, applies Sersic2Ferrer() to the file, stores the results, and writes them to an output CSV file.
The stored path is relative to the directory where the program is launched.
- class galfitools.batch.batchSersic2Ferrer.Sersic2FerrerResult(relative_input_path: str, relative_output_path: str | None, success: bool, message: str = '')[source]¶
Bases:
objectStore the processing result for one GALFIT file.
- galfitools.batch.batchSersic2Ferrer.build_parser() ArgumentParser[source]¶
Build and return the command-line argument parser.
- Returns:
Configured argument parser.
- Return type:
- galfitools.batch.batchSersic2Ferrer.mainbatchSersic2Ferrer() int[source]¶
Run the script.
- Returns:
Exit status code.
- Return type:
- galfitools.batch.batchSersic2Ferrer.make_output_name(file_path: Path, suffix: str) str[source]¶
Build the output GALFIT file name for one input file.
- galfitools.batch.batchSersic2Ferrer.make_relative_path(file_path: Path, base_dir: Path) str[source]¶
Return the file path relative to the base directory.
If the file is not inside the base directory, return the full path.
- Parameters:
file_path (Path) – Absolute path to the file.
base_dir (Path) – Base directory used to compute the relative path.
- Returns:
Relative path if possible, otherwise absolute path as string.
- Return type:
- galfitools.batch.batchSersic2Ferrer.print_summary(results: Iterable[Sersic2FerrerResult]) None[source]¶
Print a short summary of the processing results.
- Parameters:
results (Iterable[Sersic2FerrerResult]) – Results to summarize.
- galfitools.batch.batchSersic2Ferrer.process_file(file_path: Path, base_dir: Path, alpha: bool, beta: bool, suffix: str) Sersic2FerrerResult[source]¶
Change to the file directory, process the file, and return the result.
- Parameters:
- Returns:
Result object with status information.
- Return type:
- galfitools.batch.batchSersic2Ferrer.process_files(file_paths: Iterable[Path], base_dir: Path, alpha: bool, beta: bool, suffix: str) list[Sersic2FerrerResult][source]¶
Process all files in the input iterable.
- Parameters:
- Returns:
Collected results for all files.
- Return type:
- galfitools.batch.batchSersic2Ferrer.read_file_list(list_file: Path, encoding: str = 'utf-8') list[Path][source]¶
Read a text file containing one file path per line.
Empty lines and lines starting with ‘#’ are ignored.
- galfitools.batch.batchSersic2Ferrer.write_results(results: Iterable[Sersic2FerrerResult], output_file: Path) None[source]¶
Write processing results to a CSV file.
- Parameters:
results (Iterable[Sersic2FerrerResult]) – Results to write.
output_file (Path) – Destination CSV file.
galfitools.batch.batch_galfit module¶
Batch-run GALFIT over a list of input files.
Each non-empty, non-comment line in the list file must contain the path to a GALFIT input file, for example:
/obj1/z/galfit.init /obj2/z/galfit.init /obj3/z/galfit.init
Features¶
Serial execution with –jobs 1
Parallel execution with –jobs N using concurrent.futures
Safe subprocess execution without shell=True
Ignores empty lines and comment lines starting with ‘#’
Checks that each input file exists
Continues even if some jobs fail
Captures return code, stdout, and stderr
Optional verbose output
Optional CSV summary report
Exit status¶
0 if all jobs succeed
non-zero if any job fails or input validation fails
- class galfitools.batch.batch_galfit.JobResult(input_file: Path, success: bool, returncode: int, stdout: str, stderr: str, error_message: str | None = None)[source]¶
Bases:
objectStore the result of one GALFIT execution.
- galfitools.batch.batch_galfit.log(message: str) None[source]¶
Print a timestamped log message in a thread-safe way.
- galfitools.batch.batch_galfit.print_failure_details(results: Iterable[JobResult]) None[source]¶
Print detailed information only for failed jobs.
- galfitools.batch.batch_galfit.print_streams(result: JobResult) None[source]¶
Print stdout/stderr of one job in a readable block.
- galfitools.batch.batch_galfit.print_summary(results: Sequence[JobResult]) None[source]¶
Print a final execution summary.
- galfitools.batch.batch_galfit.read_list_file(list_file: Path) List[Path][source]¶
Read the list file and return the input paths.
Empty lines and lines starting with ‘#’ are ignored. Environment variables and ‘~’ are expanded. Relative paths are resolved against the current working directory.
- galfitools.batch.batch_galfit.run_galfit(input_file: Path, galfit_bin: str, imax: int, verbose: bool = False) JobResult[source]¶
Run GALFIT on one input file.
GALFIT is executed from the directory that contains the input file, and the input filename is passed as a basename. This is usually the safest approach because GALFIT commonly writes outputs relative to the working directory.
- galfitools.batch.batch_galfit.run_parallel(files: Sequence[Path], galfit_bin: str, imax: int, jobs: int, verbose: bool) List[JobResult][source]¶
Run GALFIT in parallel using a thread pool.
- galfitools.batch.batch_galfit.run_serial(files: Sequence[Path], galfit_bin: str, imax: int, verbose: bool) List[JobResult][source]¶
Run GALFIT sequentially.