Skip to content

Commit

Permalink
Upgrading to 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSkyentist committed Jan 28, 2022
2 parents 88850ba + 2a61754 commit 8122485
Show file tree
Hide file tree
Showing 34 changed files with 400 additions and 358 deletions.
28 changes: 0 additions & 28 deletions Convenience/Concat_from_results.py

This file was deleted.

54 changes: 0 additions & 54 deletions Convenience/EW_from_results.py

This file was deleted.

48 changes: 0 additions & 48 deletions Convenience/Plot_from_results.py

This file was deleted.

31 changes: 31 additions & 0 deletions Convenience/concatResults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /usr/bin/env python

""" Convinience Function to Concatenate Results """

# Packages
import argparse
import numpy as np
from astropy.table import Table

# GELATO
import gelato.Utility as U
import gelato.Concatenate as C
import gelato.ConstructParams as CP

# Main Function
if __name__ == "__main__":

# Parse Arguement
args = U.parseArgs()

# Parameters
p = CP.construct(args.Parameters)

# Assemble Objects
if args.single: # Single Mode
objects = Table([[args.Spectrum],[args.Redshift]],names=('Path','z'))
else: # Multi Mode
objects = U.loadObjects(args.ObjectList)

##Concatenate Results
C.concatfromresults(p,objects)
42 changes: 42 additions & 0 deletions Convenience/ewResults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /usr/bin/env python

""" Convinience Function to Generate Rest Equivalent Widths """

# Packages
import copy

# GELATO
import gelato.Utility as U
import gelato.ConstructParams as CP
import gelato.EquivalentWidth as EW

# Main Function
if __name__ == "__main__":

# Parse Arguement
args = U.parseArgs()

# Parameters
p = CP.construct(args.Parameters)

# Single Mode
if args.single:

EW.EWfromresults(p, args.Spectrum, args.Redshift)

# Multi Mode
else:

## Assemble Objects
objects = U.loadObjects(args.ObjectList)

# EWs
if p['NProcess'] > 1: # Mutlithread
import multiprocessing as mp
pool = mp.Pool(processes=p['NProcess'])
inputs = [(copy.deepcopy(p),o['Path'],o['z']) for o in objects]
pool.starmap(EW.EWfromresults, inputs)
pool.close()
pool.join()
else: # Single Thread
for o in objects: EW.EWfromresults(copy.deepcopy(p),o['Path'],o['z'])
3 changes: 1 addition & 2 deletions Convenience/params_to_tex.py → Convenience/paramsToTeX.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
""" Turn parameter file into LaTeX table """

# Packages
import copy
import argparse

# gelato supporting files
Expand Down Expand Up @@ -34,7 +33,7 @@ def TeX(params):
tex += 5*' & '+' & '.join(['\multirow{1}{*}{'+x+'}' for x in [group['Name'],slashbool(group['TieRedshift']),slashbool(group['TieDispersion'])]])
tex += '\\\\\n'
if i < len(params['EmissionGroups']):
tex += '\cline{0-6}\n'
tex += '\cline{0-7}\n'

# Multirow
for j,species in enumerate(group['Species']):
Expand Down
42 changes: 42 additions & 0 deletions Convenience/plotResults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /usr/bin/env python

""" Convinience Function for Plotting """

# Packages
import copy

# GELATO
import gelato.Utility as U
import gelato.Plotting as P
import gelato.ConstructParams as CP

# Main Function
if __name__ == "__main__":

# Parse Arguement
args = U.parseArgs()

# Parameters
p = CP.construct(args.Parameters)

# Single Mode
if args.single:

P.plotfromresults(p, args.Spectrum, args.Redshift)

# Multi Mode
else:

# Assemble Objects
objects = U.loadObjects(args.ObjectList)

# Plot
if p['NProcess'] > 1: # Mutlithread
import multiprocessing as mp
pool = mp.Pool(processes=p['NProcess'])
inputs = [(copy.deepcopy(p),o['Path'],o['z']) for o in objects]
pool.starmap(P.plotfromresults, inputs)
pool.close()
pool.join()
else: # Single Thread
for o in objects: P.plotfromresults(copy.deepcopy(p),o['Path'],o['z'])
61 changes: 61 additions & 0 deletions Convenience/runGELATO.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /usr/bin/env python

""" Wrapper for mulitple gelato runs """

# Packages
import os
import copy
from pathlib import Path

# GELATO
import gelato
import gelato.Utility as U
import gelato.ConstructParams as CP

# Main Function
if __name__ == "__main__":

# Parse Arguement
args = U.parseArgs()

# Parameters
p = CP.construct(args.Parameters)

## Create Directory for Output
if not os.path.exists(p["OutFolder"]):
Path(p["OutFolder"]).mkdir(parents=True)

if p['Verbose']:
now = U.header()

# Single Mode
if args.single:

gelato.gelato(args.Parameters, args.Spectrum, args.Redshift)

# Multi Mode
else:

# Assemble Objects
objects = U.loadObjects(args.ObjectList)

## Run gelato ##
if p['NProcess'] > 1: # Mutlithread
import multiprocessing as mp
pool = mp.Pool(processes=p['NProcess'])
inputs = [(copy.deepcopy(args.Parameters),o['Path'],o['z']) for o in objects]
pool.starmap(gelato.gelato, inputs)
pool.close()
pool.join()
else: # Single Thread
for o in objects:
gelato.gelato(copy.deepcopy(args.Parameters),o['Path'],o['z'])
## Run gelato ##

# Concatenate Results
if p['Concatenate']:
import gelato.Concatenate as C
C.concatfromresults(p,objects)

if p['Verbose']:
U.footer(now)
59 changes: 0 additions & 59 deletions Convenience/run_GELATO_multi.py

This file was deleted.

Loading

0 comments on commit 8122485

Please sign in to comment.