JALusk / Lumiere

Module for calculating the bolometric luminosities of supernovae
MIT License
5 stars 7 forks source link

Managing I/O for SuperBoL in different formats (ascii) #1

Open manolis07gr opened 8 years ago

manolis07gr commented 8 years ago

Dear Jeremy,

I am trying to use SuperBol to get some superluminous supernova light curves. For now, I have an ascii file with three columns (MJD/time, apparent magnitude and error in apparent magnitude). My understanding is that SuperBol accepts only hdf5 file formats. In that case, do you have any advice as to how to convert my current (simple) file format and data into a SuperBoL readable format? Because it gives me a lot of errors now after I enter:

from superbol import sn

my_supernova = sn.SN('sn2006gy.dat')

My understanding is that perhaps you already have a list of SNe embedded in an HDF5 format? In that case how can outside users use the code to get bolometric LCs for their own objects? Thank you in advance and for making the code available!

Manos

JALusk commented 8 years ago

Manos,

Thanks for opening this issue! I'm working a new module that will allow you to add data to the HDF5 file by modifying a script in the data/ directory.

User interaction should be something along the lines of

  1. Fill in details about the object like name, explosion date, reddening, distance, etc.
  2. For each filter used, fill out
    1. filter name like 'U' or 'g'
    2. JD, mag, uncertainty of the observations made with that filter.
  3. Run the add_sn script

The script will then handle the interaction with the HDF5 file, placing all the data in the correct fields.

I think this is the most flexible approach, since photometry data gets stored in so many different formats. In the future, I hope to also interface with sne.space so that SuperBoL will fetch published data based on the SN name provided, and make calculations from that.

Cheers, Jeremy

manolis07gr commented 8 years ago

Jeremy,

This is a fantastic plan ahead, I look forward to the update so I can start porting my own data to your module for model light curve fitting purposes. Please let me know when the I/O extension as you described it (great plan) will be ready.

Best,

Manos

On 9/13/16 12:03 PM, Jeremy Lusk wrote:

Manos,

Thanks for opening this issue! I'm working a new module that will allow you to add data to the HDF5 file by modifying a script in the |data/| directory.

User interaction should be something along the lines of

  1. Fill in details about the object like name, explosion date, reddening, distance, etc.
  2. For each filter used, fill out a. filter name like 'U' or 'g' b. JD, mag, uncertainty of the observations made with that filter.
  3. Run the add_sn script

The script will then handle the interaction with the HDF5 file, placing all the data in the correct fields.

I think this is the most flexible approach, since photometry data gets stored in so many different formats. In the future, I hope to also interface with sne.space http://sne.space so that SuperBoL will fetch published data based on the SN name provided, and make calculations from that.

Cheers, Jeremy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JALusk/SuperBoL/issues/1#issuecomment-246751252, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJkhp4PZWktBP7avnrMfjUByyMkGlXfks5qptdmgaJpZM4J74gj.

Dr. Manos Chatzopoulos Assistant Professor Department of Physics & Astronomy Nicholson 275 Office # 225-578-2907 Louisiana State University Baton Rouge, LA 70803 United States of America http://www.lsu.edu/physics/people/faculty/chatzopoulos.php

JALusk commented 8 years ago

Quick update:

I've got the core functionality to add data to the HDF5 file written. I'm currently working on the script that will parse that data from a pre-formatted .dat file. The user will just have to copy that .dat file for each filter they used and then paste in their data.

I'm trying to keep the data file as human-friendly as possible: sn_filter.txt so that means the code to parse it is... less so, but I expect everything will be tested and working by Monday.

Cheers, Jeremy

manolis07gr commented 8 years ago

Jeremy,

Thanks for the update! I am delighted this is moving forward and I look forward to using it on some of my data. It's a good tool to have available.

Manos

