Skip to content

Commit

Permalink
smaller glitches in multiprocessing development
Browse files Browse the repository at this point in the history
  • Loading branch information
mfitzasp committed Dec 22, 2024
1 parent bb0c2d5 commit 6506490
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
13 changes: 10 additions & 3 deletions astrosource/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import traceback
import logging
from multiprocessing import Pool, cpu_count

import traceback
#from astrosource.utils import photometry_files_to_array, AstrosourceException
from astrosource.utils import AstrosourceException
from astrosource.plots import plot_variability
Expand Down Expand Up @@ -394,7 +394,9 @@ def find_variable_stars(targets, matchRadius, errorReject=0.05, parentPath=None,

#breakpoint()

potentialVariables = np.delete(starVar, outliers, axis=0)
#potentialVariables = np.delete(starVar, outliers, axis=0)

potentialVariables=starVar[outliers]

meanMags = starVar[:,2]
variations = starVar[:,3]
Expand Down Expand Up @@ -436,7 +438,12 @@ def find_variable_stars(targets, matchRadius, errorReject=0.05, parentPath=None,
else:
savetxt(parentPath / "results/potentialVariables.csv", potentialVariables , delimiter=",", fmt='%0.8f', header='RA,DEC,DiffMag,Variability')

plot_variability(outputVariableHolder, potentialVariables, parentPath, compFile)
try:
plot_variability(outputVariableHolder, potentialVariables, parentPath, compFile)
except:
print ("MTF hunting this bug")
logger.error(traceback.print_exc())
breakpoint()

plt.cla()
fig, ax = plt.subplots(figsize =(10, 7))
Expand Down
14 changes: 12 additions & 2 deletions astrosource/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,18 @@ def find_comparisons_calibrated(targets, paths, filterCode, nopanstarrs=False, n
elif cat_name == 'SkyMapper' and noskymapper==True:
logger.info("Skipping Skymapper")
else:

coords = catalogue_call(avgCoord, 1.5*radius, opt, cat_name, targets=targets, closerejectd=closerejectd)
try:
coords = catalogue_call(avgCoord, 1.5*radius, opt, cat_name, targets=targets, closerejectd=closerejectd)
except Exception as e:

if 'Could not find RA' in str(e):
raise AstrosourceException("Empty catalogue produced from catalogue call")
#pass
else:
print (e)
print ("MTF hunting this bug")
print(traceback.print_exc())
breakpoint()
# If no results try next catalogue
if len(coords.ra) == 0:
coords=[]
Expand Down
19 changes: 12 additions & 7 deletions astrosource/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from astropy.units import degree, arcsecond
import logging
import numpy as np
import traceback

#from astrosource.utils import photometry_files_to_array, AstrosourceException
from astrosource.utils import AstrosourceException
Expand Down Expand Up @@ -94,13 +95,17 @@ def plot_variability(output, variableID, parentPath, compFile):
if (parentPath / 'results/calibCompsUsed.csv').exists():
logger.debug("Calibrated")
calibCompFile=genfromtxt(parentPath / 'results/calibCompsUsed.csv', dtype=float, delimiter=',')

if len(calibCompFile) == 5:
calibCompSkyCoord = SkyCoord(calibCompFile[0],calibCompFile[1], frame='icrs', unit=degree)
calibnumber=1
else:
calibCompSkyCoord = SkyCoord(calibCompFile[:,0],calibCompFile[:,1], frame='icrs', unit=degree)
calibnumber=len(calibCompSkyCoord)
try:
if len(calibCompFile) == 5 and calibCompFile.size == 5:
calibCompSkyCoord = SkyCoord(calibCompFile[0],calibCompFile[1], frame='icrs', unit=degree)
calibnumber=1
else:
calibCompSkyCoord = SkyCoord(calibCompFile[:,0],calibCompFile[:,1], frame='icrs', unit=degree)
calibnumber=len(calibCompSkyCoord)
except:
print ("MTF FIXING THIS ERROR")
logger.error(traceback.print_exc())
breakpoint()
calibCompExist=True

calibCompStarPlot = []
Expand Down

0 comments on commit 6506490

Please sign in to comment.