Skip to main content

Replicates functionality of IRAF XCSAO

Project description

PyXCSAO

Replicates functionality of IRAF XCSAO

To run:

Import

from pyxcsao.crosscorrelate import PyXCSAO

Initiates instance:

b=PyXCSAO(st_lambda=5000,end_lambda=10000)

---optional parameters: ncols=8192,low_bin=0,top_low=10,top_nrun=125,nrun=255,bell_window=0.05,minvel=-500,maxvel=500

Adds Synthetic grid

First time running: b.add_grid(grid_pickle='phoenix.p',grid_path='phoenix/*0.0/4.5.fits',grid_class='phoenix')

---options: phoenix, phoenixhires, coelho

From a precompiled pickle file:

b.add_grid(grid_pickle='phoenix.p')

Adds data

b.add_spectrum('file.fits',data_class='boss')

---options: boss,lamost,segue,user

Run XCSAO and get parameters

print(b.run_XCSAO())

Optimized for large grids:

print(b.run_XCSAO_optimized())

Plot CCF:

plt.plot(b.lag,b.best_ccf)

Example Code

import glob
import pandas as pd
from pyxcsao.crosscorrelate import PyXCSAO
from astropy.table import Table
import time

cat=Table.read('path.fits')

best=[]
b=PyXCSAO(st_lambda=5000,end_lambda=10000)
b.add_grid(grid_pickle='phoenix_full1.p')


batchsize=500
for j in range(0,len(cat),batchsize):
    cat1=cat[j:j+batchsize]
    print(j)
    for i in range(len(cat1)):
        path=cat1['path'][i]
        try:
            b.add_spectrum(path)
            x=b.run_XCSAO_optimized()
            best.append(x.copy())
        except:
            print(path)
            

df = pd.DataFrame(best)
df.to_csv('batch.csv')

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyXCSAO-0.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

PyXCSAO-0.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file PyXCSAO-0.2.tar.gz.

File metadata

  • Download URL: PyXCSAO-0.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for PyXCSAO-0.2.tar.gz
Algorithm Hash digest
SHA256 333dcb1d659f01ec886dff50c00f5b140461fd0df3de871186b7e5bcdb1218f4
MD5 e1202b839c89adf55b8d95c70bff9bc9
BLAKE2b-256 457236260bce092a4a54133d53adef257cf5404f261027f0f3aa016aa4474d5e

See more details on using hashes here.

File details

Details for the file PyXCSAO-0.2-py3-none-any.whl.

File metadata

  • Download URL: PyXCSAO-0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for PyXCSAO-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04d37de2f9f0693bc965dac245de31ae14f6c7e9d42b64b57e3cda6b6b46c92c
MD5 66d30bba2b72c627fc192060b0ec539e
BLAKE2b-256 effeb5f543fd5ed76f5ba6234198cea10a03f1f9e7f9d0266415472c8d446365

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page