Quick update: I've got the core functionality to add data to the HDF5 file written. I'm currently working on the script that will parse that data from a pre-formatted .dat file. The user will just have to copy that .dat file for each filter they used and then paste in their data. I'm trying to keep the data file as human-friendly as possible: sn_filter.txt so that means the code to parse it is... less so, but I expect everything will be tested and working by Monday. Cheers, Jeremy — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Open WebMail Project (http://openwebmail.org)

JALusk commented 8 years ago

Manos,

The data import functionality is ready to go - and I'd like you to test it out.

You'll have to clone the develop branch from GitHub, which (assuming you use origin as your remote name) should look like.

git checkout -b develop origin/develop

Once you have checked out the develop branch, the scripts are located in superbol/data/ The README.md file located there should step you through everything.

Once you have added your data to the HDF5 file, running python setup.py install from the top level superbol directory should bring your modified HDF5 file along for the ride when it places everything into the python module directories. From there, things should work as expected when calculating bolometric lightcurves based on your data.

Please let me know of any issues you run into, and I'll try to address them as quickly as I can.

Cheers, Jeremy

manolis07gr commented 8 years ago

Hi Jeremy,

I updated to Python 3.5.2 with Anaconda 4.1.1 and I have several issues with SuperBol. Firstly, I am unable to run the original release version. When I import superbol and call the sn1998a data and run my_supernova.lqbol() I get

Traceback (most recent call last): File "", line 1, in File "/Users/macbro/anaconda3/lib/python3.5/site-packages/SuperBoL-0.3.2-py3.5.egg/superbol/sn.py", line 193, in lqbol self.write_lbol_plaintext(self.qbol_lc, 'qbol') File "/Users/macbro/anaconda3/lib/python3.5/site-packages/SuperBoL-0.3.2-py3.5.egg/superbol/sn.py", line 386, in write_lbol_plaintext np.savetxt(lc_file, lightcurve, header = self.name+": JD, Phase (days), Phase err (days), Lbol (erg/s), Lbol err (erg/s)") File "/Users/macbro/anaconda3/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1147, in savetxt fh.write(asbytes(comments + header + newline)) TypeError: write() argument must be str, not bytes

Then, for some reason, the git checkout -b develop origin/develop command doesn't work for me...as "origin" I use my github log in name (manolis07gr). Do I do something wrong? Can you outline the step-by-step process again assuming that one doesn't have the SuperBol repo checked out (so I can start from zero)?

Thanks and sorry for the confusion!

Manos

On 9/18/16 11:43 PM, Jeremy Lusk wrote:

Manos,

The data import functionality is ready to go - and I'd like you to test it out.

You'll have to clone the develop branch from GitHub, which (assuming you use |origin| as your remote name) should look like.

|git checkout -b develop origin/develop|

Once you have checked out the |develop| branch, the scripts are located in |superbol/data/| The |README.md| file located there should step you through everything.

Once you have added your data to the HDF5 file, running |python setup.py install| should bring your modified HDF5 file along for the ride when it places everything into the python module directories. From there, things should work as expected when calculating bolometric lightcurves based on your data.

Please let me know of any issues you run into, and I'll try to address them as quickly as I can.

Cheers, Jeremy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JALusk/SuperBoL/issues/1#issuecomment-247910607, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJkhtP1Li1F9XZhoRiw5nXtaIkMh1k5ks5qrhMDgaJpZM4J74gj.

Dr. Manos Chatzopoulos Assistant Professor Department of Physics & Astronomy Louisiana State University Nicholson #275 Office # 225-578-2907 Baton Rouge, LA 70808 United States of America http://www.lsu.edu/physics/people/faculty/chatzopoulos.php

JALusk commented 8 years ago

Manos,

The first problem looks like a python2 - python3 incompatibility. I used python 2.7.6 to write the code, so I'll open a new ticket to address making it python3 compatible on GitHub.

