nhmc / barak Goto Github PK
View Code? Open in Web Editor NEWA set of astronomy-related routines for generating Voigt profiles from atomic data, reading and writing data, working with SEDs and passbands.
License: Other
A set of astronomy-related routines for generating Voigt profiles from atomic data, reading and writing data, working with SEDs and passbands.
License: Other
Hello,
I found that Barak.extinction.starburst_Calzetti00
assumes the MW extinction by Cardelli et al. (1989). The resulting Calzetti curve from Barak has a sharp discontinuity because of this (as attached). Is there any particular reason to assume the C89 MW curve above 3700A, rather than following the original recipe?
Hey, some of this stuff is useful for me!
To make the install work, in setup.py
can you change:
-with open('README') as fh:
+with open('README.rst') as fh:
and fix the SyntaxErrors
?
https://gist.github.com/cdeil/5729097
Excellent package you have here, Neil! The documentation has been especially useful.
I've recently come across what I think is an error: when I try to use the convolve.convolve_constant_dv
with the faster option of specifying wa_dv
and npix
. Here is a minimal example that works followed by an example that produces an error (with the traceback included).
import barak
from barak import convolve
low = 7040.
high = 7050.
subpixkms = 1.3 # km/s
instrument_profile = 2.5 # km/s
wave = barak.sed.make_constant_dv_wa_scale(low, high, subpixkms)
flux = np.ones_like(wave)
# This works as expected:
convolved_flux = convolve.convolve_constant_dv(wave, flux, wa_dv=subpixkms, vfwhm=instrument_profile)
#This one returns an error:
convolved_flux_fast = convolve.convolve_constant_dv(wave, flux, wa_dv=subpixkms, npix=4.0)
#This is the error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-343170092fbe> in <module>()
11
12 convolved_flux = convolve.convolve_constant_dv(wave, flux, wa_dv=subpixkms, vfwhm=instrument_profile)
---> 13 convolved_flux_fast = convolve.convolve_constant_dv(wave, flux, wa_dv=subpixkms, npix=4.0)
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/barak/convolve.pyc in convolve_constant_dv(wa, fl, wa_dv, npix, vfwhm)
137 wa_dv = make_constant_dv_wa_scale(wa[0], wa[-1], float(vfwhm)/npix)
138 fl_dv = np.interp(wa_dv, wa, fl)
--> 139 fl_dv_smoothed = convolve_psf(fl_dv, npix)
140 fl_out = np.interp(wa, wa_dv, fl_dv_smoothed)
141 return fl_out
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/barak/convolve.pyc in convolve_psf(a, fwhm, edge, replace_nan, debug)
44 gauss = np.exp(-0.5 * (x / sigma) ** 2 )
45
---> 46 return convolve_window(a, gauss, edge=edge)
47
48 def convolve_window(a, window, edge='invert'):
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/barak/convolve.pyc in convolve_window(a, window, edge)
80 # Add edges to either end of the array to reduce edge effects in
81 # the convolution.
---> 82 if len(a) < 2*n:
83 raise ValueError('Window is too big for the array! %i %i' % (len(a), n))
84 if edge == 'invert':
TypeError: object of type 'numpy.float64' has no len()
Hi,
I've got an error message when using barak.extinction.starburst_Calzetti00
. Apparently, the function does not work properly between 2850<lambda<3700. In the following example, the first and last lines work properly, while the other two lines return error. This happens both 0.3.2 and the current master.
from barak.extinction import starburst_Calzetti00
starburst_Calzetti00(2850) # work
starburst_Calzetti00(2851) # does not work
starburst_Calzetti00(3699) # does not work
starburst_Calzetti00(3700) # work
The error message I got is the following:
In [53]: starburst_Calzetti00(3669)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-53-660921431fc5> in <module>()
----> 1 starburst_Calzetti00(3669)
/usr/local/lib/python2.7/site-packages/barak/extinction.pyc in starburst_Calzetti00(wa, Rv, EBmV)
218 if c1.any():
219 AlamAv[c0] = MW_Cardelli89(wa[c0], 3.1).AlamAv
--> 220 AlamAv[c1] = interp_Akima(wa[c1], wa[~c1], AlamAv[~c1])
221
222 if len(wa) == 1:
/usr/local/lib/python2.7/site-packages/barak/interp.pyc in interp_Akima(x_new, x, y)
344 >>> plt.show()
345 """
--> 346 interpolator = AkimaSpline(x, y)
347 return interpolator(x_new)
348
/usr/local/lib/python2.7/site-packages/barak/interp.pyc in __init__(self, xvals, yvals)
173 n = len(x)
174 if n < 3:
--> 175 raise ValueError("Array too small")
176 if n != len(y):
177 raise ValueError("Size of x-array must match data shape")
ValueError: Array too small
Maybe it's not only for the Calzetti extinction curve, but I've not tested other extinction curves.
Best,
Masato Onodera
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.