<commit_before># Import the relevant PTS classes and modules
import sys
import os
sys.path.insert(0, '../')
sys.path.append( str( os.path.join( os.path.split( os.path.dirname(os.path.abspath(__file__)) )[0], 'CAAPR_AstroMagic', 'PTS') ) )
import numpy as np
import warnings
import signal
import shutil
import pts
import pdb
import pickle
import time as pytime
import astropy.io.fits
import astropy.wcs
from astropy.units import Unit
import pyregion
import ChrisFuncs
from pts.magic.core.image import Image
from pts.magic.misc.imageimporter import ImageImporter
from pts.magic.sources.finder import SourceFinder
from pts.magic.catalog.importer import CatalogImporter
from pts.magic.sources.extractor import SourceExtractor
from pts.core.tools import configuration
from pts.core.tools import logging, time, filesystem
from pts.magic.basics.region import Region





# Define function that wraps the AstroMagic calling procedure
def Magic(pod, source_dict, band_dict, kwargs_dict):
    in_fitspath = pod['in_fitspath']
    temp_dir_path = pod['temp_dir_path']

    # Ensure star-subtraction is actually required
    if kwargs_dict['starsub']!=True:
        return pod
    if band_dict['remove_stars']!=True:
        return pod
    if band_dict['band_name'] in str(source_dict['remove_stars_bands_exclude']).split(';'):
        print '['+pod['id']+'] User explicitly excluded current band from star subtraction for this source.'
        return pod
    if pod['verbose']: print '['+pod['id']+'] Removing foreground stars and background galaxies with PTS AstroMagic.'


    """
    # Handle repeated attempts and timeouts
    def Handler(signum, frame):
        raise Exception("Timout!")
    signal.signal(signal.SIGALRM, Handler)
    try:
        signal.alarm(3600)<commit_msg>Added option to exclude individual bands for given source from starsub<commit_after># Import the relevant PTS classes and modules
import sys
import os
sys.path.insert(0, '../')
sys.path.append( str( os.path.join( os.path.split( os.path.dirname(os.path.abspath(__file__)) )[0], 'CAAPR_AstroMagic', 'PTS') ) )
import numpy as np
import warnings
import signal
import shutil
import pts
import pdb
import pickle
import time as pytime
import astropy.io.fits
import astropy.wcs
from astropy.units import Unit
import pyregion
import ChrisFuncs
from pts.magic.core.image import Image
from pts.magic.misc.imageimporter import ImageImporter
from pts.magic.sources.finder import SourceFinder
from pts.magic.catalog.importer import CatalogImporter
from pts.magic.sources.extractor import SourceExtractor
from pts.core.tools import configuration
from pts.core.tools import logging, time, filesystem
from pts.magic.basics.region import Region





# Define function that wraps the AstroMagic calling procedure
def Magic(pod, source_dict, band_dict, kwargs_dict):
    in_fitspath = pod['in_fitspath']
    temp_dir_path = pod['temp_dir_path']

    # Ensure star-subtraction is actually required
    if kwargs_dict['starsub']!=True:
        return pod
    if band_dict['remove_stars']!=True:
        return pod
    if band_dict['band_name'] in str(source_dict['remove_stars_bands_exclude']).split(';'):
        print '['+pod['id']+'] User explicitly excluded current band from star subtraction for this source.'
        return pod
    if str(source_dict['remove_stars_bands_exclude'])=='True':
        print '['+pod['id']+'] User explicitly requested no star subtraction for this source.'
        return pod
    if pod['verbose']: print '['+pod['id']+'] Removing foreground stars and background galaxies with PTS AstroMagic.'


    """
    # Handle repeated attempts and timeouts
    def Handler(signum, frame):
        raise Exception("Timout!")
    signal.signal(signal.SIGALRM, Handler)
    try:
        signal.alarm(3600)
{'fraction_non_alphanumeric': 0.09894179894179894, 'fraction_numerical': 0.0031746031746031746, 'mean_word_length': 4.455988455988456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4721659', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1110, 'n_words': 350}