Skip to content

Instantly share code, notes, and snippets.

View tomr-stargazer's full-sized avatar

Tom Rice tomr-stargazer

View GitHub Profile
@tomr-stargazer
tomr-stargazer / how_to_interpret_sensitivity.py
Created October 19, 2021 17:06
Reconstructing the period sensitivity plots
# return scores, found_periods, faps, alias_scores
scores = np.load(f"output_denser_W7_0_20211010.npy")
# periods:
periods_denser_raw = np.logspace(np.log10(1/24.5), np.log10(24.5), 60)
extra_periods = (1/4, 1/3, 1/2, 1, 2, 3, 4)
periods_denser = np.sort(np.append(periods_denser_raw, np.array(extra_periods)))
#
# [ 0.04081633 0.04549088 0.05070078 0.05650736 0.06297895 0.07019171
# 0.07823051 0.08718997 0.09717553 0.1083047 0.12070845 0.13453276
@tomr-stargazer
tomr-stargazer / Table 2
Created June 14, 2021 04:23
Tables: Robberto 2020
NoDTitle: HST survey of the Orion Nebula Cluster in the H_2_O 1.4um absorption
band: I. A census of substellar and planetary mass objects
Authors: Robberto M., Gennaro M., Gabellini M.G.U., Hillenbrand L.A.,
Pacifici C., Ubeda L., Andersen M., Bartman T., Bellini A., Da Rio N.,
de Mink S., Lodato G., Manara C.F., Platais I., Pueyo L., Soderblom D.R.,
Strampelli G.M., Tan J., Testi L.
Table: WFC3-IR photometry of ONC sources
================================================================================
Byte-by-byte Description of file: apjab911et2_mrt.txt
--------------------------------------------------------------------------------
# works
fig10 = plt.figure(constrained_layout=False)
gs0 = fig10.add_gridspec(1, 2)
gs00 = gs0[0].subgridspec(3, 1)
gs01 = gs0[1].subgridspec(2, 1)
bax0 = brokenaxes(xlims=((0,100), (150,200)), subplot_spec=gs00[0,0])
bax1 = brokenaxes(xlims=((0,100), (150,200)), subplot_spec=gs00[1,0])
@tomr-stargazer
tomr-stargazer / Traceback2
Created January 30, 2021 17:12
Another traceback (smaller data)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-0557ca61f3fa> in <module>
1 from wuvars.analysis.create_summary_spreadsheets import make_summary_spreadsheets_for_errorcorrected_data_debug
----> 2 make_summary_spreadsheets_for_errorcorrected_data_debug()
~/Documents/Variability_Project_2020/wuvars/analysis/create_summary_spreadsheets.py in make_summary_spreadsheets_for_errorcorrected_data_debug()
182 print(f"Starting at: {startTime}")
183
--> 184 write_summary_spreadsheet(input_path, output_path)
@tomr-stargazer
tomr-stargazer / Traceback
Created January 30, 2021 03:31
Traceback: astropy tables / pandas / Endian error
INPUT / OUTPUT for WSERV11: /Users/tsrice/Documents/Variability_Project_2020/wuvars/Data/reduction_artifacts/wserv11/WSERV11_graded_clipped0.95_scrubbed0.1_dusted0.5_new_error_corrected.h5 /Users/tsrice/Documents/Variability_Project_2020/wuvars/Data/analysis_artifacts/wserv11/WSERV11_graded_clipped0.95_scrubbed0.1_dusted0.5_new_error_corrected_summary_spreadsheet.h5
Starting at: 2021-01-29 22:27:57.025274
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-0b69d38cf0c5> in <module>
1 # let's run the create summary spreadsheets on the NEW data!
2 from wuvars.analysis.create_summary_spreadsheets import make_summary_spreadsheets_for_errorcorrected_data
----> 3 make_summary_spreadsheets_for_errorcorrected_data()
import astropy.table as tab
import matplotlib.pyplot as plt
if __name__ == "__main__":
# read in the data
f95_table = tab.Table.read("f95_data_for_Ben.fits")
f89_table = tab.Table.read("f89_data_for_Ben.fits")
# first, f95
@tomr-stargazer
tomr-stargazer / ipython_session.py
Last active January 23, 2020 15:38
Output of attempting to load CLASS-generated FITS spectrum into specutils
ipython --pylab
Python 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Using matplotlib backend: MacOSX
nosetests --version
nosetests version 1.3.7
python -c 'import matplotlib; print(matplotlib.__version__)'
2.0.2
python --version
Python 3.6.0 :: Anaconda custom (x86_64)
nosetests corner
@tomr-stargazer
tomr-stargazer / thickness_of_pulverized_earth_poster.py
Created March 7, 2017 22:38
Thickness of 6x8 AU poster with volume of Earth
In [2]: import astropy.units as u
In [3]: import astropy.constants as c
In [4]: volume = 4/3. * np.pi*c.R_earth**3
In [5]: length = 6 * u.AU
In [6]: width = 8 * u.AU
@tomr-stargazer
tomr-stargazer / example.py
Created January 31, 2017 18:58
code that causes error
import wrapper_my_radex
wrapper = wrapper_my_radex.myradex_wrapper
n_levels, n_item, n_transitions = wrapper.config_basic(
'/Users/tsrice/Documents/Academia/Misc_Software/Radex/data/',
'c18o.dat', 2.7, True)