From mcraig at mnstate.edu Thu Jul 1 12:19:05 2021 From: mcraig at mnstate.edu (Craig, Matthew W) Date: Thu, 1 Jul 2021 16:19:05 +0000 Subject: [AstroPy] Announcement: timeline for first Astropy Coordination Committee election Message-ID: Dear colleagues, The first election of Astropy voting members will conclude soon, on July 7. The next step in implementing APE 0 is the election of a Coordinating Committee. The process has three steps: 1. An announcement is required one month before the election process begins. This is the announcement ? the election process will begin on Sun, August 1, 2021. 2. On Sun, August 1, 2021 a two-week nomination period will begin. Each person nominated will be asked to confirm their interest in the role and to write a brief statement in support of their candidacy. nominations will close on Sunday, August 15, 2021. 3. The two week voting period will open on Tuesday, August 17 and will end on Tuesday, August 31. There will be at least two questions on the ballot: * Should the Coordination Committee be four or five members? (See the section of APE 0 about the composition of the CoCo). * A list of candidates for the Coordination Committee. Voting members will be able to choose any number of those candidates from zero to the number of candidates for election to the Coordinating Committee (see Phase 2 of the CoCo election in APE 0). Though the standard term for a Coordination Committee member is 3 years, for this initial election the length of term shall be decided by the number of votes for each candidate or by the elected Coordination Committee, as explained in APE 0. Sincerely, Matt Craig on behalf of the Governance Working Group Matt Craig Schedule: http://physics.mnstate.edu/craig --- Professor, Department of Physics and Astronomy MSUM -------------- next part -------------- An HTML attachment was scrubbed... URL: From mirosaide at gmail.com Tue Jul 6 14:59:51 2021 From: mirosaide at gmail.com (Miro Saide) Date: Tue, 6 Jul 2021 20:59:51 +0200 Subject: [AstroPy] How to plot a time format with hours only? In-Reply-To: <0571452B-CBF4-4A3F-8A89-D46272C5B7B3@swarthmore.edu> References: <0571452B-CBF4-4A3F-8A89-D46272C5B7B3@swarthmore.edu> Message-ID: Hi Eric, I wonder if is there a way to approximate the minutes to our when I calculate the rise and set time? *Ramiro Caisse Saide* *MPhil Research Student* Department of Physics University of Mauritius Contact Number: +258 845672884 Email: ramiro.saide at umail.uom.mu Eric Jensen escreveu no dia sexta, 23/04/2021 ?(s) 15:04: > Hi Ramiro, > > I think you should be able to get just the hour of the rise or set time by > using > > star_rise_time.ymdhms.hour > > If you want other components as well, you can use .year, .minute, etc. > with that ymdhms format. > > Hope this helps - > > Eric > > > On Apr 23, 2021, at 5:44 AM, Miro Saide wrote: > > Hello all, > > I am using the following code to plot the rise and set of a particular > star from a selected location on earth: > > import numpy as np > import matplotlib.pyplot as plt > from astropy.visualization import astropy_mpl_style, quantity_support > plt.style.use(astropy_mpl_style) > quantity_support() > import astropy.units as u > from astropy.time import Time > from astropy.coordinates import SkyCoord, EarthLocation, AltAz > from astroplan import download_IERS_A > download_IERS_A > from astroplan import Observer, FixedTarget > > #Latitude and LOngitude of some cities > cities = > [[-25.9553,32.5892],[-25.7069,28.2294],[-15.4166,28.2833],[-22.95764,18.49041],[-13.254308,34.301525]] > cities = np.array(cities) > > time = Time("2000-11-12 11:00:00",format='iso') > > #Star target > target = SkyCoord.from_name("Barnard's star") > > > #Calculation of the rise and set time > Location = Observer(latitude=cities[:,0]*u.deg, > longitude=cities[:,1]*u.deg) > star_rise_time = Location.target_rise_time(time, target, which='next') > star_set_time = Location.target_set_time(time, target, which='next') > > #Get the time in iso format > rise_1 = star_rise_time.iso > set_1 = star_set_time.iso > > > #Random values > Random_valeus = [1600,2118,3000,2750,3500] > > > #Plot the time against random values > > plt.plot(rise_1,Random_valeus, marker ='o',label = 'rise') > plt.plot(set_1,Random_valeus, marker ='o',label = 'set') > plt.xlabel('Time [Hours]') > plt.ylabel('Random_valeus') > plt.show() > > When I run this the time axis in the plot gets messy the values overlap > and can't clearly see what is what. > > I wonder if there's is a way to plot this with hours only, neglecting the > year, month, day, minutes, and seconds? > > Thanks in advance. > > *Ramiro Caisse Saide* > *MPhil Research Student* > Department of Physics > University of Mauritius > Contact Number: +258 845672884 > Email: ramiro.saide at umail.uom.mu > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ejensen1 at swarthmore.edu Tue Jul 6 15:15:22 2021 From: ejensen1 at swarthmore.edu (Eric L. N. Jensen) Date: Tue, 6 Jul 2021 15:15:22 -0400 Subject: [AstroPy] How to plot a time format with hours only? In-Reply-To: References: <0571452B-CBF4-4A3F-8A89-D46272C5B7B3@swarthmore.edu> Message-ID: > On Jul 6, 2021, at 2:59 PM, Miro Saide wrote: > > I wonder if is there a way to approximate the minutes to our when I calculate the rise and set time? > Sure - just take the minutes and seconds and convert them to hours. For example: from astropy.time import Time now = Time.now() print(now.ymdhms.hour + now.ymdhms.minute/60. + now.ymdhms.second/3600.) to get the current time in decimal fractional hours. Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathaniel.j.livesey at jpl.nasa.gov Thu Jul 8 23:30:59 2021 From: nathaniel.j.livesey at jpl.nasa.gov (Livesey, Nathaniel J (US 3290)) Date: Fri, 9 Jul 2021 03:30:59 +0000 Subject: [AstroPy] Issue with dask and astropy.units (including in astropy 4.3 and 5.0 development versions) Message-ID: <1395039E-4C75-4F78-A215-709CEE194F0C@jpl.nasa.gov> Hi there, Thanks so much for astropy.units, I use it heavily (though I?m not an astronomer). I?ve been having trouble using units with dask, but gather from the astropy website, and other searches, that that?s been addressed in version 4.3. However, I fear some may still remain. The MWE pasted at the bottom of this Email demonstrates the problem. With astropy version 4.3rc2.dev10+ga094d524a, and dask version 2021.04.0, I get multiple complaints of: Exception: UnitConversionError("Can only apply 'add' function to quantities with compatible dimensions?) I also checked out the latest version in github (5.0.dev382+ga97b8331c) and had the same result. When I set ?parallel" to ?False? in the code below, it works fine. Thanks for any pointers (or a recommendation to wait for a future version will be fine), and apologies if I?m making an elementary mistake. Yours, Nathaniel Nathaniel Livesey Mail Stop 183-701, Jet Propulsion Laboratory 4800 Oak Grove Drive, Pasadena, California 91109. Phone: +1 818 354-4214 Fax: +1 818 393-5065 ##################################### from dask.distributed import Client import astropy import astropy.units as units import dask import numpy as np my_unit = units.def_unit("me") def do_stuff(p): return p + 1.0 * my_unit parallel = True if __name__ == "__main__" and parallel: dask_client = Client() print(astropy.__version__) print(dask.__version__) if parallel: routine = dask.delayed(do_stuff) else: routine = do_stuff p = np.arange(5) << my_unit result = [] for p_i in p: result.append(routine(p_i)) if parallel: result = dask.compute(*result) print(units.Quantity(result)) From mirosaide at gmail.com Fri Jul 23 11:25:10 2021 From: mirosaide at gmail.com (Miro Saide) Date: Fri, 23 Jul 2021 17:25:10 +0200 Subject: [AstroPy] How can I get the rise and set time in Greenwich Mean Sidereal Time (GMST)? Message-ID: Hello everyone, I am calculating the rise and set of Barnard's star for different locations on the globe. But my output is in Universal time. The sidereal time method returns a longitude with units of hour angle. I wonder how can I get the output in GMST? The example of the code is below: `` from astropy.visualization import astropy_mpl_style, quantity_support plt.style.use(astropy_mpl_style) quantity_support() import astropy.units as u from astropy.time import Time from astropy.coordinates import SkyCoord, EarthLocation, AltAz from astroplan import Observer, FixedTarget from astropy.time import Time from astroplan import download_IERS_A download_IERS_A time = Time("2020-05-12 00:00:00",format='iso') target = SkyCoord.from_name("Barnard's star") Location = Observer(latitude=42.248u.deg, longitude=-122.567u.deg) star_rise_time = Location.target_rise_time(time, target, which='nearest') star_set_time = Location.target_set_time(time, target, which='nearest') *Ramiro Caisse Saide* *MPhil Research Student* Department of Physics University of Mauritius Contact Number: +258 845672884 Email: ramiro.saide at umail.uom.mu -------------- next part -------------- An HTML attachment was scrubbed... URL: From rbaer25 at gmail.com Sun Jul 25 10:33:49 2021 From: rbaer25 at gmail.com (Rudolf Baer) Date: Sun, 25 Jul 2021 16:33:49 +0200 Subject: [AstroPy] Blackbody fit and Wien's displacement law Message-ID: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> In the following code I have done a black body + power law fit of the broad line free continuum of the NIR spectrum of BASS DR1 ID 641 (NGC 4748). The resulting parameters are shown in the title line of the plot. The plot also shows the two components (blackbody and power law). I have separately verified that the two components add up to the fit. However, the lambda derived from Wien?s displacement law for the Temperature derived from black body fit ( 1?995.24 K) does not agree with the maximum of the black body plot. Do I have a coding error or I am missing something on the science side? Any comment will be highly appreciated. R. Baer from scipy.optimize import curve_fit import matplotlib.pyplot as plt import numpy as np from lmfit import Model from lmfit import CompositeModel, Model object='0641' path_output='/Users/rudolf/Durham/output/' path_object='baseline_BASS'+object+' 0407.csv' #<----------change date as nessary #path_object='baseline_BASS'+object+' 0615.csv' #<----------change date as nessary #path_object='baseline_BASS'+object+' 0625.csv' #<----------change date as nessary path=path_output+path_object print ( 'line 19', object, path) x_AA= np.genfromtxt(path,delimiter=',',dtype="float64",autostrip=True,skip_header=1,skip_footer=1, usecols=(0)) x=x_AA/10000 #<---------conversion AA to um #x=x[725:5283] #<----------partial spectrum y= np.genfromtxt(path,delimiter=',',dtype="float64",autostrip=True,skip_header=1,skip_footer=1, usecols=(1)) #y=y[725:5283] #<----------partial spectrum #============================================================================================================= # fit bb + powerlaw def bb(x, T, const): from scipy.constants import h,k,c x = 1e-6 * x # convert to metres from um return const*2*h*c**2 / (x**5 * (np.exp(h*c / (x*k*T)) - 1)) def powerlaw(x,A,p): return A*x**p mod= Model(bb) + Model(powerlaw) pars = mod.make_params(T=1600,const=2*1e-21,A=2*np.amin(y),p=-1.0) #<-----automatice result = mod.fit(y,pars,x=x) print(f"{result.fit_report()[340:387]:<20}") #============================================================================================================ #Parameters T= (result.params['T'].value) const=(result.params['const'].value) A= (result.params['A'].value) p= (result.params['p'].value) # ? Wien Wien=(2897.77196/T) #plot bb and PWL separately #Blackbody #from scipy.constants import h,k,c x_bb = 1e-6 * x # convert to metres from um y_bb=const*2*h*c**2 / (x_bb**5 * (np.exp(h*c / (x_bb*k*T )) - 1)) #Power law y_pwl=A*x**p plt.title('BB + Powerlaw fitting of continuum of BASS '+object+str(f"{result.fit_report()[340:588]:<20}"), fontsize='8') plt.xlabel(' log ?$_{rest}$ [?m]') plt.ylabel((r' log $ \;\; {\lambda} \;\; F_{\lambda} \;\; (\rm erg\;\;s^{-1}\;\;cm^{-2}\;\;)$')) plt.axis([np.log10(0.7),np.log10 (2.4), np.log10(np.amin(y*x*0.2)),np.log10(np.amax(y*x*1.2))]) #automatic plt.plot(np.log10(x), np.log10(y_bb*x), 'b--', label='Blackbody component') plt.plot(np.log10(x), np.log10(y_pwl*x), 'g--', label='Power law component') plt.plot(np.log10(x),np.log10(y*x),'b-', label='Continumm') plt.plot((np.log10(x)), (np.log10(result.best_fit*x)), 'r--', label='Best fit') plt.vlines(np.log10(Wien),np.amin(np.log10(y*x*0.1)),np.amax(np.log10(y*x*1.2)),colors='red', linestyles='solid', label='Wien') #Wien's displacement law plt.legend() pathfig2='/Users/rudolf/Durham/plots_bb/ ' date='_210725' type='.png' pathfig=pathfig2+object+date+type print (pathfig) #plt.savefig(pathfig) plt.show() -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot 2021-07-25 at 15.46.25.png Type: image/png Size: 84403 bytes Desc: not available URL: From derek at astro.physik.uni-goettingen.de Sun Jul 25 17:28:33 2021 From: derek at astro.physik.uni-goettingen.de (Derek Homeier) Date: Sun, 25 Jul 2021 23:28:33 +0200 Subject: [AstroPy] Blackbody fit and Wien's displacement law In-Reply-To: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> References: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> Message-ID: <1406506D-DE43-4A1C-AAB1-3529801C250E@astro.physik.uni-goettingen.de> Hi Rudolf, I have not looked at your whole code in detail, but your implementation of the Planck function looks correct. Note that astropy.modeling.models.BlackBody provides a builtin version, in case you want to double-check and compare your results. But I believe the mistake lies in the mode you are plotting the SED; using this form of Wien?s law > > # ? Wien > Wien=(2897.77196/T) > will give you the wavelength of _F_lambda_; however you are plotting lambda * F_lambda, which has its peak at somewhat longer wavelengths ? somewhere between the maximum of F_lambda above, and the maximum of F_nu ~ lambda**2 * F_lambda at 5100 (micron * K). So by eye the location of your BB maximum looks all reasonable. :-) HTH, Derek From rbaer25 at gmail.com Mon Jul 26 07:19:16 2021 From: rbaer25 at gmail.com (Rudolf Baer) Date: Mon, 26 Jul 2021 13:19:16 +0200 Subject: [AstroPy] Blackbody fit and Wien's displacement law In-Reply-To: <1406506D-DE43-4A1C-AAB1-3529801C250E@astro.physik.uni-goettingen.de> References: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> <1406506D-DE43-4A1C-AAB1-3529801C250E@astro.physik.uni-goettingen.de> Message-ID: Hi Derek Thank you very much for your quick reply which is very helpful. Where does the *500 (micron * K) *come from? What would be the correct way to determine the position of lambda Wien for my plot? With Wien = 1.45233. (log Wien = 0.16206) I tried for i in range (len(x)): if x[i]>=Wien: if x[i]<=Wien+0.0005: Wien_plot=(x[i]**2). # <------ is this correct? This results is Wien_plot = 2.11027 or log Wien_plot = 0.32433 With kind regards Rudolf On Mon, Jul 26, 2021 at 12:18 AM Derek Homeier < derek at astro.physik.uni-goettingen.de> wrote: > Hi Rudolf, > > I have not looked at your whole code in detail, but your implementation of > the Planck > function looks correct. Note that astropy.modeling.models.BlackBody > provides a > builtin version, in case you want to double-check and compare your results. > > But I believe the mistake lies in the mode you are plotting the SED; using > this form of > Wien?s law > > > > # ? Wien > > Wien=(2897.77196/T) > > > will give you the wavelength of _F_lambda_; however you are plotting > lambda * F_lambda, > which has its peak at somewhat longer wavelengths ? somewhere between the > maximum > of F_lambda above, and the maximum of F_nu ~ lambda**2 * F_lambda at 5100 > (micron * K). > So by eye the location of your BB maximum looks all reasonable. :-) > > HTH, > Derek > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From derek at astro.physik.uni-goettingen.de Mon Jul 26 10:03:36 2021 From: derek at astro.physik.uni-goettingen.de (Derek Homeier) Date: Mon, 26 Jul 2021 16:03:36 +0200 Subject: [AstroPy] Blackbody fit and Wien's displacement law In-Reply-To: References: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> <1406506D-DE43-4A1C-AAB1-3529801C250E@astro.physik.uni-goettingen.de> Message-ID: Hi Rudolf, > > Where does the 500 (micron * K) come from? > > What would be the correct way to determine the position of lambda Wien for my plot? > the 5099 micron * K result from substituting the (energy) value of the B_lambda maximum, 4.965 k_B T, in hc / E_max [hc / 4.965 k_B = 2898 micron * K] with the corresponding one for B_nu, 2.821 k_B T: hc / 2.821 k_B ~ 5099 micron * K To find the equivalent in (lambda B_lambda) ~~ (nu B_nu), you?d have to solve for the derivative of that function analogously to the derivation of Wien?s law for the other two functional forms, e.g. in https://en.wikipedia.org/wiki/Wien%27s_displacement_law#Derivation_from_Planck's_law If I am not mistaken the numerical value is also given in https://en.wikipedia.org/wiki/Planck%27s_law#Percentiles for the 41.8 percentile (maximum in logarithmic spectral axis), i.e. 3670 (?m?K). Cheers, Derek -------------- next part -------------- An HTML attachment was scrubbed... URL: From rbaer25 at gmail.com Mon Jul 26 11:28:27 2021 From: rbaer25 at gmail.com (Rudolf Baer) Date: Mon, 26 Jul 2021 17:28:27 +0200 Subject: [AstroPy] Blackbody fit and Wien's displacement law In-Reply-To: References: <7240B7D6-5A96-42D0-A5DA-42C4450377AE@gmail.com> <1406506D-DE43-4A1C-AAB1-3529801C250E@astro.physik.uni-goettingen.de> Message-ID: Hi Derek thank you very much ! I have learned something. Cheers Rudolf On Mon, Jul 26, 2021 at 4:04 PM Derek Homeier < derek at astro.physik.uni-goettingen.de> wrote: > Hi Rudolf, > > > Where does the *500 (micron * K) *come from? > > What would be the correct way to determine the position of lambda Wien > for my plot? > > the 5099 micron * K result from substituting the (energy) value of the > B_lambda maximum, 4.965 k_B T, > in hc / E_max [hc / 4.965 k_B = 2898 micron * K] with the corresponding > one for B_nu, 2.821 k_B T: > hc / 2.821 k_B ~ 5099 micron * K > > To find the equivalent in (lambda B_lambda) ~~ (nu B_nu), you?d have to > solve for the derivative of that function > analogously to the derivation of Wien?s law for the other two functional > forms, e.g. in > > https://en.wikipedia.org/wiki/Wien%27s_displacement_law#Derivation_from_Planck's_law > > If I am not mistaken the numerical value is also given in > https://en.wikipedia.org/wiki/Planck%27s_law#Percentiles > for the 41.8 percentile (maximum in logarithmic spectral axis), i.e. 3670 > (?m?K). > > Cheers, > Derek > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mirosaide at gmail.com Tue Jul 27 17:50:02 2021 From: mirosaide at gmail.com (Miro Saide) Date: Tue, 27 Jul 2021 23:50:02 +0200 Subject: [AstroPy] How to plot a time format with hours only? In-Reply-To: <0571452B-CBF4-4A3F-8A89-D46272C5B7B3@swarthmore.edu> References: <0571452B-CBF4-4A3F-8A89-D46272C5B7B3@swarthmore.edu> Message-ID: Hi, For the same code above, where I am calculating the rise and set time of the Barnard's star for different locations on the globe. I wonder how I can get the output in Greenwich Mean Sidereal Time (GMST)? The output of the rise and set time are given in Universal time. The sidereal time method returns a longitude with units of hour angle. Thanks in advance. *Ramiro Caisse Saide* *MPhil Research Student* Department of Physics University of Mauritius Contact Number: +258 845672884 Email: ramiro.saide at umail.uom.mu Eric Jensen escreveu no dia sexta, 23/04/2021 ?(s) 15:04: > Hi Ramiro, > > I think you should be able to get just the hour of the rise or set time by > using > > star_rise_time.ymdhms.hour > > If you want other components as well, you can use .year, .minute, etc. > with that ymdhms format. > > Hope this helps - > > Eric > > > On Apr 23, 2021, at 5:44 AM, Miro Saide wrote: > > Hello all, > > I am using the following code to plot the rise and set of a particular > star from a selected location on earth: > > import numpy as np > import matplotlib.pyplot as plt > from astropy.visualization import astropy_mpl_style, quantity_support > plt.style.use(astropy_mpl_style) > quantity_support() > import astropy.units as u > from astropy.time import Time > from astropy.coordinates import SkyCoord, EarthLocation, AltAz > from astroplan import download_IERS_A > download_IERS_A > from astroplan import Observer, FixedTarget > > #Latitude and LOngitude of some cities > cities = > [[-25.9553,32.5892],[-25.7069,28.2294],[-15.4166,28.2833],[-22.95764,18.49041],[-13.254308,34.301525]] > cities = np.array(cities) > > time = Time("2000-11-12 11:00:00",format='iso') > > #Star target > target = SkyCoord.from_name("Barnard's star") > > > #Calculation of the rise and set time > Location = Observer(latitude=cities[:,0]*u.deg, > longitude=cities[:,1]*u.deg) > star_rise_time = Location.target_rise_time(time, target, which='next') > star_set_time = Location.target_set_time(time, target, which='next') > > #Get the time in iso format > rise_1 = star_rise_time.iso > set_1 = star_set_time.iso > > > #Random values > Random_valeus = [1600,2118,3000,2750,3500] > > > #Plot the time against random values > > plt.plot(rise_1,Random_valeus, marker ='o',label = 'rise') > plt.plot(set_1,Random_valeus, marker ='o',label = 'set') > plt.xlabel('Time [Hours]') > plt.ylabel('Random_valeus') > plt.show() > > When I run this the time axis in the plot gets messy the values overlap > and can't clearly see what is what. > > I wonder if there's is a way to plot this with hours only, neglecting the > year, month, day, minutes, and seconds? > > Thanks in advance. > > *Ramiro Caisse Saide* > *MPhil Research Student* > Department of Physics > University of Mauritius > Contact Number: +258 845672884 > Email: ramiro.saide at umail.uom.mu > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: