<jupyter_start><jupyter_text>Load 1D spectrum<jupyter_code>spec1d_fil = '/Users/xavier/PYPIT/Tiffany/lris_red/Science/spec1d_OFF_J1044p6306_LRISr_2016Feb16T112439.fits'
hdu = fits.open(spec1d_fil)
hdu.info()
h2_obj = Table(hdu[5].data)
#debugger.xplot(h2_obj['box_sky'])<jupyter_output><empty_output><jupyter_text>Run Algorithm<jupyter_code>slf = arutils.dummy_self(pypitdir=os.getenv('PYPIT'))
slf._pixcen = np.zeros(10)
slf._lordloc = 0
slf._rordloc = 0
slf._argflag['arc'] = {}
slf._argflag['arc']['calibrate'] = {}
slf._argflag['arc']['calibrate']['detection'] = 5.
slf._argflag['arc']['calibrate']['nfitpix'] = 7.
#
slf._argflag['reduce'] = {}
slf._argflag['reduce']['flexure'] ={}
slf._argflag['reduce']['flexure']['spectrum'] = None
slf._argflag['reduce']['flexure']['maxshift'] = 20.
#
slf._argflag['run']['spectrograph'] = 'LRISr'
#
msgs._debug['flexure'] = True
# Load archive
reload(arwv)
arx_file, arx_spec = arwv.flexure_archive(slf, 1)
obj_sky = xspectrum1d.XSpectrum1D.from_tuple((h2_obj['box_wave'], h2_obj['box_sky']))
reload(arwv)
flex_dict = arwv.flex_shift(slf, 1, obj_sky, arx_spec)<jupyter_output>[1;31m[WARNING] ::[0m If we use Paranal, cut down on wavelength early on
[1;32m[INFO]    ::[0m Detecting lines
[1;32m[INFO]    ::[0m Extracting an approximate arc spectrum at the centre of the chip
[1;32m[INFO]    ::[0m Detecting the strongest, nonsaturated arc lines
[1;32m[INFO]    ::[0m Detecting lines
[1;32m[INFO]    ::[0m Extracting an approximate arc spectrum at the centre of the chip
[1;32m[INFO]    ::[0m Detecting the strongest, nonsaturated arc lines
[1;32m[INFO]    ::[0m Resolution of Archive=39623.9 and Observation=2094.66
[1;32m[INFO]    ::[0m Flexure correction of 0.0350787 pixels<jupyter_text>Shift wavelengths<jupyter_code>x = np.linspace(0., 1., obj_sky.npix)
f = interpolate.interp1d(x, obj_sky.wavelength.value, bounds_error=False, fill_value="extrapolate")
twave = f(x+flex_dict['shift']/(obj_sky.npix-1))
new_sky = xspectrum1d.XSpectrum1D.from_tuple((twave, obj_sky.flux))<jupyter_output><empty_output><jupyter_text>Compare to Paranal<jupyter_code>pfile = '/Users/xavier/local/Python/PYPIT/data/sky_spec/paranal_sky.fits'
phdu = fits.open(pfile)
pwave = phdu[0].data
pflux = phdu[1].data
debugger.xplot(new_sky.wavelength, h2_obj['box_sky'], xtwo=pwave, ytwo=pflux*8)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17288135593220338, 'fraction_numerical': 0.04533898305084746, 'mean_word_length': 7.554347826086956, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '493595', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1059, 'n_tokens_neox': 966, 'n_words': 143, 'path': 'doc/nb/Flexure_Tests.ipynb', 'repo_name': 'afloers/PypeIt', 'size': '2360'}