Closed br155bundi closed 7 months ago
Hi @br155bundi - this is not a redback issue but a OACAPI one. You can see that even the examples in the readme there (https://github.com/astrocatalogs/OACAPI) do not work currently.
Hi, thank you for your response. I see, that is unfortunate. I do have the open catalogue data file downloaded. Would you recommend that I follow the steps on page: https://redback.readthedocs.io/en/latest/transients.html#loading-private-simulated-data . Or is there a straight forward way to convert this into a transient object? Thank you again.
Hi @br155bundi - yep. Also this example is a good reference https://github.com/nikhil-sarin/redback/blob/master/examples/creating_transient_objects.py
Let me know how you go. I'll keep this issue open for now.
Brilliant, thank you so much.
Hello, apologies for the continued questions. I have been trying to replicate the method outlined in the link that you sent for a kilonova object. I have magnitude and time data from the Open Transient Catalogue GitHub for GW170817. However, I can't seem to work out how to tell the transient function which magnitudes are related to which bands. What format is it looking for the magnitudes and bands to be in? Again, many thanks for your assistance.
Hi - have you had a look at this example?
https://github.com/nikhil-sarin/redback/blob/master/examples/kilonova_example.py
Redback magnitudes are calculated in AB. So if you want to fit in magnitudes you will need to switch data_mode in the transient object to 'magnitude' and the output format in the model_kwargs to 'magnitude' as well.
Hi, yes i had looked at that. At the moment I can't get kilonova.plot_data() to run. I think it's an issue with the fact that the csv file I have has a column for magnitudes and another for associated bands and I'm unsure how to parse this information into the arguments in the kilonova object.
Bands is a separate argument, so you should be able to set up the object as
df = pd.read.csv(your_file.csv) kilonova = redback.transient.Kilonova(..., magnitude=df['magnitude'].values, bands=df['bands'].values)
This example may also be useful
Ah brilliant. I've managed to get the kilonova.plot_data() to run. However, when I try to run the fit_model() command I get the error that 'uvw2' not in registry. I suppose this filter is not taken into account. Is there a way of ignoring this or moving past it without using that specific filter? Again, your help with this so far has been much appreciated, thank you.
No worries. Uvw2 is implemented. Redback uses sncosmo for filter definitions when doing magnitudes and this requires you to use the same naming scheme as sncosmo. There is a utility function in redback here (https://github.com/nikhil-sarin/redback/blob/master/redback/utils.py) - called sncosmo_bandname_from_band that will convert a list of bands to the labelscheme that sncosmo requires.
You can pass your filter list to that function, and it will return a list that you can load the transient object with, or just evaluate the model on that filter definition and keep your list/labels in the transient object. Note that this function is just a dictionary lookup so it might need some labels to be written in a different format. E.g., uvw2 will be returned as sncosmo requires as uvot::uvw2 but passing in uvot:uvW2 or something will not work.
The list of implemented filters is here https://github.com/nikhil-sarin/redback/blob/master/redback/tables/filters.csv but if there is a filter not implemented in redback/sncosmo you can add it using the example I sent in the previous comment.
If you do want to only fit specific filters, the transient object has a keyword argument called active_bands, which is a list you can pass, and then you will only fit the active bands and not every filter.
Hi @br155bundi, I'm going to close this issue unless there's anything else.
Hello, apologies, I thought I had responded to your last message. I have joined the slack so if it is not too much trouble I may ask a few questions there in the future. Thank you again for you help here.
When attempting to download data from the open transient catalogues, the alias is not recognised, for example 'at2017gfo'