The second problem might be remedied by the following steps:

  1. Pick/create a directory to store the source code in (I typically make a src directory in my home directory) and cd into it.
  2. Clone the repository from GitHub: git clone https://github.com/JALusk/SuperBoL.git
  3. cd into the newly created source directory cd SuperBoL
  4. Set up a local development branch that tracks the remote develop branch: git checkout -b develop origin/develop

Now you should have two local branches -- develop and master -- show up when you run git branch in the SuperBoL directory. The develop branch is the one you want checked out, since it includes the I/O changes.

This will get you a current copy of SuperBoL, but that won't help unless we solve the first problem and get it running in the first place.

Cheers, Jeremy

manolis07gr commented 8 years ago

Hi Jeremy,

I redid all the steps you mentioned and you are right, this needs to be configured for python 3.0 otherwise it won't compile/install and work for me. So I ll look forward to your upgrade when you get some time.

Thanks for being on top of this and, again, thanks for customizing it for general use.

Manos

On 9/19/16 4:56 PM, Jeremy Lusk wrote:

Manos,

The first problem looks like a python2 - python3 incompatibility. I used python 2.7.6 to write the code, so I'll open a new ticket to address making it python3 compatible on GitHub.

The second problem might be remedied by the following steps:

  1. Pick/create a directory to store the source code in (I typically make a |src| directory in my home directory) and cd into it.
  2. Clone the repository from GitHub: |git clone https://github.com/JALusk/SuperBoL.git|
  3. cd into the newly created source directory |cd SuperBoL|
  4. Set up a local development branch that tracks the remote develop branch: |git checkout -b develop origin/develop|

Now you should have two local branches -- |develop| and |master| -- show up when you run |git branch| in the SuperBoL directory. The develop branch is the one you want checked out, since it includes the I/O changes.

This will get you a current copy of SuperBoL, but that won't help unless we solve the first problem and get it running in the first place.

Cheers, Jeremy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JALusk/SuperBoL/issues/1#issuecomment-248139887, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJkhu5Fe76v0cjqpt3GLZICmwjiptC5ks5qrwUngaJpZM4J74gj.

Dr. Manos Chatzopoulos Assistant Professor Department of Physics & Astronomy Louisiana State University Nicholson #275 Office # 225-578-2907 Baton Rouge, LA 70803 United States of America http://www.lsu.edu/physics/people/faculty/chatzopoulos.php

JALusk commented 8 years ago

Manos,

I've been doing some digging around, and it looks like there are several things that are un-python3-friendly about the way I've written this code. Issue #2 is open to track progress on these changes. I'll ping you again when I think I've got everything working right.

Thanks again for helping test out the code! These are issues I never would have found myself.

Cheers, Jeremy

manolis07gr commented 8 years ago

Hi Jeremy,

It's my pleasure! Again this is a great tool that helps speed things up to get bolometric LCs for light curve fitting (that I do a lot) and I am sure me and a lot of my students will love using it! Thanks again for looking into the issues for the python 3 release!

Manos

On 9/22/16 9:55 PM, Jeremy Lusk wrote:

Manos,

I've been doing some digging around, and it looks like there are several things that are un-python3-friendly about the way I've written this code. Issue #2 https://github.com/JALusk/SuperBoL/issues/2 is open to track progress on these changes. I'll ping you again when I think I've got everything working right.

Thanks again for helping test out the code! These are issues I never would have found myself.

Cheers, Jeremy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JALusk/SuperBoL/issues/1#issuecomment-249089565, or mute the thread https://github.com/notifications/unsubscribe-auth/AVJkhl-GpfAye0hoJAuNmfvaZCuyWvEoks5qsz-3gaJpZM4J74gj.

Dr. Emmanouil Chatzopoulos Assistant Professor Department of Physics & Astronomy Nicholson 275 Office # 225-578-7459 Louisiana State University Baton Rouge, LA 70803 United States of America http://www.lsu.edu/physics/people/faculty/chatzopoulos.php