<commit_before>#!/usr/bin/env python

import sys
import os
import pyfits
import numpy as np
import pylab as py
from ring import *
import ds9

disp = ds9.ds9()
file = sys.argv[1]

hdu = pyfits.open(file)
(data, header) = (hdu[-1].data, hdu[0].header)

binning = int(header['CCDSUM'].split()[0])
ysize, xsize = data.shape

# cut FP image down to square
fp_im = data[:,(xsize-ysize)/2:(xsize+ysize)/2]
if disp:
    disp.set_np2arr(fp_im, dtype=np.int32)

# mask those gaps
fp_im = ma.masked_less_equal(data[:,(xsize-ysize)/2:(xsize+ysize)/2], 0.0)

# first guess is the center of the aperture (assume 4x4 binning here)
xc=4*513/binning
yc=4*502/binning

prof, r = FP_profile(fp_im, xc, yc, trim_rad=470, mask=0.0)

prof = prof/prof[0]

np.savetxt("flat.dat", np.transpose(prof))

pl.figure()
pl.plot(r, prof, label="Profile")
pl.legend(loc=2)
pl.show()<commit_msg>remove py-ds9 dependency<commit_after>#!/usr/bin/env python

import sys
import os
import pyfits
import numpy as np
import pylab as py
from ring import *

file = sys.argv[1]

hdu = pyfits.open(file)
(data, header) = (hdu[-1].data, hdu[0].header)

binning = int(header['CCDSUM'].split()[0])
ysize, xsize = data.shape

# cut FP image down to square
fp_im = data[:,(xsize-ysize)/2:(xsize+ysize)/2]

# mask those gaps
fp_im = ma.masked_less_equal(data[:,(xsize-ysize)/2:(xsize+ysize)/2], 0.0)

# first guess is the center of the aperture (assume 4x4 binning here)
xc=4*513/binning
yc=4*502/binning

prof, r = FP_profile(fp_im, xc, yc, trim_rad=470, mask=0.0)

prof = prof/prof[0]

np.savetxt("flat.dat", np.transpose(prof))

pl.figure()
pl.plot(r, prof, label="Profile")
pl.legend(loc=2)
pl.show()
{'fraction_non_alphanumeric': 0.16817906836055657, 'fraction_numerical': 0.03690260133091349, 'mean_word_length': 4.9496402877697845, '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': '5464722', 'n_tokens_mistral': 731, 'n_tokens_neox': 689, 'n_words': 163}