<commit_before>
import sys
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import leastsq

from delight.utils import *
from delight.io import *

numCoefs = 15  # number of components for the fit

if len(sys.argv) < 2:
    raise Exception('Please provide a parameter file')
params = parseParamFile(sys.argv[1], verbose=False)
bandNames = params['bandNames']
fmt = '.res'
max_redshift = params['redshiftMax']  # for plotting purposes
root = params['bands_directory']
make_plots = False
if make_plots:
    import matplotlib.pyplot as plt
    cm = plt.get_cmap('brg')
    num = len(bandNames)
    cols = [cm(i/num) for i in range(num)]


# Function we will optimize
def dfunc(p, x, yd):
    y = 0*x
    n = p.size//2
    for i in range(n):
        y += np.abs(p[i]) * np.exp(-0.5*((mus[i]-x)/np.abs(p[n+i]))**2.0)
    return yd - y

if make_plots:
    fig0, ax0 = plt.subplots(1, 1, figsize=(8.2, 4))

# Loop over bands
for iband, band in enumerate(bandNames):

    fname_in = root + '/' + band + fmt
    data = np.genfromtxt(fname_in)
    coefs = np.zeros((numCoefs, 3))
    x, y = data[:, 0], data[:, 1]
    y /= x  # divide by lambda<commit_msg>catalog not needed for creating filter fit<commit_after>
import sys
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import leastsq

from delight.utils import *
from delight.io import *

numCoefs = 15  # number of components for the fit

if len(sys.argv) < 2:
    raise Exception('Please provide a parameter file')
params = parseParamFile(sys.argv[1], verbose=False, catFilesNeeded=False)
bandNames = params['bandNames']
fmt = '.res'
max_redshift = params['redshiftMax']  # for plotting purposes
root = params['bands_directory']
make_plots = False
if make_plots:
    import matplotlib.pyplot as plt
    cm = plt.get_cmap('brg')
    num = len(bandNames)
    cols = [cm(i/num) for i in range(num)]


# Function we will optimize
def dfunc(p, x, yd):
    y = 0*x
    n = p.size//2
    for i in range(n):
        y += np.abs(p[i]) * np.exp(-0.5*((mus[i]-x)/np.abs(p[n+i]))**2.0)
    return yd - y

if make_plots:
    fig0, ax0 = plt.subplots(1, 1, figsize=(8.2, 4))

# Loop over bands
for iband, band in enumerate(bandNames):

    fname_in = root + '/' + band + fmt
    data = np.genfromtxt(fname_in)
    coefs = np.zeros((numCoefs, 3))
    x, y = data[:, 0], data[:, 1]
    y /= x  # divide by lambda
{'fraction_non_alphanumeric': 0.13839099624843684, 'fraction_numerical': 0.017507294706127552, 'mean_word_length': 3.4280442804428044, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6782990', 'n_tokens_mistral': 928, 'n_tokens_neox': 885, 'n_words': 262}