hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cd11c9499d1a57032369cbc88c47154240826715 | masonng-astro/nicerpy_xrayanalysis | gapsim.py | [
"MIT"
] | Python | phase_folding | <not_specific> | def phase_folding(t,y,T,T0,f,nbins):
"""
Calculating the folded profile
Goes from 0 to 2.
x - array of time values
y - flux array
T - sum of all the GTIs
T0 - reference epoch in MJD
f - folding frequency
nbins - number of phase bins desired
"""
MJDREFI = 51910
MJDREFF = ... |
Calculating the folded profile
Goes from 0 to 2.
x - array of time values
y - flux array
T - sum of all the GTIs
T0 - reference epoch in MJD
f - folding frequency
nbins - number of phase bins desired
| Calculating the folded profile
Goes from 0 to 2.
| [
"Calculating",
"the",
"folded",
"profile",
"Goes",
"from",
"0",
"to",
"2",
"."
] | def phase_folding(t,y,T,T0,f,nbins):
MJDREFI = 51910
MJDREFF = 7.428703700000000E-04
TIMEZERO = 0
t_MJDs = MJDREFI + MJDREFF + (TIMEZERO+t)/86400
tau = (t_MJDs-T0)*86400
phase = (f*tau)%1
phase_bins = np.linspace(0,1,nbins+1)
summed_profile,bin_edges,binnumber = stats.binned_statistic(p... | [
"def",
"phase_folding",
"(",
"t",
",",
"y",
",",
"T",
",",
"T0",
",",
"f",
",",
"nbins",
")",
":",
"MJDREFI",
"=",
"51910",
"MJDREFF",
"=",
"7.428703700000000E-04",
"TIMEZERO",
"=",
"0",
"t_MJDs",
"=",
"MJDREFI",
"+",
"MJDREFF",
"+",
"(",
"TIMEZERO",
... | Calculating the folded profile
Goes from 0 to 2. | [
"Calculating",
"the",
"folded",
"profile",
"Goes",
"from",
"0",
"to",
"2",
"."
] | [
"\"\"\"\n Calculating the folded profile\n Goes from 0 to 2.\n\n x - array of time values\n y - flux array\n T - sum of all the GTIs\n T0 - reference epoch in MJD\n f - folding frequency\n nbins - number of phase bins desired\n \"\"\"",
"#phase = (f*tau + fdot/2 *tau**2 + fdotdot/6*tau*... | [
{
"param": "t",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "T",
"type": null
},
{
"param": "T0",
"type": null
},
{
"param": "f",
"type": null
},
{
"param": "nbins",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
38ef74983d65caeba78cfbb515b29d33091c5703 | masonng-astro/nicerpy_xrayanalysis | Lv2_ps_method.py | [
"MIT"
] | Python | padding | <not_specific> | def padding(counts):
"""
For use in the function manual. Recall: The optimal number of bins is 2^n,
n being some natural number. We pad 0s onto the original data set, where
the number of 0s to pad is determined by the difference between the optimal
number of bins and the length of the data set (wher... |
For use in the function manual. Recall: The optimal number of bins is 2^n,
n being some natural number. We pad 0s onto the original data set, where
the number of 0s to pad is determined by the difference between the optimal
number of bins and the length of the data set (where the former should be
g... | For use in the function manual. Recall: The optimal number of bins is 2^n,
n being some natural number. We pad 0s onto the original data set, where
the number of 0s to pad is determined by the difference between the optimal
number of bins and the length of the data set (where the former should be
greater than the latte... | [
"For",
"use",
"in",
"the",
"function",
"manual",
".",
"Recall",
":",
"The",
"optimal",
"number",
"of",
"bins",
"is",
"2^n",
"n",
"being",
"some",
"natural",
"number",
".",
"We",
"pad",
"0s",
"onto",
"the",
"original",
"data",
"set",
"where",
"the",
"nu... | def padding(counts):
if type(counts) != list and type(counts) != np.ndarray:
raise TypeError("counts should either be a list or an array!")
data_size = len(counts)
diff = [np.abs(data_size-2**n) for n in range(0,30)]
min_diff_index = np.argmin(diff)
optimal_bins = 2**(min_diff_index)
if ... | [
"def",
"padding",
"(",
"counts",
")",
":",
"if",
"type",
"(",
"counts",
")",
"!=",
"list",
"and",
"type",
"(",
"counts",
")",
"!=",
"np",
".",
"ndarray",
":",
"raise",
"TypeError",
"(",
"\"counts should either be a list or an array!\"",
")",
"data_size",
"="... | For use in the function manual. | [
"For",
"use",
"in",
"the",
"function",
"manual",
"."
] | [
"\"\"\"\n For use in the function manual. Recall: The optimal number of bins is 2^n,\n n being some natural number. We pad 0s onto the original data set, where\n the number of 0s to pad is determined by the difference between the optimal\n number of bins and the length of the data set (where the former ... | [
{
"param": "counts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "counts",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38ef74983d65caeba78cfbb515b29d33091c5703 | masonng-astro/nicerpy_xrayanalysis | Lv2_ps_method.py | [
"MIT"
] | Python | oversample | <not_specific> | def oversample(factor,counts):
"""
Perform oversampling on the data. Return the padded array of counts.
factor - N-times oversampling; factor = 5 means 5x oversampling
counts - array of counts from the binned data
"""
if type(factor) != int:
raise TypeError("Make sure the second entry i... |
Perform oversampling on the data. Return the padded array of counts.
factor - N-times oversampling; factor = 5 means 5x oversampling
counts - array of counts from the binned data
| Perform oversampling on the data. Return the padded array of counts.
factor - N-times oversampling; factor = 5 means 5x oversampling
counts - array of counts from the binned data | [
"Perform",
"oversampling",
"on",
"the",
"data",
".",
"Return",
"the",
"padded",
"array",
"of",
"counts",
".",
"factor",
"-",
"N",
"-",
"times",
"oversampling",
";",
"factor",
"=",
"5",
"means",
"5x",
"oversampling",
"counts",
"-",
"array",
"of",
"counts",
... | def oversample(factor,counts):
if type(factor) != int:
raise TypeError("Make sure the second entry in the array is an integer!")
pad_zeros = np.zeros(len(counts)*(factor-1))
oversampled_counts = np.array(list(counts) + list(pad_zeros))
padded_counts = padding(oversampled_counts)
return padde... | [
"def",
"oversample",
"(",
"factor",
",",
"counts",
")",
":",
"if",
"type",
"(",
"factor",
")",
"!=",
"int",
":",
"raise",
"TypeError",
"(",
"\"Make sure the second entry in the array is an integer!\"",
")",
"pad_zeros",
"=",
"np",
".",
"zeros",
"(",
"len",
"("... | Perform oversampling on the data. | [
"Perform",
"oversampling",
"on",
"the",
"data",
"."
] | [
"\"\"\"\n Perform oversampling on the data. Return the padded array of counts.\n\n factor - N-times oversampling; factor = 5 means 5x oversampling\n counts - array of counts from the binned data\n \"\"\""
] | [
{
"param": "factor",
"type": null
},
{
"param": "counts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "factor",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "counts",
"type": null,
"docstring": null,
"docstring_tokens... |
38ef74983d65caeba78cfbb515b29d33091c5703 | masonng-astro/nicerpy_xrayanalysis | Lv2_ps_method.py | [
"MIT"
] | Python | pdgm | <not_specific> | def pdgm(times,counts,xlims,vlines,toplot,oversampling):
"""
Generating the power spectrum through the signal.periodogram method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second... |
Generating the power spectrum through the signal.periodogram method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second and third entry correspond to the desired x-limits of the plot
... | Generating the power spectrum through the signal.periodogram method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second and third entry correspond to the desired x-limits of the plot
vlines - a list or arr... | [
"Generating",
"the",
"power",
"spectrum",
"through",
"the",
"signal",
".",
"periodogram",
"method",
".",
"times",
"-",
"array",
"of",
"binned",
"times",
"counts",
"-",
"array",
"of",
"counts",
"from",
"the",
"binned",
"data",
"xlims",
"-",
"a",
"list",
"or... | def pdgm(times,counts,xlims,vlines,toplot,oversampling):
if type(times) != list and type(times) != np.ndarray:
raise TypeError("times should either be a list or an array!")
if type(counts) != list and type(counts) != np.ndarray:
raise TypeError("counts should either be a list or an array!")
... | [
"def",
"pdgm",
"(",
"times",
",",
"counts",
",",
"xlims",
",",
"vlines",
",",
"toplot",
",",
"oversampling",
")",
":",
"if",
"type",
"(",
"times",
")",
"!=",
"list",
"and",
"type",
"(",
"times",
")",
"!=",
"np",
".",
"ndarray",
":",
"raise",
"TypeE... | Generating the power spectrum through the signal.periodogram method. | [
"Generating",
"the",
"power",
"spectrum",
"through",
"the",
"signal",
".",
"periodogram",
"method",
"."
] | [
"\"\"\"\n Generating the power spectrum through the signal.periodogram method.\n\n times - array of binned times\n counts - array of counts from the binned data\n xlims - a list or array: first entry = True/False as to whether to impose an\n xlim; second and third entry correspond to the desired x-li... | [
{
"param": "times",
"type": null
},
{
"param": "counts",
"type": null
},
{
"param": "xlims",
"type": null
},
{
"param": "vlines",
"type": null
},
{
"param": "toplot",
"type": null
},
{
"param": "oversampling",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "times",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "counts",
"type": null,
"docstring": null,
"docstring_tokens"... |
38ef74983d65caeba78cfbb515b29d33091c5703 | masonng-astro/nicerpy_xrayanalysis | Lv2_ps_method.py | [
"MIT"
] | Python | manual | <not_specific> | def manual(times,counts,xlims,vlines,toplot,oversampling):
"""
Generating the power spectrum through the manual FFT method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second and t... |
Generating the power spectrum through the manual FFT method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second and third entry correspond to the desired x-limits of the plot
vlin... | Generating the power spectrum through the manual FFT method.
times - array of binned times
counts - array of counts from the binned data
xlims - a list or array: first entry = True/False as to whether to impose an
xlim; second and third entry correspond to the desired x-limits of the plot
vlines - a list or array: firs... | [
"Generating",
"the",
"power",
"spectrum",
"through",
"the",
"manual",
"FFT",
"method",
".",
"times",
"-",
"array",
"of",
"binned",
"times",
"counts",
"-",
"array",
"of",
"counts",
"from",
"the",
"binned",
"data",
"xlims",
"-",
"a",
"list",
"or",
"array",
... | def manual(times,counts,xlims,vlines,toplot,oversampling):
if type(times) != list and type(times) != np.ndarray:
raise TypeError("times should either be a list or an array!")
if type(counts) != list and type(counts) != np.ndarray:
raise TypeError("counts should either be a list or an array!")
... | [
"def",
"manual",
"(",
"times",
",",
"counts",
",",
"xlims",
",",
"vlines",
",",
"toplot",
",",
"oversampling",
")",
":",
"if",
"type",
"(",
"times",
")",
"!=",
"list",
"and",
"type",
"(",
"times",
")",
"!=",
"np",
".",
"ndarray",
":",
"raise",
"Typ... | Generating the power spectrum through the manual FFT method. | [
"Generating",
"the",
"power",
"spectrum",
"through",
"the",
"manual",
"FFT",
"method",
"."
] | [
"\"\"\"\n Generating the power spectrum through the manual FFT method.\n\n times - array of binned times\n counts - array of counts from the binned data\n xlims - a list or array: first entry = True/False as to whether to impose an\n xlim; second and third entry correspond to the desired x-limits of ... | [
{
"param": "times",
"type": null
},
{
"param": "counts",
"type": null
},
{
"param": "xlims",
"type": null
},
{
"param": "vlines",
"type": null
},
{
"param": "toplot",
"type": null
},
{
"param": "oversampling",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "times",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "counts",
"type": null,
"docstring": null,
"docstring_tokens"... |
6de4ceac5366b458a490bf879abb9fe2d0cad5bb | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_mathgrp_pha.py | [
"MIT"
] | Python | orb_phase_rate | <not_specific> | def orb_phase_rate(orb_phase):
"""
Returns the corresponding rate from the 20-binned folded profile
"""
top = 0.022177
bottom = 0.005351
if (orb_phase > 0.25 and orb_phase <= 0.80): #off-eclipse
rate = top
elif (orb_phase > 0.9 and orb_phase <= 1) or (orb_phase >= 0.0 and orb_phas... |
Returns the corresponding rate from the 20-binned folded profile
| Returns the corresponding rate from the 20-binned folded profile | [
"Returns",
"the",
"corresponding",
"rate",
"from",
"the",
"20",
"-",
"binned",
"folded",
"profile"
] | def orb_phase_rate(orb_phase):
top = 0.022177
bottom = 0.005351
if (orb_phase > 0.25 and orb_phase <= 0.80):
rate = top
elif (orb_phase > 0.9 and orb_phase <= 1) or (orb_phase >= 0.0 and orb_phase <= 0.1):
rate = bottom
elif (orb_phase > 0.1 and orb_phase <= 0.15):
rate = 0... | [
"def",
"orb_phase_rate",
"(",
"orb_phase",
")",
":",
"top",
"=",
"0.022177",
"bottom",
"=",
"0.005351",
"if",
"(",
"orb_phase",
">",
"0.25",
"and",
"orb_phase",
"<=",
"0.80",
")",
":",
"rate",
"=",
"top",
"elif",
"(",
"orb_phase",
">",
"0.9",
"and",
"o... | Returns the corresponding rate from the 20-binned folded profile | [
"Returns",
"the",
"corresponding",
"rate",
"from",
"the",
"20",
"-",
"binned",
"folded",
"profile"
] | [
"\"\"\"\n Returns the corresponding rate from the 20-binned folded profile\n \"\"\"",
"#off-eclipse",
"#on-eclipse",
"##### the rate is 0.011361",
"##### the rate is 0.014107",
"##### the rate is 0.019135",
"##### the rate is 0.015688",
"##### the rate is 0.011368"
] | [
{
"param": "orb_phase",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "orb_phase",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6de4ceac5366b458a490bf879abb9fe2d0cad5bb | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_mathgrp_pha.py | [
"MIT"
] | Python | combine_back_scal | null | def combine_back_scal(init_back_array,fake_spec,T0,Porb):
"""
Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space.
Unlike c... |
Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space.
Unlike combine_back, this SCALES the spectra/GTIs in the ingress/egress s... | Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space.
Unlike combine_back, this SCALES the spectra/GTIs in the ingress/egress sections
based on ... | [
"Given",
"a",
"timing",
"model",
"/",
"ephemeris",
"figure",
"out",
"which",
"orbital",
"phase",
"the",
"events",
"in",
"a",
"background",
"spectrum",
"/",
"event",
"file",
"are",
"in",
"(",
"defined",
"by",
"some",
"centroid",
"time",
")",
"then",
"write"... | def combine_back_scal(init_back_array,fake_spec,T0,Porb):
command_file = open(Lv0_dirs.NGC300_2020 + '3C50_X1scale_mathpha.go','w')
on_e = fake_spec[0]
off_e = fake_spec[1]
top = 0.022177
bottom = 0.005351
counter = 0
for i in tqdm(range(len(init_back_array))):
init_back = init_back_... | [
"def",
"combine_back_scal",
"(",
"init_back_array",
",",
"fake_spec",
",",
"T0",
",",
"Porb",
")",
":",
"command_file",
"=",
"open",
"(",
"Lv0_dirs",
".",
"NGC300_2020",
"+",
"'3C50_X1scale_mathpha.go'",
",",
"'w'",
")",
"on_e",
"=",
"fake_spec",
"[",
"0",
"... | Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space. | [
"Given",
"a",
"timing",
"model",
"/",
"ephemeris",
"figure",
"out",
"which",
"orbital",
"phase",
"the",
"events",
"in",
"a",
"background",
"spectrum",
"/",
"event",
"file",
"are",
"in",
"(",
"defined",
"by",
"some",
"centroid",
"time",
")",
"then",
"write"... | [
"\"\"\"\n Given a timing model/ephemeris, figure out which orbital phase the events in a\n background spectrum/event file are in (defined by some centroid time), then\n write a mathpha command combining those files appropriately in rate space.\n Unlike combine_back, this SCALES the spectra/GTIs in the i... | [
{
"param": "init_back_array",
"type": null
},
{
"param": "fake_spec",
"type": null
},
{
"param": "T0",
"type": null
},
{
"param": "Porb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "init_back_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fake_spec",
"type": null,
"docstring": null,
"docs... |
6de4ceac5366b458a490bf879abb9fe2d0cad5bb | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_mathgrp_pha.py | [
"MIT"
] | Python | combine_back | <not_specific> | def combine_back(init_back_array,fake_spec,T0,Porb):
"""
Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space
init_back_arr... |
Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space
init_back_array - array of input background file
fake_spec - array of... | Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space
array of input background file
fake_spec - array of files split by orbital phase
T0 - refe... | [
"Given",
"a",
"timing",
"model",
"/",
"ephemeris",
"figure",
"out",
"which",
"orbital",
"phase",
"the",
"events",
"in",
"a",
"background",
"spectrum",
"/",
"event",
"file",
"are",
"in",
"(",
"defined",
"by",
"some",
"centroid",
"time",
")",
"then",
"write"... | def combine_back(init_back_array,fake_spec,T0,Porb):
command_file = open(Lv0_dirs.NGC300_2020 + '3C50_X1_mathpha.go','w')
for i in tqdm(range(len(init_back_array))):
init_back = init_back_array[i]
gti_no = init_back[-8:-4]
init_cl = Lv0_dirs.NGC300_2020 + 'cl50/pha/cl50_' + gti_no + '.ph... | [
"def",
"combine_back",
"(",
"init_back_array",
",",
"fake_spec",
",",
"T0",
",",
"Porb",
")",
":",
"command_file",
"=",
"open",
"(",
"Lv0_dirs",
".",
"NGC300_2020",
"+",
"'3C50_X1_mathpha.go'",
",",
"'w'",
")",
"for",
"i",
"in",
"tqdm",
"(",
"range",
"(",
... | Given a timing model/ephemeris, figure out which orbital phase the events in a
background spectrum/event file are in (defined by some centroid time), then
write a mathpha command combining those files appropriately in rate space | [
"Given",
"a",
"timing",
"model",
"/",
"ephemeris",
"figure",
"out",
"which",
"orbital",
"phase",
"the",
"events",
"in",
"a",
"background",
"spectrum",
"/",
"event",
"file",
"are",
"in",
"(",
"defined",
"by",
"some",
"centroid",
"time",
")",
"then",
"write"... | [
"\"\"\"\n Given a timing model/ephemeris, figure out which orbital phase the events in a\n background spectrum/event file are in (defined by some centroid time), then\n write a mathpha command combining those files appropriately in rate space\n\n init_back_array - array of input background file\n fak... | [
{
"param": "init_back_array",
"type": null
},
{
"param": "fake_spec",
"type": null
},
{
"param": "T0",
"type": null
},
{
"param": "Porb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "init_back_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fake_spec",
"type": null,
"docstring": null,
"docs... |
6de4ceac5366b458a490bf879abb9fe2d0cad5bb | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_mathgrp_pha.py | [
"MIT"
] | Python | mathpha | <not_specific> | def mathpha(bin_size,filetype):
"""
Function that takes in a bin size, and does MATHPHA on the set of pha files.
The file names are already saved in the binned .ffphot files. The function
will output pha files of the format 'MJD_binsize_' + filetype + '_cl50.pha'!
bin_size - bin size in days
fi... |
Function that takes in a bin size, and does MATHPHA on the set of pha files.
The file names are already saved in the binned .ffphot files. The function
will output pha files of the format 'MJD_binsize_' + filetype + '_cl50.pha'!
bin_size - bin size in days
filetype - either 'bgsub' or 'bg' or 'cl'... | Function that takes in a bin size, and does MATHPHA on the set of pha files.
The file names are already saved in the binned .ffphot files. The function
will output pha files of the format 'MJD_binsize_' + filetype + '_cl50.pha'!
| [
"Function",
"that",
"takes",
"in",
"a",
"bin",
"size",
"and",
"does",
"MATHPHA",
"on",
"the",
"set",
"of",
"pha",
"files",
".",
"The",
"file",
"names",
"are",
"already",
"saved",
"in",
"the",
"binned",
".",
"ffphot",
"files",
".",
"The",
"function",
"w... | def mathpha(bin_size,filetype):
normfile = Lv0_dirs.NGC300_2020 + 'n300_ulx.bgsub_cl50_g2020norm_' + bin_size + '.fffphot'
mjds = np.genfromtxt(normfile,usecols=(0),unpack=True)
spectra_files = np.genfromtxt(normfile,dtype='str',usecols=(9),unpack=True)
for i in range(len(spectra_files)):
expos... | [
"def",
"mathpha",
"(",
"bin_size",
",",
"filetype",
")",
":",
"normfile",
"=",
"Lv0_dirs",
".",
"NGC300_2020",
"+",
"'n300_ulx.bgsub_cl50_g2020norm_'",
"+",
"bin_size",
"+",
"'.fffphot'",
"mjds",
"=",
"np",
".",
"genfromtxt",
"(",
"normfile",
",",
"usecols",
"... | Function that takes in a bin size, and does MATHPHA on the set of pha files. | [
"Function",
"that",
"takes",
"in",
"a",
"bin",
"size",
"and",
"does",
"MATHPHA",
"on",
"the",
"set",
"of",
"pha",
"files",
"."
] | [
"\"\"\"\n Function that takes in a bin size, and does MATHPHA on the set of pha files.\n The file names are already saved in the binned .ffphot files. The function\n will output pha files of the format 'MJD_binsize_' + filetype + '_cl50.pha'!\n\n bin_size - bin size in days\n filetype - either 'bgsub... | [
{
"param": "bin_size",
"type": null
},
{
"param": "filetype",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bin_size",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filetype",
"type": null,
"docstring": null,
"docstring_to... |
bd1d683548e8d4157944e307683bc7373cc1b260 | masonng-astro/nicerpy_xrayanalysis | Lv3_diagnostics_display.py | [
"MIT"
] | Python | display_all | null | def display_all(eventfile,diag_var,lc_t,lc_counts,diag_t,diag_counts,filetype):
"""
To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
diag_var - th... |
To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
diag_var - the diagnostic variable we are looking at
lc_t - array corresponding to time values f... | To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
path to the event file. Will extract ObsID from this for the NICER files. | [
"To",
"display",
"the",
"plots",
"for",
"desired",
"time",
"interval",
".",
"Whether",
"to",
"save",
"or",
"show",
"the",
"plots",
"is",
"determined",
"in",
"Lv3_diagnostics",
".",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"fro... | def display_all(eventfile,diag_var,lc_t,lc_counts,diag_t,diag_counts,filetype):
if type(diag_var) != str:
raise TypeError("diag_var should be a string!")
if filetype not in ['.att','.mkf','.cl'] and type(filetype) != list and type(filetype) != np.ndarray:
raise ValueError("filetype should be one... | [
"def",
"display_all",
"(",
"eventfile",
",",
"diag_var",
",",
"lc_t",
",",
"lc_counts",
",",
"diag_t",
",",
"diag_counts",
",",
"filetype",
")",
":",
"if",
"type",
"(",
"diag_var",
")",
"!=",
"str",
":",
"raise",
"TypeError",
"(",
"\"diag_var should be a str... | To display the plots for desired time interval. | [
"To",
"display",
"the",
"plots",
"for",
"desired",
"time",
"interval",
"."
] | [
"\"\"\"\n To display the plots for desired time interval. Whether to save or show the\n plots is determined in Lv3_diagnostics.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n diag_var - the diagnostic variable we are looking at\n lc_t - array corresponding... | [
{
"param": "eventfile",
"type": null
},
{
"param": "diag_var",
"type": null
},
{
"param": "lc_t",
"type": null
},
{
"param": "lc_counts",
"type": null
},
{
"param": "diag_t",
"type": null
},
{
"param": "diag_counts",
"type": null
},
{
"para... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "diag_var",
"type": null,
"docstring": null,
"docstring_t... |
bd1d683548e8d4157944e307683bc7373cc1b260 | masonng-astro/nicerpy_xrayanalysis | Lv3_diagnostics_display.py | [
"MIT"
] | Python | display_t | null | def display_t(eventfile,diag_var,t1,t2,lc_t,lc_counts,diag_t,diag_counts,filetype):
"""
To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
obsid - Observation ID of the object of interest (10-digit str)
diag_var - the diagnostic varia... |
To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
obsid - Observation ID of the object of interest (10-digit str)
diag_var - the diagnostic variable we are looking at
t1 - lower time boundary
t2 - upper time boundary
lc_t - ... | To display the plots for desired time interval. Whether to save or show the
plots is determined in Lv3_diagnostics.
| [
"To",
"display",
"the",
"plots",
"for",
"desired",
"time",
"interval",
".",
"Whether",
"to",
"save",
"or",
"show",
"the",
"plots",
"is",
"determined",
"in",
"Lv3_diagnostics",
"."
] | def display_t(eventfile,diag_var,t1,t2,lc_t,lc_counts,diag_t,diag_counts,filetype):
if type(diag_var) != str:
raise TypeError("diag_var should be a string!")
if t2<t1:
raise ValueError("t2 should be greater than t1!")
if filetype not in ['.att','.mkf','.cl'] and type(filetype) != list and ty... | [
"def",
"display_t",
"(",
"eventfile",
",",
"diag_var",
",",
"t1",
",",
"t2",
",",
"lc_t",
",",
"lc_counts",
",",
"diag_t",
",",
"diag_counts",
",",
"filetype",
")",
":",
"if",
"type",
"(",
"diag_var",
")",
"!=",
"str",
":",
"raise",
"TypeError",
"(",
... | To display the plots for desired time interval. | [
"To",
"display",
"the",
"plots",
"for",
"desired",
"time",
"interval",
"."
] | [
"\"\"\"\n To display the plots for desired time interval. Whether to save or show the\n plots is determined in Lv3_diagnostics.\n\n obsid - Observation ID of the object of interest (10-digit str)\n diag_var - the diagnostic variable we are looking at\n t1 - lower time boundary\n t2 - upper time bo... | [
{
"param": "eventfile",
"type": null
},
{
"param": "diag_var",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "lc_t",
"type": null
},
{
"param": "lc_counts",
"type": null
},
{
"param": "diag_t",... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "diag_var",
"type": null,
"docstring": null,
"docstring_t... |
daee8ff7057c3ca461033f92adc5753a23c8f5a2 | masonng-astro/nicerpy_xrayanalysis | Lv0_gunzip.py | [
"MIT"
] | Python | unzip_all | null | def unzip_all(obsdir):
"""
Does a recursive scan through the directory and unzips all files which have not yet been unzipped
obsdir - directory of all the observation files
"""
subprocess.run(['gunzip','-r',obsdir]) |
Does a recursive scan through the directory and unzips all files which have not yet been unzipped
obsdir - directory of all the observation files
| Does a recursive scan through the directory and unzips all files which have not yet been unzipped
obsdir - directory of all the observation files | [
"Does",
"a",
"recursive",
"scan",
"through",
"the",
"directory",
"and",
"unzips",
"all",
"files",
"which",
"have",
"not",
"yet",
"been",
"unzipped",
"obsdir",
"-",
"directory",
"of",
"all",
"the",
"observation",
"files"
] | def unzip_all(obsdir):
subprocess.run(['gunzip','-r',obsdir]) | [
"def",
"unzip_all",
"(",
"obsdir",
")",
":",
"subprocess",
".",
"run",
"(",
"[",
"'gunzip'",
",",
"'-r'",
",",
"obsdir",
"]",
")"
] | Does a recursive scan through the directory and unzips all files which have not yet been unzipped
obsdir - directory of all the observation files | [
"Does",
"a",
"recursive",
"scan",
"through",
"the",
"directory",
"and",
"unzips",
"all",
"files",
"which",
"have",
"not",
"yet",
"been",
"unzipped",
"obsdir",
"-",
"directory",
"of",
"all",
"the",
"observation",
"files"
] | [
"\"\"\"\n Does a recursive scan through the directory and unzips all files which have not yet been unzipped\n\n obsdir - directory of all the observation files\n \"\"\""
] | [
{
"param": "obsdir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsdir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6ab9d2b3402b4c431bfed6a7932e67bf49c83d7b | masonng-astro/nicerpy_xrayanalysis | Lv2_create_time_res_spec.py | [
"MIT"
] | Python | niextract_gti | <not_specific> | def niextract_gti(eventfile,gap,gtifile,min_exp):
"""
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis. (Very similar to that in Lv2_presto_subroutines,
except I create a list of paths to the event files.)
eventfile - path to the e... |
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis. (Very similar to that in Lv2_presto_subroutines,
except I create a list of paths to the event files.)
eventfile - path to the event file. Will extract ObsID from this for the NICER fil... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis. (Very similar to that in Lv2_presto_subroutines,
except I create a list of paths to the event files.)
path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation ... | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
".",
"(",
"Very",
"similar",
"to",
"that",
"in",
"Lv2_presto_subroutines",
"except",
"I",... | def niextract_gti(eventfile,gap,gtifile,min_exp):
parent_folder = str(pathlib.Path(eventfile).parent)
Lv1_data_gtis.GTI_bunching(eventfile,gap,gtifile)
gtis = list(fits.open(parent_folder+'/'+gtifile)[1].data)
niextract_folder = parent_folder + '/accelsearch_GTIs/'
Lv2_mkdir.makedir(niextract_folder... | [
"def",
"niextract_gti",
"(",
"eventfile",
",",
"gap",
",",
"gtifile",
",",
"min_exp",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"Lv1_data_gtis",
".",
"GTI_bunching",
"(",
"eventfile",
","... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis. | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
"."
] | [
"\"\"\"\n Using niextract-events to get segmented data based on the individual GTIs created with\n GTI_bunching in Lv1_data_gtis. (Very similar to that in Lv2_presto_subroutines,\n except I create a list of paths to the event files.)\n\n eventfile - path to the event file. Will extract ObsID from this f... | [
{
"param": "eventfile",
"type": null
},
{
"param": "gap",
"type": null
},
{
"param": "gtifile",
"type": null
},
{
"param": "min_exp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gap",
"type": null,
"docstring": null,
"docstring_tokens... |
6ab9d2b3402b4c431bfed6a7932e67bf49c83d7b | masonng-astro/nicerpy_xrayanalysis | Lv2_create_time_res_spec.py | [
"MIT"
] | Python | instructions | <not_specific> | def instructions(eventfile):
"""
Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
"""
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_folder = parent_fold... |
Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
| Writing a set of instructions to use in XSELECT, in order to extract the spectra and all.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Writing",
"a",
"set",
"of",
"instructions",
"to",
"use",
"in",
"XSELECT",
"in",
"order",
"to",
"extract",
"the",
"spectra",
"and",
"all",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for"... | def instructions(eventfile):
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
instruct_file = niextract_folder + '/instructions.txt'
eventfiles = sorted(glob.glob(niextract_folder+'/*E0050-1200.evt'))
instruct = open(instruct_file,'w... | [
"def",
"instructions",
"(",
"eventfile",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"niextract_folder",
"=",
"parent_folder",
"+",
"'/accelsearch_GTIs/spectra/'",
"instruct_file",
"=",
"niextract_... | Writing a set of instructions to use in XSELECT, in order to extract the spectra and all! | [
"Writing",
"a",
"set",
"of",
"instructions",
"to",
"use",
"in",
"XSELECT",
"in",
"order",
"to",
"extract",
"the",
"spectra",
"and",
"all!"
] | [
"\"\"\"\n Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n \"\"\""
] | [
{
"param": "eventfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6ab9d2b3402b4c431bfed6a7932e67bf49c83d7b | masonng-astro/nicerpy_xrayanalysis | Lv2_create_time_res_spec.py | [
"MIT"
] | Python | grppha | null | def grppha(eventfile):
"""
Function that does GRPPHA on a set of pha files.
The function will output pha files of the format 'grp_$file'!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
"""
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_f... |
Function that does GRPPHA on a set of pha files.
The function will output pha files of the format 'grp_$file'!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
| Function that does GRPPHA on a set of pha files.
The function will output pha files of the format 'grp_$file'!
path to the event file. Will extract ObsID from this for the NICER files. | [
"Function",
"that",
"does",
"GRPPHA",
"on",
"a",
"set",
"of",
"pha",
"files",
".",
"The",
"function",
"will",
"output",
"pha",
"files",
"of",
"the",
"format",
"'",
"grp_$file",
"'",
"!",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"Ob... | def grppha(eventfile):
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
binned_phas = sorted(glob.glob(niextract_folder+'*pha'))
command_file = niextract_folder + 'grppha_commands.go'
writing = open(command_file,'w')
grppha = 'gr... | [
"def",
"grppha",
"(",
"eventfile",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"niextract_folder",
"=",
"parent_folder",
"+",
"'/accelsearch_GTIs/spectra/'",
"binned_phas",
"=",
"sorted",
"(",
... | Function that does GRPPHA on a set of pha files. | [
"Function",
"that",
"does",
"GRPPHA",
"on",
"a",
"set",
"of",
"pha",
"files",
"."
] | [
"\"\"\"\n Function that does GRPPHA on a set of pha files.\n The function will output pha files of the format 'grp_$file'!\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n \"\"\"",
"#### now to build the grppha command",
"#comm = 'comm=\"group nicer_channel... | [
{
"param": "eventfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6ab9d2b3402b4c431bfed6a7932e67bf49c83d7b | masonng-astro/nicerpy_xrayanalysis | Lv2_create_time_res_spec.py | [
"MIT"
] | Python | xspec_read_all | <not_specific> | def xspec_read_all(eventfile):
"""
To read all the spectral files (with rmf,arf already set!) and ignore 0.0-0.3, 12-higher keV
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
"""
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_folder = parent... |
To read all the spectral files (with rmf,arf already set!) and ignore 0.0-0.3, 12-higher keV
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
| To read all the spectral files (with rmf,arf already set!) and ignore 0.0-0.3, 12-higher keV
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"To",
"read",
"all",
"the",
"spectral",
"files",
"(",
"with",
"rmf",
"arf",
"already",
"set!",
")",
"and",
"ignore",
"0",
".",
"0",
"-",
"0",
".",
"3",
"12",
"-",
"higher",
"keV",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",... | def xspec_read_all(eventfile):
parent_folder = str(pathlib.Path(eventfile).parent)
niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
spectrafiles = sorted(glob.glob(niextract_folder+'/*.pha'))
readspectra = open(niextract_folder + 'readspectra.xcm','w')
data_string = 'data ' + ' '.join... | [
"def",
"xspec_read_all",
"(",
"eventfile",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"niextract_folder",
"=",
"parent_folder",
"+",
"'/accelsearch_GTIs/spectra/'",
"spectrafiles",
"=",
"sorted",
... | To read all the spectral files (with rmf,arf already set!) | [
"To",
"read",
"all",
"the",
"spectral",
"files",
"(",
"with",
"rmf",
"arf",
"already",
"set!",
")"
] | [
"\"\"\"\n To read all the spectral files (with rmf,arf already set!) and ignore 0.0-0.3, 12-higher keV\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n \"\"\""
] | [
{
"param": "eventfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
360801dd2c2779fe009ea14bbfd94dc93676e946 | masonng-astro/nicerpy_xrayanalysis | Lv0_fits2dict.py | [
"MIT"
] | Python | fits2dict | <not_specific> | def fits2dict(fits_file,ext,par_list):
"""
'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
(be it from NICER-data ... |
'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
(be it from NICER-data or NICERsoft_outputs or any other mission whic... | 'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
(be it from NICER-data or NICERsoft_outputs or any other mission which has this format... | [
"'",
"Converts",
"'",
"a",
"FITS",
"file",
"to",
"a",
"Python",
"dictionary",
"with",
"a",
"list",
"of",
"the",
"original",
"FITS",
"table",
"'",
"s",
"columns",
"of",
"the",
"user",
"'",
"s",
"choosing",
".",
"Can",
"use",
"this",
"for",
"ANY",
"FIT... | def fits2dict(fits_file,ext,par_list):
if type(fits_file) != str:
raise TypeError("fits_file should be a string!")
if type(ext) != int:
raise TypeError("ext should be an integer!")
if type(par_list) != list and type(par_list) != np.ndarray:
raise TypeError("par_list should either be ... | [
"def",
"fits2dict",
"(",
"fits_file",
",",
"ext",
",",
"par_list",
")",
":",
"if",
"type",
"(",
"fits_file",
")",
"!=",
"str",
":",
"raise",
"TypeError",
"(",
"\"fits_file should be a string!\"",
")",
"if",
"type",
"(",
"ext",
")",
"!=",
"int",
":",
"rai... | 'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing. | [
"'",
"Converts",
"'",
"a",
"FITS",
"file",
"to",
"a",
"Python",
"dictionary",
"with",
"a",
"list",
"of",
"the",
"original",
"FITS",
"table",
"'",
"s",
"columns",
"of",
"the",
"user",
"'",
"s",
"choosing",
"."
] | [
"\"\"\"\n 'Converts' a FITS file to a Python dictionary, with a list of the original\n FITS table's columns, of the user's choosing. Can use this for ANY FITS file,\n but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files\n (be it from NICER-data or NICERsoft_outputs or any oth... | [
{
"param": "fits_file",
"type": null
},
{
"param": "ext",
"type": null
},
{
"param": "par_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fits_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ext",
"type": null,
"docstring": null,
"docstring_tokens... |
daa36842ff1c9536d2d0f10566d8fcbf40463246 | masonng-astro/nicerpy_xrayanalysis | Lv0_get_swift_data.py | [
"MIT"
] | Python | download_txt | null | def download_txt(txtfile):
"""
Given the text file of download instructions, take the URLs of where the data
are stored within the HEASARC archive, and use download_wget.pl to retrieve them
"""
contents = open(txtfile,'r').read().split('\n')
urls = [contents[i].split(' ')[-1] for i in range(len(... |
Given the text file of download instructions, take the URLs of where the data
are stored within the HEASARC archive, and use download_wget.pl to retrieve them
| Given the text file of download instructions, take the URLs of where the data
are stored within the HEASARC archive, and use download_wget.pl to retrieve them | [
"Given",
"the",
"text",
"file",
"of",
"download",
"instructions",
"take",
"the",
"URLs",
"of",
"where",
"the",
"data",
"are",
"stored",
"within",
"the",
"HEASARC",
"archive",
"and",
"use",
"download_wget",
".",
"pl",
"to",
"retrieve",
"them"
] | def download_txt(txtfile):
contents = open(txtfile,'r').read().split('\n')
urls = [contents[i].split(' ')[-1] for i in range(len(contents)-1)]
for i in tqdm(range(len(urls))):
subprocess.run(['perl','/Volumes/Samsung_T5/download_wget.pl',urls[i]]) | [
"def",
"download_txt",
"(",
"txtfile",
")",
":",
"contents",
"=",
"open",
"(",
"txtfile",
",",
"'r'",
")",
".",
"read",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
"urls",
"=",
"[",
"contents",
"[",
"i",
"]",
".",
"split",
"(",
"' '",
")",
"[",
... | Given the text file of download instructions, take the URLs of where the data
are stored within the HEASARC archive, and use download_wget.pl to retrieve them | [
"Given",
"the",
"text",
"file",
"of",
"download",
"instructions",
"take",
"the",
"URLs",
"of",
"where",
"the",
"data",
"are",
"stored",
"within",
"the",
"HEASARC",
"archive",
"and",
"use",
"download_wget",
".",
"pl",
"to",
"retrieve",
"them"
] | [
"\"\"\"\n Given the text file of download instructions, take the URLs of where the data\n are stored within the HEASARC archive, and use download_wget.pl to retrieve them\n \"\"\""
] | [
{
"param": "txtfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "txtfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | niextract_gti | <not_specific> | def niextract_gti(eventfile,gap,gtifile):
"""
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation between end time of 1st ... |
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation between end time of 1st GTI and start time of 2nd GTI allowed
gtifile... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis.
path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation between end time of 1st GTI and start time of 2nd GTI allowed
gtifile - name of GTI file | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
".",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"... | def niextract_gti(eventfile,gap,gtifile):
parent_folder = str(pathlib.Path(eventfile).parent)
Lv1_data_gtis.GTI_bunching(eventfile,gap,gtifile)
gtis = list(fits.open(parent_folder+'/'+gtifile)[1].data)
niextract_folder = parent_folder + '/accelsearch_GTIs/'
Lv2_mkdir.makedir(niextract_folder)
fo... | [
"def",
"niextract_gti",
"(",
"eventfile",
",",
"gap",
",",
"gtifile",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"Lv1_data_gtis",
".",
"GTI_bunching",
"(",
"eventfile",
",",
"gap",
",",
... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis. | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
"."
] | [
"\"\"\"\n Using niextract-events to get segmented data based on the individual GTIs created with\n GTI_bunching in Lv1_data_gtis.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n gap - maximum separation between end time of 1st GTI and start time of 2nd GTI all... | [
{
"param": "eventfile",
"type": null
},
{
"param": "gap",
"type": null
},
{
"param": "gtifile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gap",
"type": null,
"docstring": null,
"docstring_tokens... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | niextract_gti_E | <not_specific> | def niextract_gti_E(eventfile,gap,gtifile,PI1,PI2):
"""
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis, AND with energy cuts
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum sepa... |
Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis, AND with energy cuts
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation between end time of 1st GTI and start time of 2nd GT... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis, AND with energy cuts
path to the event file. Will extract ObsID from this for the NICER files.
gap - maximum separation between end time of 1st GTI and start time of 2nd GTI allowed
gtifile - name of G... | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
"AND",
"with",
"energy",
"cuts",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"... | def niextract_gti_E(eventfile,gap,gtifile,PI1,PI2):
parent_folder = str(pathlib.Path(eventfile).parent)
Lv1_data_gtis.GTI_bunching(eventfile,gap,gtifile)
gtis = list(fits.open(parent_folder+'/'+gtifile)[1].data)
niextract_folder = parent_folder + '/accelsearch_GTIs/'
Lv2_mkdir.makedir(niextract_fold... | [
"def",
"niextract_gti_E",
"(",
"eventfile",
",",
"gap",
",",
"gtifile",
",",
"PI1",
",",
"PI2",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"Lv1_data_gtis",
".",
"GTI_bunching",
"(",
"eve... | Using niextract-events to get segmented data based on the individual GTIs created with
GTI_bunching in Lv1_data_gtis, AND with energy cuts | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"individual",
"GTIs",
"created",
"with",
"GTI_bunching",
"in",
"Lv1_data_gtis",
"AND",
"with",
"energy",
"cuts"
] | [
"\"\"\"\n Using niextract-events to get segmented data based on the individual GTIs created with\n GTI_bunching in Lv1_data_gtis, AND with energy cuts\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n gap - maximum separation between end time of 1st GTI and star... | [
{
"param": "eventfile",
"type": null
},
{
"param": "gap",
"type": null
},
{
"param": "gtifile",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param": "PI2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gap",
"type": null,
"docstring": null,
"docstring_tokens... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | niextract_gti_time | <not_specific> | def niextract_gti_time(eventfile,segment_length):
"""
Using niextract-events to get segmented data based on the [segment_length]-length
GTIs that were created above!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segmen... |
Using niextract-events to get segmented data based on the [segment_length]-length
GTIs that were created above!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments for combining power spectra
| Using niextract-events to get segmented data based on the [segment_length]-length
GTIs that were created above.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments for combining power spectra | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"[",
"segment_length",
"]",
"-",
"length",
"GTIs",
"that",
"were",
"created",
"above",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
... | def niextract_gti_time(eventfile,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
gtis = fits.open(eventfile)[2].data
times = fits.open(eventfile)[1].data['TIME']
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
... | [
"def",
"niextract_gti_time",
"(",
"eventfile",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"gtis",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
"2",
"]",
... | Using niextract-events to get segmented data based on the [segment_length]-length
GTIs that were created above! | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"[",
"segment_length",
"]",
"-",
"length",
"GTIs",
"that",
"were",
"created",
"above!"
] | [
"\"\"\"\n Using niextract-events to get segmented data based on the [segment_length]-length\n GTIs that were created above!\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments for combining power spectra\n \"\"\"... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | niextract_gti_energy | <not_specific> | def niextract_gti_energy(eventfile,PI1,PI2):
"""
Using niextract-events to get segmented data based on the energy range
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
PI1 - lower bound of PI (not energy in keV!) desired for the energy range
PI2 - upper bound of... |
Using niextract-events to get segmented data based on the energy range
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
PI1 - lower bound of PI (not energy in keV!) desired for the energy range
PI2 - upper bound of PI (not energy in keV!) desired for the energy rang... | Using niextract-events to get segmented data based on the energy range
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
PI1 - lower bound of PI (not energy in keV!) desired for the energy range
PI2 - upper bound of PI (not energy in keV!) desired for the energy range | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"energy",
"range",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
... | def niextract_gti_energy(eventfile,PI1,PI2):
parent_folder = str(pathlib.Path(eventfile).parent)
gtis = fits.open(eventfile)[2].data
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
niextract_folder = parent_folder + '/accelsearch_E/'... | [
"def",
"niextract_gti_energy",
"(",
"eventfile",
",",
"PI1",
",",
"PI2",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"gtis",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
"2",
... | Using niextract-events to get segmented data based on the energy range
eventfile - path to the event file. | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"the",
"energy",
"range",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Using niextract-events to get segmented data based on the energy range\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n PI1 - lower bound of PI (not energy in keV!) desired for the energy range\n PI2 - upper bound of PI (not energy in keV!) desired for ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param": "PI2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "PI1",
"type": null,
"docstring": null,
"docstring_tokens... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | niextract_gti_time_energy | <not_specific> | def niextract_gti_time_energy(eventfile,segment_length,PI1,PI2):
"""
Using niextract-events to get segmented data based on [segment_length]-length
GTIs that were created above, AND energy range!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - le... |
Using niextract-events to get segmented data based on [segment_length]-length
GTIs that were created above, AND energy range!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments for combining power spectra
PI1 - lo... | Using niextract-events to get segmented data based on [segment_length]-length
GTIs that were created above, AND energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments for combining power spectra
PI1 - lower bound of PI (not ... | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"[",
"segment_length",
"]",
"-",
"length",
"GTIs",
"that",
"were",
"created",
"above",
"AND",
"energy",
"range",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"fil... | def niextract_gti_time_energy(eventfile,segment_length,PI1,PI2):
parent_folder = str(pathlib.Path(eventfile).parent)
gtis = fits.open(eventfile)[2].data
times = fits.open(eventfile)[1].data['TIME']
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_head... | [
"def",
"niextract_gti_time_energy",
"(",
"eventfile",
",",
"segment_length",
",",
"PI1",
",",
"PI2",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"gtis",
"=",
"fits",
".",
"open",
"(",
"ev... | Using niextract-events to get segmented data based on [segment_length]-length
GTIs that were created above, AND energy range! | [
"Using",
"niextract",
"-",
"events",
"to",
"get",
"segmented",
"data",
"based",
"on",
"[",
"segment_length",
"]",
"-",
"length",
"GTIs",
"that",
"were",
"created",
"above",
"AND",
"energy",
"range!"
] | [
"\"\"\"\n Using niextract-events to get segmented data based on [segment_length]-length\n GTIs that were created above, AND energy range!\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments for combining power spect... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param": "PI2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | do_nicerfits2presto | <not_specific> | def do_nicerfits2presto(eventfile,tbin,segment_length,mode):
"""
Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
I can always move files to different folders to prevent repeats (especially for large files)
eventfile - path to the event file. Will extract ObsID from... |
Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
I can always move files to different folders to prevent repeats (especially for large files)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins in time
s... | Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
I can always move files to different folders to prevent repeats (especially for large files)
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Using",
"nicerfits2presto",
".",
"py",
"to",
"bin",
"the",
"data",
"and",
"to",
"convert",
"into",
"PRESTO",
"-",
"readable",
"format",
".",
"I",
"can",
"always",
"move",
"files",
"to",
"different",
"folders",
"to",
"prevent",
"repeats",
"(",
"especially",
... | def do_nicerfits2presto(eventfile,tbin,segment_length,mode):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
if mode == "all":
subprocess.run(['nicerfits2presto.py','--dt='+str... | [
"def",
"do_nicerfits2presto",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
",",
"mode",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
... | Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format. | [
"Using",
"nicerfits2presto",
".",
"py",
"to",
"bin",
"the",
"data",
"and",
"to",
"convert",
"into",
"PRESTO",
"-",
"readable",
"format",
"."
] | [
"\"\"\"\n Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.\n I can always move files to different folders to prevent repeats (especially for large files)\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n tbin - size of the bin... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | edit_inf | <not_specific> | def edit_inf(eventfile,tbin,segment_length):
"""
Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though!
eventfile - path to the event file. Will ... |
Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbi... | Editing the .inf file, as it seems like accelsearch uses some information from the .inf file.
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins ... | [
"Editing",
"the",
".",
"inf",
"file",
"as",
"it",
"seems",
"like",
"accelsearch",
"uses",
"some",
"information",
"from",
"the",
".",
"inf",
"file",
".",
"Mainly",
"need",
"to",
"edit",
"the",
"\"",
"Number",
"of",
"bins",
"in",
"the",
"time",
"series",
... | def edit_inf(eventfile,tbin,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
inf_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(segment_length) + 's/*GTI*' + str(segment_length).zfill(5)+'s*.inf'))
#inf_files = sorted(glo... | [
"def",
"edit_inf",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
... | Editing the .inf file, as it seems like accelsearch uses some information from the .inf file! | [
"Editing",
"the",
".",
"inf",
"file",
"as",
"it",
"seems",
"like",
"accelsearch",
"uses",
"some",
"information",
"from",
"the",
".",
"inf",
"file!"
] | [
"\"\"\"\n Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!\n Mainly need to edit the \"Number of bins in the time series\".\n This is only for when we make segments by time though!\n eventfile - path to the event file. Will extract ObsID from this for the NIC... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | edit_binary | <not_specific> | def edit_binary(eventfile,tbin,segment_length):
"""
To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment!
Jul 10: Do zero-padding instead... so that number of counts is consistent!
Again, t... |
To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment!
Jul 10: Do zero-padding instead... so that number of counts is consistent!
Again, this is only for when we make segments by time!
even... | To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment.
Jul 10: Do zero-padding instead... so that number of counts is consistent.
Again, this is only for when we make segments by time.
eventfile - path to the e... | [
"To",
"pad",
"the",
"binary",
"file",
"so",
"that",
"it",
"will",
"be",
"as",
"long",
"as",
"the",
"desired",
"segment",
"length",
".",
"The",
"value",
"to",
"pad",
"with",
"for",
"each",
"time",
"bin",
"is",
"the",
"average",
"count",
"rate",
"in",
... | def edit_binary(eventfile,tbin,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
dat_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(segment_length) + 's/*GTI*' + str(segment_length).zfill(5) + 's*.dat'))
#dat_files = sorte... | [
"def",
"edit_binary",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[... | To pad the binary file so that it will be as long as the desired segment length. | [
"To",
"pad",
"the",
"binary",
"file",
"so",
"that",
"it",
"will",
"be",
"as",
"long",
"as",
"the",
"desired",
"segment",
"length",
"."
] | [
"\"\"\"\n To pad the binary file so that it will be as long as the desired segment length.\n The value to pad with for each time bin, is the average count rate in THAT segment!\n Jul 10: Do zero-padding instead... so that number of counts is consistent!\n Again, this is only for when we make segments by... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | realfft | <not_specific> | def realfft(eventfile,segment_length,mode):
"""
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis", or "E" ; basically to tell the fun... |
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis", or "E" ; basically to tell the function where to access files to run realfft for
| Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Performing",
"PRESTO",
"'",
"s",
"realfft",
"on",
"the",
"binned",
"data",
"(",
".",
"dat",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def realfft(eventfile,segment_length,mode):
parent_folder = str(pathlib.Path(eventfile).parent)
if mode == "all":
dat_files = sorted(glob.glob(parent_folder+'/*.dat'))
logfile = parent_folder + '/realfft_all.log'
elif mode == "t":
dat_files = sorted(glob.glob(parent_folder+'/accelsea... | [
"def",
"realfft",
"(",
"eventfile",
",",
"segment_length",
",",
"mode",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"if",
"mode",
"==",
"\"all\"",
":",
"dat_files",
"=",
"sorted",
"(",
... | Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. | [
"Performing",
"PRESTO",
"'",
"s",
"realfft",
"on",
"the",
"binned",
"data",
"(",
".",
"dat",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Performing PRESTO's realfft on the binned data (.dat)\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments\n mode - \"all\", \"t\", \"gtis\", or \"E\" ; basically to tell the function where to access files ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | accelsearch | <not_specific> | def accelsearch(eventfile,segment_length,mode,flags):
"""
Performing PRESTO's accelsearch on the FFT data (.fft)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis" or "E" ; basically to te... |
Performing PRESTO's accelsearch on the FFT data (.fft)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis" or "E" ; basically to tell the function where to access files to run accelsearch for
... | Performing PRESTO's accelsearch on the FFT data (.fft)
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Performing",
"PRESTO",
"'",
"s",
"accelsearch",
"on",
"the",
"FFT",
"data",
"(",
".",
"fft",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def accelsearch(eventfile,segment_length,mode,flags):
if type(flags) != list:
raise TypeError("flags should be a list! Not even an array.")
parent_folder = str(pathlib.Path(eventfile).parent)
if mode == "all":
fft_files = sorted(glob.glob(parent_folder+'/*.fft'))
logfile = parent_fol... | [
"def",
"accelsearch",
"(",
"eventfile",
",",
"segment_length",
",",
"mode",
",",
"flags",
")",
":",
"if",
"type",
"(",
"flags",
")",
"!=",
"list",
":",
"raise",
"TypeError",
"(",
"\"flags should be a list! Not even an array.\"",
")",
"parent_folder",
"=",
"str",... | Performing PRESTO's accelsearch on the FFT data (.fft)
eventfile - path to the event file. | [
"Performing",
"PRESTO",
"'",
"s",
"accelsearch",
"on",
"the",
"FFT",
"data",
"(",
".",
"fft",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Performing PRESTO's accelsearch on the FFT data (.fft)\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments\n mode - \"all\", \"t\", \"gtis\" or \"E\" ; basically to tell the function where to access files ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
},
{
"param": "flags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | prepfold | <not_specific> | def prepfold(eventfile,segment_length,mode,zmax):
"""
Performing PRESTO's prepfold on the pulsation candidates.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis", or "E" ; basically to te... |
Performing PRESTO's prepfold on the pulsation candidates.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
mode - "all", "t", "gtis", or "E" ; basically to tell the function where to access files to run prepfold for... | Performing PRESTO's prepfold on the pulsation candidates.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Performing",
"PRESTO",
"'",
"s",
"prepfold",
"on",
"the",
"pulsation",
"candidates",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def prepfold(eventfile,segment_length,mode,zmax):
parent_folder = str(pathlib.Path(eventfile).parent)
if mode == "all":
ACCEL_files = sorted(glob.glob(parent_folder+'/*ACCEL_'+str(zmax)))
logfile = parent_folder + '/prepfold_all.log'
elif mode == "t":
ACCEL_files = sorted(glob.glob(p... | [
"def",
"prepfold",
"(",
"eventfile",
",",
"segment_length",
",",
"mode",
",",
"zmax",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"if",
"mode",
"==",
"\"all\"",
":",
"ACCEL_files",
"=",
... | Performing PRESTO's prepfold on the pulsation candidates. | [
"Performing",
"PRESTO",
"'",
"s",
"prepfold",
"on",
"the",
"pulsation",
"candidates",
"."
] | [
"\"\"\"\n Performing PRESTO's prepfold on the pulsation candidates.\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments\n mode - \"all\", \"t\", \"gtis\", or \"E\" ; basically to tell the function where to access fi... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
},
{
"param": "zmax",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | filter_accelsearch | null | def filter_accelsearch(eventfile,mode,min_freq,zmax):
"""
Added on 8/31/2020. To filter out the ACCEL files by displaying a list of candidates
that have met a frequency threshold (to avoid very low frequency candidates, really)
The files will have been generated via prepfold already - perhaps in the fu... |
Added on 8/31/2020. To filter out the ACCEL files by displaying a list of candidates
that have met a frequency threshold (to avoid very low frequency candidates, really)
The files will have been generated via prepfold already - perhaps in the future, I may
only run prepfold on candidates I want! Maybe... |
The files will have been generated via prepfold already - perhaps in the future, I may
only run prepfold on candidates I want. Maybe do this to avoid having too many candidates
path to the event file. Will extract ObsID from this for the NICER files. | [
"The",
"files",
"will",
"have",
"been",
"generated",
"via",
"prepfold",
"already",
"-",
"perhaps",
"in",
"the",
"future",
"I",
"may",
"only",
"run",
"prepfold",
"on",
"candidates",
"I",
"want",
".",
"Maybe",
"do",
"this",
"to",
"avoid",
"having",
"too",
... | def filter_accelsearch(eventfile,mode,min_freq,zmax):
parent_folder = str(pathlib.Path(eventfile).parent)
if mode == "all":
ACCEL_files = sorted(glob.glob(parent_folder+'/*ACCEL_'+str(zmax)))
elif mode == "t":
ACCEL_files = sorted(glob.glob(parent_folder+'/accelsearch_'+str(segment_length)+'... | [
"def",
"filter_accelsearch",
"(",
"eventfile",
",",
"mode",
",",
"min_freq",
",",
"zmax",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"if",
"mode",
"==",
"\"all\"",
":",
"ACCEL_files",
"=... | Added on 8/31/2020. | [
"Added",
"on",
"8",
"/",
"31",
"/",
"2020",
"."
] | [
"\"\"\"\n Added on 8/31/2020. To filter out the ACCEL files by displaying a list of candidates\n that have met a frequency threshold (to avoid very low frequency candidates, really)\n\n The files will have been generated via prepfold already - perhaps in the future, I may\n only run prepfold on candidat... | [
{
"param": "eventfile",
"type": null
},
{
"param": "mode",
"type": null
},
{
"param": "min_freq",
"type": null
},
{
"param": "zmax",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": null,
"docstring": null,
"docstring_token... |
ffc5db7f7a959501171d8c131120ae2a1b20e807 | masonng-astro/nicerpy_xrayanalysis | Lv2_presto_subroutines.py | [
"MIT"
] | Python | ps2pdf | <not_specific> | def ps2pdf(eventfile,segment_length,mode):
"""
Converting from .ps to .pdf
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
mode - "all", "t", "gtis", or "E" ; basically to tell the function where to access files to run ps2pdf for
"""
parent_folder = str(path... |
Converting from .ps to .pdf
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
mode - "all", "t", "gtis", or "E" ; basically to tell the function where to access files to run ps2pdf for
| Converting from .ps to .pdf
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Converting",
"from",
".",
"ps",
"to",
".",
"pdf",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def ps2pdf(eventfile,segment_length,mode):
parent_folder = str(pathlib.Path(eventfile).parent)
if mode == "all":
ps_files = sorted(glob.glob(parent_folder+'/*ps'))
elif mode == "t":
ps_files = sorted(glob.glob(parent_folder+'/accelsearch_'+str(segment_length)+'s/*ps'))
elif mode == "E":
... | [
"def",
"ps2pdf",
"(",
"eventfile",
",",
"segment_length",
",",
"mode",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"if",
"mode",
"==",
"\"all\"",
":",
"ps_files",
"=",
"sorted",
"(",
"g... | Converting from .ps to .pdf
eventfile - path to the event file. | [
"Converting",
"from",
".",
"ps",
"to",
".",
"pdf",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Converting from .ps to .pdf\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n mode - \"all\", \"t\", \"gtis\", or \"E\" ; basically to tell the function where to access files to run ps2pdf for\n \"\"\"",
"#replacing .ps to .pdf",
"#using ps2pdf to co... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
adc31a9d2d941535622bec3930fb4142239e9747 | masonng-astro/nicerpy_xrayanalysis | Lv2_lc.py | [
"MIT"
] | Python | partial_tE | null | def partial_tE(eventfile,par_list,tbin_size,t1,t2,E1,E2,mode):
"""
Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters we'd like to extract from the FITS file
... |
Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
tbin_size - the size of ... | Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
... | def partial_tE(eventfile,par_list,tbin_size,t1,t2,E1,E2,mode):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if 'TIME' not in par_list:
raise ValueError("You should have 'TIME' in the parameter list!")
if type(par_list) != list and type(par_list) != np.ndarray:
... | [
"def",
"partial_tE",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"t1",
",",
"t2",
",",
"E1",
",",
"E2",
",",
"mode",
")",
":",
"if",
"type",
"(",
"eventfile",
")",
"!=",
"str",
":",
"raise",
"TypeError",
"(",
"\"eventfile should be a string... | Plot the time series for a desired time interval and desired energy range. | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the time series for a desired time interval and desired energy range.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)\n tbin_si... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "E1",
"type": null
},
{
"param": "E2",
"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
8910e85cbc8704ba9ec0dd1c191cb06f1a90774f | masonng-astro/nicerpy_xrayanalysis | Lv2_efsearch.py | [
"MIT"
] | Python | efsearch | null | def efsearch(eventfile,n_segments,dper,nphase,nbint,nper,dres,outfile_root,plot_efsearch):
"""
Performing FTOOLS' efsearch!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
n_segments - no. of segments to break the epoch folding search into
dper - value for peri... |
Performing FTOOLS' efsearch!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
n_segments - no. of segments to break the epoch folding search into
dper - value for period used in the folding; input represents center of range of trial periods
nphase - no. of phas... | Performing FTOOLS' efsearch.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Performing",
"FTOOLS",
"'",
"efsearch",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def efsearch(eventfile,n_segments,dper,nphase,nbint,nper,dres,outfile_root,plot_efsearch):
efsearch_cmd = ['efsearch',eventfile,'window="-"','sepoch=INDEF','dper='+str(dper),'nphase='+str(nphase),'nbint='+str(nbint),'nper='+str(nper),'dres='+str(dres),'outfile='+outfile_root,'outfiletype=2','plot='+plot_efsearch]
... | [
"def",
"efsearch",
"(",
"eventfile",
",",
"n_segments",
",",
"dper",
",",
"nphase",
",",
"nbint",
",",
"nper",
",",
"dres",
",",
"outfile_root",
",",
"plot_efsearch",
")",
":",
"efsearch_cmd",
"=",
"[",
"'efsearch'",
",",
"eventfile",
",",
"'window=\"-\"'",
... | Performing FTOOLS' efsearch! | [
"Performing",
"FTOOLS",
"'",
"efsearch!"
] | [
"\"\"\"\n Performing FTOOLS' efsearch!\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n n_segments - no. of segments to break the epoch folding search into\n dper - value for period used in the folding; input represents center of range of trial periods\n nph... | [
{
"param": "eventfile",
"type": null
},
{
"param": "n_segments",
"type": null
},
{
"param": "dper",
"type": null
},
{
"param": "nphase",
"type": null
},
{
"param": "nbint",
"type": null
},
{
"param": "nper",
"type": null
},
{
"param": "dres... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n_segments",
"type": null,
"docstring": null,
"docstring... |
8331468ac373dc7daa20fb913a8f4effae45782e | masonng-astro/nicerpy_xrayanalysis | Lv3_analyze_xspec_pars.py | [
"MIT"
] | Python | model_par | <not_specific> | def model_par(model):
"""
Given the model, return a list of associated Parameters
model - name of the model used
"""
if model == 'powerlaw':
return ['PhoIndex','norm']
if model == 'bbodyrad':
return ['kT','norm']
if model == 'ezdiskbb':
return ['T_max','norm']
if... |
Given the model, return a list of associated Parameters
model - name of the model used
| Given the model, return a list of associated Parameters
model - name of the model used | [
"Given",
"the",
"model",
"return",
"a",
"list",
"of",
"associated",
"Parameters",
"model",
"-",
"name",
"of",
"the",
"model",
"used"
] | def model_par(model):
if model == 'powerlaw':
return ['PhoIndex','norm']
if model == 'bbodyrad':
return ['kT','norm']
if model == 'ezdiskbb':
return ['T_max','norm']
if model == 'diskbb':
return ['Tin','norm']
if model == 'cutoffpl':
return ['PhoIndex','HighEC... | [
"def",
"model_par",
"(",
"model",
")",
":",
"if",
"model",
"==",
"'powerlaw'",
":",
"return",
"[",
"'PhoIndex'",
",",
"'norm'",
"]",
"if",
"model",
"==",
"'bbodyrad'",
":",
"return",
"[",
"'kT'",
",",
"'norm'",
"]",
"if",
"model",
"==",
"'ezdiskbb'",
"... | Given the model, return a list of associated Parameters
model - name of the model used | [
"Given",
"the",
"model",
"return",
"a",
"list",
"of",
"associated",
"Parameters",
"model",
"-",
"name",
"of",
"the",
"model",
"used"
] | [
"\"\"\"\n Given the model, return a list of associated Parameters\n\n model - name of the model used\n \"\"\""
] | [
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8331468ac373dc7daa20fb913a8f4effae45782e | masonng-astro/nicerpy_xrayanalysis | Lv3_analyze_xspec_pars.py | [
"MIT"
] | Python | plot_HID | <not_specific> | def plot_HID(MJDs):
"""
Plot the soft color-intensity diagram for a given set of MJDs
MJDs - list of MJDs used
"""
mjd_data,soft,soft_err,intensity,intensity_err = np.genfromtxt(Lv0_dirs.NGC300+'soft_color_HID.txt',skip_header=1,usecols=(0,1,2,3,4),unpack=True)
soft_trunc = [soft[i] for i in r... |
Plot the soft color-intensity diagram for a given set of MJDs
MJDs - list of MJDs used
| Plot the soft color-intensity diagram for a given set of MJDs
MJDs - list of MJDs used | [
"Plot",
"the",
"soft",
"color",
"-",
"intensity",
"diagram",
"for",
"a",
"given",
"set",
"of",
"MJDs",
"MJDs",
"-",
"list",
"of",
"MJDs",
"used"
] | def plot_HID(MJDs):
mjd_data,soft,soft_err,intensity,intensity_err = np.genfromtxt(Lv0_dirs.NGC300+'soft_color_HID.txt',skip_header=1,usecols=(0,1,2,3,4),unpack=True)
soft_trunc = [soft[i] for i in range(len(mjd_data)) if str(int(mjd_data[i])) in MJDs]
soft_err_trunc = [soft_err[i] for i in range(len(mjd_da... | [
"def",
"plot_HID",
"(",
"MJDs",
")",
":",
"mjd_data",
",",
"soft",
",",
"soft_err",
",",
"intensity",
",",
"intensity_err",
"=",
"np",
".",
"genfromtxt",
"(",
"Lv0_dirs",
".",
"NGC300",
"+",
"'soft_color_HID.txt'",
",",
"skip_header",
"=",
"1",
",",
"useco... | Plot the soft color-intensity diagram for a given set of MJDs
MJDs - list of MJDs used | [
"Plot",
"the",
"soft",
"color",
"-",
"intensity",
"diagram",
"for",
"a",
"given",
"set",
"of",
"MJDs",
"MJDs",
"-",
"list",
"of",
"MJDs",
"used"
] | [
"\"\"\"\n Plot the soft color-intensity diagram for a given set of MJDs\n\n MJDs - list of MJDs used\n \"\"\""
] | [
{
"param": "MJDs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "MJDs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8331468ac373dc7daa20fb913a8f4effae45782e | masonng-astro/nicerpy_xrayanalysis | Lv3_analyze_xspec_pars.py | [
"MIT"
] | Python | lumin_plus_par | null | def lumin_plus_par(model,MJDs,E1,E2):
"""
Plot luminosity against a spectral parameter
11/17: Need to be able to generalize such that I can use this function for >1 model!
model - name of the model used
MJDs - list of MJDs used
E1 - lower bound for energy (4-digit PI string)
E2 - upper boun... |
Plot luminosity against a spectral parameter
11/17: Need to be able to generalize such that I can use this function for >1 model!
model - name of the model used
MJDs - list of MJDs used
E1 - lower bound for energy (4-digit PI string)
E2 - upper bound for energy (4-digit PI string)
| Plot luminosity against a spectral parameter
11/17: Need to be able to generalize such that I can use this function for >1 model!
| [
"Plot",
"luminosity",
"against",
"a",
"spectral",
"parameter",
"11",
"/",
"17",
":",
"Need",
"to",
"be",
"able",
"to",
"generalize",
"such",
"that",
"I",
"can",
"use",
"this",
"function",
"for",
">",
"1",
"model!"
] | def lumin_plus_par(model,MJDs,E1,E2):
input_file = Lv0_dirs.NGC300 + 'spectral_fit_'+E1+'-'+E2+'/'+model+'_lumin.txt'
contents = open(input_file).read().split('\n')
lumin_lines = [float(contents[i].split(' ')[2]) for i in range(2,len(contents),3)]
xspec_fits = xspec_par(model,E1,E2)
fig = plt.figure... | [
"def",
"lumin_plus_par",
"(",
"model",
",",
"MJDs",
",",
"E1",
",",
"E2",
")",
":",
"input_file",
"=",
"Lv0_dirs",
".",
"NGC300",
"+",
"'spectral_fit_'",
"+",
"E1",
"+",
"'-'",
"+",
"E2",
"+",
"'/'",
"+",
"model",
"+",
"'_lumin.txt'",
"contents",
"=",
... | Plot luminosity against a spectral parameter
11/17: Need to be able to generalize such that I can use this function for >1 model! | [
"Plot",
"luminosity",
"against",
"a",
"spectral",
"parameter",
"11",
"/",
"17",
":",
"Need",
"to",
"be",
"able",
"to",
"generalize",
"such",
"that",
"I",
"can",
"use",
"this",
"function",
"for",
">",
"1",
"model!"
] | [
"\"\"\"\n Plot luminosity against a spectral parameter\n 11/17: Need to be able to generalize such that I can use this function for >1 model!\n\n model - name of the model used\n MJDs - list of MJDs used\n E1 - lower bound for energy (4-digit PI string)\n E2 - upper bound for energy (4-digit PI st... | [
{
"param": "model",
"type": null
},
{
"param": "MJDs",
"type": null
},
{
"param": "E1",
"type": null
},
{
"param": "E2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "MJDs",
"type": null,
"docstring": null,
"docstring_tokens": ... |
934a18455a716a9ff1ec4f5b2fa627240176a324 | masonng-astro/nicerpy_xrayanalysis | Lv2_phase.py | [
"MIT"
] | Python | pulse_profile | <not_specific> | def pulse_profile(f_pulse,times,counts,shift,no_phase_bins):
"""
Calculating the pulse profile for the observation. Goes from 0 to 2!
Thoughts on 1/14/2020: I wonder if the count rate is calculated from times[-1]-times[0]?
If so, this is WRONG! I should be using the total from the GTIs!
f_pulse - t... |
Calculating the pulse profile for the observation. Goes from 0 to 2!
Thoughts on 1/14/2020: I wonder if the count rate is calculated from times[-1]-times[0]?
If so, this is WRONG! I should be using the total from the GTIs!
f_pulse - the frequency of the pulse
times - the array of time values
c... | Calculating the pulse profile for the observation. Goes from 0 to 2.
Thoughts on 1/14/2020: I wonder if the count rate is calculated from times[-1]-times[0].
If so, this is WRONG. I should be using the total from the GTIs!
the frequency of the pulse
times - the array of time values
counts - the array of counts values
... | [
"Calculating",
"the",
"pulse",
"profile",
"for",
"the",
"observation",
".",
"Goes",
"from",
"0",
"to",
"2",
".",
"Thoughts",
"on",
"1",
"/",
"14",
"/",
"2020",
":",
"I",
"wonder",
"if",
"the",
"count",
"rate",
"is",
"calculated",
"from",
"times",
"[",
... | def pulse_profile(f_pulse,times,counts,shift,no_phase_bins):
period = 1/f_pulse
phases = foldAt(times,period,T0=shift*period)
index_sort = np.argsort(phases)
phases = list(phases[index_sort]) + list(phases[index_sort]+1)
counts = list(counts[index_sort])*2
phase_bins = np.linspace(0,2,no_phase_b... | [
"def",
"pulse_profile",
"(",
"f_pulse",
",",
"times",
",",
"counts",
",",
"shift",
",",
"no_phase_bins",
")",
":",
"period",
"=",
"1",
"/",
"f_pulse",
"phases",
"=",
"foldAt",
"(",
"times",
",",
"period",
",",
"T0",
"=",
"shift",
"*",
"period",
")",
... | Calculating the pulse profile for the observation. | [
"Calculating",
"the",
"pulse",
"profile",
"for",
"the",
"observation",
"."
] | [
"\"\"\"\n Calculating the pulse profile for the observation. Goes from 0 to 2!\n Thoughts on 1/14/2020: I wonder if the count rate is calculated from times[-1]-times[0]?\n If so, this is WRONG! I should be using the total from the GTIs!\n\n f_pulse - the frequency of the pulse\n times - the array of ... | [
{
"param": "f_pulse",
"type": null
},
{
"param": "times",
"type": null
},
{
"param": "counts",
"type": null
},
{
"param": "shift",
"type": null
},
{
"param": "no_phase_bins",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f_pulse",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "times",
"type": null,
"docstring": null,
"docstring_tokens... |
934a18455a716a9ff1ec4f5b2fa627240176a324 | masonng-astro/nicerpy_xrayanalysis | Lv2_phase.py | [
"MIT"
] | Python | pulse_folding | <not_specific> | def pulse_folding(t,T,T0,f,fdot,fdotdot,no_phase_bins,mission):
"""
Calculating the pulse profile by also incorporating \dot{f} corrections!
Goes from 0 to 2.
t - array of time values
T - sum of all the GTIs
T0 - reference epoch in MJD
f - pulse/folding Frequency
fdot - frequency deriva... |
Calculating the pulse profile by also incorporating \dot{f} corrections!
Goes from 0 to 2.
t - array of time values
T - sum of all the GTIs
T0 - reference epoch in MJD
f - pulse/folding Frequency
fdot - frequency derivative
fdotdot - second derivative of frequency
no_phase_bins - n... | Calculating the pulse profile by also incorporating \dot{f} corrections.
Goes from 0 to 2.
Returns the pulse profile in counts/s/phase bin vs phase. The number of counts
is divided by the exposure time (calculated through total sum of the GTIs)
Also added a "TIMEZERO" manually in the script since it'd be inconvenie... | [
"Calculating",
"the",
"pulse",
"profile",
"by",
"also",
"incorporating",
"\\",
"dot",
"{",
"f",
"}",
"corrections",
".",
"Goes",
"from",
"0",
"to",
"2",
".",
"Returns",
"the",
"pulse",
"profile",
"in",
"counts",
"/",
"s",
"/",
"phase",
"bin",
"vs",
"ph... | def pulse_folding(t,T,T0,f,fdot,fdotdot,no_phase_bins,mission):
if mission == "NICER":
MJDREFI = 56658.0
MJDREFF = 0.000777592592592593
TIMEZERO = -1
t_MJDs = MJDREFI + MJDREFF + (TIMEZERO+t)/86400
if mission == "SWIFT":
MJDREFI = 51910.0
MJDREFF = 7.42870370000... | [
"def",
"pulse_folding",
"(",
"t",
",",
"T",
",",
"T0",
",",
"f",
",",
"fdot",
",",
"fdotdot",
",",
"no_phase_bins",
",",
"mission",
")",
":",
"if",
"mission",
"==",
"\"NICER\"",
":",
"MJDREFI",
"=",
"56658.0",
"MJDREFF",
"=",
"0.000777592592592593",
"TIM... | Calculating the pulse profile by also incorporating \dot{f} corrections! | [
"Calculating",
"the",
"pulse",
"profile",
"by",
"also",
"incorporating",
"\\",
"dot",
"{",
"f",
"}",
"corrections!"
] | [
"\"\"\"\n Calculating the pulse profile by also incorporating \\dot{f} corrections!\n Goes from 0 to 2.\n\n t - array of time values\n T - sum of all the GTIs\n T0 - reference epoch in MJD\n f - pulse/folding Frequency\n fdot - frequency derivative\n fdotdot - second derivative of frequency\... | [
{
"param": "t",
"type": null
},
{
"param": "T",
"type": null
},
{
"param": "T0",
"type": null
},
{
"param": "f",
"type": null
},
{
"param": "fdot",
"type": null
},
{
"param": "fdotdot",
"type": null
},
{
"param": "no_phase_bins",
"type"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "T",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
934a18455a716a9ff1ec4f5b2fa627240176a324 | masonng-astro/nicerpy_xrayanalysis | Lv2_phase.py | [
"MIT"
] | Python | partial_E | <not_specific> | def partial_E(eventfile,par_list,tbin_size,Ebin_size,pulse_pars,shift,no_phase_bins,E1,E2,mode):
"""
Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flu... |
Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
INTERJECTION: This cav... | Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
INTERJECTION: This caveat is for the spectr... | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"energy",
"range",
".",
"[",
"Though",
"I",
"don",
"'",
"t",
"think",
"this",
"will",
"be",
"used",
"much",
".",
"Count",
"/",
"s",
"vs",
"energy",
"is",
"pointless",
"since",
"we",
"'",
"re",... | def partial_E(eventfile,par_list,tbin_size,Ebin_size,pulse_pars,shift,no_phase_bins,E1,E2,mode):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if type(pulse_pars) != list and type(pulse_pars) != np.ndarray:
raise TypeError("pulse_pars should either be a list or an a... | [
"def",
"partial_E",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"Ebin_size",
",",
"pulse_pars",
",",
"shift",
",",
"no_phase_bins",
",",
"E1",
",",
"E2",
",",
"mode",
")",
":",
"if",
"type",
"(",
"eventfile",
")",
"!=",
"str",
":",
"raise... | Plot the pulse profile for a desired energy range. | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the pulse profile for a desired energy range.\n [Though I don't think this will be used much. Count/s vs energy is pointless,\n since we're not folding in response matrix information here to get the flux.\n So we're just doing a count/s vs time with an energy cut to the data.]\n INTERJ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "Ebin_size",
"type": null
},
{
"param": "pulse_pars",
"type": null
},
{
"param": "shift",
"type": null
},
{
"p... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
934a18455a716a9ff1ec4f5b2fa627240176a324 | masonng-astro/nicerpy_xrayanalysis | Lv2_phase.py | [
"MIT"
] | Python | partial_tE | <not_specific> | def partial_tE(eventfile,par_list,tbin_size,Ebin_size,pulse_pars,shift,no_phase_bins,t1,t2,E1,E2,mode):
"""
Plot the pulse profile for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters ... |
Plot the pulse profile for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
tbin_size - the size o... | Plot the pulse profile for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
pulse_pars will have [f,fdot,fdotdot] | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",... | def partial_tE(eventfile,par_list,tbin_size,Ebin_size,pulse_pars,shift,no_phase_bins,t1,t2,E1,E2,mode):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if type(pulse_pars) != list and type(pulse_pars) != np.ndarray:
raise TypeError("pulse_pars should either be a list ... | [
"def",
"partial_tE",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"Ebin_size",
",",
"pulse_pars",
",",
"shift",
",",
"no_phase_bins",
",",
"t1",
",",
"t2",
",",
"E1",
",",
"E2",
",",
"mode",
")",
":",
"if",
"type",
"(",
"eventfile",
")",
... | Plot the pulse profile for a desired time interval and desired energy range. | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the pulse profile for a desired time interval and desired energy range.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)\n tbin_... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "Ebin_size",
"type": null
},
{
"param": "pulse_pars",
"type": null
},
{
"param": "shift",
"type": null
},
{
"p... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
934a18455a716a9ff1ec4f5b2fa627240176a324 | masonng-astro/nicerpy_xrayanalysis | Lv2_phase.py | [
"MIT"
] | Python | partial_subplots_E | <not_specific> | def partial_subplots_E(eventfile,par_list,tbin_size,Ebin_size,f_pulse,shift,no_phase_bins,subplot_Es,E1,E2,mode):
"""
Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information he... |
Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
INTERJECTION: This cav... | Plot the pulse profile for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
INTERJECTION: This caveat is for the spectr... | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"energy",
"range",
".",
"[",
"Though",
"I",
"don",
"'",
"t",
"think",
"this",
"will",
"be",
"used",
"much",
".",
"Count",
"/",
"s",
"vs",
"energy",
"is",
"pointless",
"since",
"we",
"'",
"re",... | def partial_subplots_E(eventfile,par_list,tbin_size,Ebin_size,f_pulse,shift,no_phase_bins,subplot_Es,E1,E2,mode):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if 'TIME' not in par_list:
raise ValueError("You should have 'TIME' in the parameter list!")
if type(p... | [
"def",
"partial_subplots_E",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"Ebin_size",
",",
"f_pulse",
",",
"shift",
",",
"no_phase_bins",
",",
"subplot_Es",
",",
"E1",
",",
"E2",
",",
"mode",
")",
":",
"if",
"type",
"(",
"eventfile",
")",
"... | Plot the pulse profile for a desired energy range. | [
"Plot",
"the",
"pulse",
"profile",
"for",
"a",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the pulse profile for a desired energy range.\n [Though I don't think this will be used much. Count/s vs energy is pointless,\n since we're not folding in response matrix information here to get the flux.\n So we're just doing a count/s vs time with an energy cut to the data.]\n INTERJ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "Ebin_size",
"type": null
},
{
"param": "f_pulse",
"type": null
},
{
"param": "shift",
"type": null
},
{
"para... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
e552c6930c6ecf8f6db68a6df6c737584c6a05a8 | masonng-astro/nicerpy_xrayanalysis | 2018/detector_count_movie.py | [
"MIT"
] | Python | counts_per_s | <not_specific> | def counts_per_s(work_dir,obsid,doplot):
"""
Output is a dictionary, which has as keys, the DET_ID, and correspondingly
an array where each entry = counts per second at any given second.
counts_dict = {'detector':[t=1,t=2,t=3,...], 'detector':[t=1,t=2,...]}
"""
counts_dict = {}
... |
Output is a dictionary, which has as keys, the DET_ID, and correspondingly
an array where each entry = counts per second at any given second.
counts_dict = {'detector':[t=1,t=2,t=3,...], 'detector':[t=1,t=2,...]}
| Output is a dictionary, which has as keys, the DET_ID, and correspondingly
an array where each entry = counts per second at any given second.
| [
"Output",
"is",
"a",
"dictionary",
"which",
"has",
"as",
"keys",
"the",
"DET_ID",
"and",
"correspondingly",
"an",
"array",
"where",
"each",
"entry",
"=",
"counts",
"per",
"second",
"at",
"any",
"given",
"second",
"."
] | def counts_per_s(work_dir,obsid,doplot):
counts_dict = {}
times,pi,counts,detid_data = get_data(work_dir,obsid)
shifted_t = times-times[0]
t_bins = np.linspace(0,int(shifted_t[-1]),int(shifted_t[-1])+1)
detids = detid()
for i in range(len(detids)):
times,pi,counts,detid_data = get_data(... | [
"def",
"counts_per_s",
"(",
"work_dir",
",",
"obsid",
",",
"doplot",
")",
":",
"counts_dict",
"=",
"{",
"}",
"times",
",",
"pi",
",",
"counts",
",",
"detid_data",
"=",
"get_data",
"(",
"work_dir",
",",
"obsid",
")",
"shifted_t",
"=",
"times",
"-",
"tim... | Output is a dictionary, which has as keys, the DET_ID, and correspondingly
an array where each entry = counts per second at any given second. | [
"Output",
"is",
"a",
"dictionary",
"which",
"has",
"as",
"keys",
"the",
"DET_ID",
"and",
"correspondingly",
"an",
"array",
"where",
"each",
"entry",
"=",
"counts",
"per",
"second",
"at",
"any",
"given",
"second",
"."
] | [
"\"\"\"\n Output is a dictionary, which has as keys, the DET_ID, and correspondingly\n an array where each entry = counts per second at any given second.\n \n counts_dict = {'detector':[t=1,t=2,t=3,...], 'detector':[t=1,t=2,...]}\n \"\"\"",
"#for each FPM",
"#replace not-detector by 0"
] | [
{
"param": "work_dir",
"type": null
},
{
"param": "obsid",
"type": null
},
{
"param": "doplot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "work_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_token... |
e552c6930c6ecf8f6db68a6df6c737584c6a05a8 | masonng-astro/nicerpy_xrayanalysis | 2018/detector_count_movie.py | [
"MIT"
] | Python | det_coords | <not_specific> | def det_coords(detector_id):
"""
In direct, 1-1 correspondence as to how the NASA NICER team defined its detector array!
"""
coord_dict = {'06':(0,0),'07':(0,1),'16':(0,2),'17':(0,3),'27':(0,4),'37':(0,5),'47':(0,6),'57':(0,7),
'05':(1,0),'15':(1,1),'25':(1,2),'26':(1,3),'35':(1,4),'36... |
In direct, 1-1 correspondence as to how the NASA NICER team defined its detector array!
| In direct, 1-1 correspondence as to how the NASA NICER team defined its detector array! | [
"In",
"direct",
"1",
"-",
"1",
"correspondence",
"as",
"to",
"how",
"the",
"NASA",
"NICER",
"team",
"defined",
"its",
"detector",
"array!"
] | def det_coords(detector_id):
coord_dict = {'06':(0,0),'07':(0,1),'16':(0,2),'17':(0,3),'27':(0,4),'37':(0,5),'47':(0,6),'57':(0,7),
'05':(1,0),'15':(1,1),'25':(1,2),'26':(1,3),'35':(1,4),'36':(1,5),'46':(1,6),'56':(1,7),
'04':(2,0),'14':(2,1),'24':(2,2),'34':(2,3),'44':(2,4),'45'... | [
"def",
"det_coords",
"(",
"detector_id",
")",
":",
"coord_dict",
"=",
"{",
"'06'",
":",
"(",
"0",
",",
"0",
")",
",",
"'07'",
":",
"(",
"0",
",",
"1",
")",
",",
"'16'",
":",
"(",
"0",
",",
"2",
")",
",",
"'17'",
":",
"(",
"0",
",",
"3",
"... | In direct, 1-1 correspondence as to how the NASA NICER team defined its detector array! | [
"In",
"direct",
"1",
"-",
"1",
"correspondence",
"as",
"to",
"how",
"the",
"NASA",
"NICER",
"team",
"defined",
"its",
"detector",
"array!"
] | [
"\"\"\"\n In direct, 1-1 correspondence as to how the NASA NICER team defined its detector array!\n \"\"\""
] | [
{
"param": "detector_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "detector_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
669269f03029bc8b4957bb9a1735a965db1b0e18 | masonng-astro/nicerpy_xrayanalysis | Lv2_color.py | [
"MIT"
] | Python | soft_counts | <not_specific> | def soft_counts(E_bound,pi_data):
"""
Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E >= E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get ju... |
Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E >= E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get just soft counts.
E_bound - boundary e... | Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E >= E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get just soft counts.
boundary energy considered (in keV)
pi_da... | [
"Will",
"get",
"an",
"array",
"of",
"PI",
"values",
"from",
"the",
"data",
"where",
"each",
"entry",
"=",
"1",
"count",
".",
"So",
"construct",
"an",
"array",
"of",
"ones",
"of",
"equal",
"length",
"then",
"where",
"E",
">",
"=",
"E_bound",
"set",
"t... | def soft_counts(E_bound,pi_data):
if E_bound < 0 or E_bound > 20:
raise ValueError("Your E_bound is <0 keV or >20keV - check your input!")
counts = np.ones(len(pi_data))
PI_bound = E_bound*1000/10
np.place(counts,pi_data>=PI_bound,0)
return counts | [
"def",
"soft_counts",
"(",
"E_bound",
",",
"pi_data",
")",
":",
"if",
"E_bound",
"<",
"0",
"or",
"E_bound",
">",
"20",
":",
"raise",
"ValueError",
"(",
"\"Your E_bound is <0 keV or >20keV - check your input!\"",
")",
"counts",
"=",
"np",
".",
"ones",
"(",
"len... | Will get an array of PI values from the data, where each entry = 1 count. | [
"Will",
"get",
"an",
"array",
"of",
"PI",
"values",
"from",
"the",
"data",
"where",
"each",
"entry",
"=",
"1",
"count",
"."
] | [
"\"\"\"\n Will get an array of PI values from the data, where each entry = 1 count.\n So construct an array of ones of equal length, then where E >= E_bound, set to 0.\n This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when\n doing the binning, will get just soft counts.\n\n E_b... | [
{
"param": "E_bound",
"type": null
},
{
"param": "pi_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "E_bound",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pi_data",
"type": null,
"docstring": null,
"docstring_toke... |
669269f03029bc8b4957bb9a1735a965db1b0e18 | masonng-astro/nicerpy_xrayanalysis | Lv2_color.py | [
"MIT"
] | Python | hard_counts | <not_specific> | def hard_counts(E_bound,pi_data):
"""
Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E < E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get jus... |
Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E < E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get just soft counts.
E_bound - boundary en... | Will get an array of PI values from the data, where each entry = 1 count.
So construct an array of ones of equal length, then where E < E_bound, set to 0.
This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when
doing the binning, will get just soft counts.
boundary energy considered (in keV)
pi_dat... | [
"Will",
"get",
"an",
"array",
"of",
"PI",
"values",
"from",
"the",
"data",
"where",
"each",
"entry",
"=",
"1",
"count",
".",
"So",
"construct",
"an",
"array",
"of",
"ones",
"of",
"equal",
"length",
"then",
"where",
"E",
"<",
"E_bound",
"set",
"to",
"... | def hard_counts(E_bound,pi_data):
if E_bound < 0 or E_bound > 20:
raise ValueError("Your E_bound is <0 keV or >20keV - check your input!")
counts = np.ones(len(pi_data))
PI_bound = E_bound*1000/10
np.place(counts,pi_data<PI_bound,0)
return counts | [
"def",
"hard_counts",
"(",
"E_bound",
",",
"pi_data",
")",
":",
"if",
"E_bound",
"<",
"0",
"or",
"E_bound",
">",
"20",
":",
"raise",
"ValueError",
"(",
"\"Your E_bound is <0 keV or >20keV - check your input!\"",
")",
"counts",
"=",
"np",
".",
"ones",
"(",
"len... | Will get an array of PI values from the data, where each entry = 1 count. | [
"Will",
"get",
"an",
"array",
"of",
"PI",
"values",
"from",
"the",
"data",
"where",
"each",
"entry",
"=",
"1",
"count",
"."
] | [
"\"\"\"\n Will get an array of PI values from the data, where each entry = 1 count.\n So construct an array of ones of equal length, then where E < E_bound, set to 0.\n This will give an array where 0 = harder X-rays, 1 = softer X-rays, so when\n doing the binning, will get just soft counts.\n\n E_bo... | [
{
"param": "E_bound",
"type": null
},
{
"param": "pi_data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "E_bound",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pi_data",
"type": null,
"docstring": null,
"docstring_toke... |
79bc4f77a20f74b625211d8a424be0d65370faf0 | masonng-astro/nicerpy_xrayanalysis | Lv3_incoming.py | [
"MIT"
] | Python | nicerql | <not_specific> | def nicerql(eventfile,extra_nicerql_args):
"""
Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data.
Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder
eventfile... |
Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data.
Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder
eventfile - path to the event file. Will extract ObsID from... | Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data.
Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder
path to the event file. Will extract ObsID from this for the NICER files.
ex... | [
"Probably",
"the",
"second",
"step",
"in",
"the",
"process",
"but",
"this",
"is",
"to",
"generate",
"the",
"psrpipe",
"diagnostic",
"plots",
"to",
"see",
"if",
"there",
"are",
"any",
"obvious",
"red",
"flags",
"in",
"the",
"data",
".",
"Will",
"just",
"r... | def nicerql(eventfile,extra_nicerql_args):
parent_folder = str(pathlib.Path(eventfile).parent)
orbfiles = glob.glob(parent_folder+'/*.orb')
mkffiles = glob.glob(parent_folder+'/*.mkf*')
if len(orbfiles) != 1 and len(mkffiles) != 1:
raise ValueError("Either there's no orb/mkf file (in which case,... | [
"def",
"nicerql",
"(",
"eventfile",
",",
"extra_nicerql_args",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"orbfiles",
"=",
"glob",
".",
"glob",
"(",
"parent_folder",
"+",
"'/*.orb'",
")",
... | Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data. | [
"Probably",
"the",
"second",
"step",
"in",
"the",
"process",
"but",
"this",
"is",
"to",
"generate",
"the",
"psrpipe",
"diagnostic",
"plots",
"to",
"see",
"if",
"there",
"are",
"any",
"obvious",
"red",
"flags",
"in",
"the",
"data",
"."
] | [
"\"\"\"\n Probably the second step in the process, but this is to generate the psrpipe\n diagnostic plots, to see if there are any obvious red flags in the data.\n\n Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder\n\n eventfile - path to the event file. Will e... | [
{
"param": "eventfile",
"type": null
},
{
"param": "extra_nicerql_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extra_nicerql_args",
"type": null,
"docstring": null,
"d... |
79bc4f77a20f74b625211d8a424be0d65370faf0 | masonng-astro/nicerpy_xrayanalysis | Lv3_incoming.py | [
"MIT"
] | Python | filtering | null | def filtering(eventfile,outfile,maskdet,eventflags,rm_artifacts):
"""
Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time...
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - outpu... |
Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time...
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - output file from the filtering
maskdet - list of DET_IDs to mask
event... | Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time
path to the event file. Will extract ObsID from this for the NICER files.
outfile - output file from the filtering
maskdet - list of DET_IDs to mask
eventflags - NICER event flags to filter out ... | [
"Function",
"that",
"will",
"filter",
"out",
"bad",
"detectors",
"and",
"impose",
"eventflag",
"restrictions",
".",
"Will",
"expect",
"to",
"add",
"to",
"this",
"function",
"over",
"time",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID"... | def filtering(eventfile,outfile,maskdet,eventflags,rm_artifacts):
outfile_parent_folder = str(pathlib.Path(outfile).parent)
evfilt_expr = eventflags
for i in range(len(maskdet)):
evfilt_expr += '.and.(DET_ID!='+str(maskdet[i]) + ')'
if len(rm_artifacts) != 0:
intfile = outfile_parent_fol... | [
"def",
"filtering",
"(",
"eventfile",
",",
"outfile",
",",
"maskdet",
",",
"eventflags",
",",
"rm_artifacts",
")",
":",
"outfile_parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"outfile",
")",
".",
"parent",
")",
"evfilt_expr",
"=",
"eventflags... | Function that will filter out bad detectors and impose eventflag restrictions. | [
"Function",
"that",
"will",
"filter",
"out",
"bad",
"detectors",
"and",
"impose",
"eventflag",
"restrictions",
"."
] | [
"\"\"\"\n Function that will filter out bad detectors and impose eventflag restrictions.\n Will expect to add to this function over time...\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n outfile - output file from the filtering\n maskdet - list of DET_IDs ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "maskdet",
"type": null
},
{
"param": "eventflags",
"type": null
},
{
"param": "rm_artifacts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_to... |
676bb4bc0e94a3da9bd49b0d7918d8b46cb18667 | masonng-astro/nicerpy_xrayanalysis | Lv0_dirs.py | [
"MIT"
] | Python | global_par | null | def global_par():
"""
Defining global variables for the directories
"""
global BASE_DIR, NICER_DATADIR, NICERSOFT_DATADIR, NGC300, NGC300_2020, NGC300_XMM
BASE_DIR = '/Users/masonng/Documents/MIT/Research/'
NICER_DATADIR = '/Volumes/Samsung_T5/NICER-data/'
NICERSOFT_DATADIR = '/Volumes/Samsu... |
Defining global variables for the directories
| Defining global variables for the directories | [
"Defining",
"global",
"variables",
"for",
"the",
"directories"
] | def global_par():
global BASE_DIR, NICER_DATADIR, NICERSOFT_DATADIR, NGC300, NGC300_2020, NGC300_XMM
BASE_DIR = '/Users/masonng/Documents/MIT/Research/'
NICER_DATADIR = '/Volumes/Samsung_T5/NICER-data/'
NICERSOFT_DATADIR = '/Volumes/Samsung_T5/NICERsoft_outputs/'
NGC300 = '/Volumes/Samsung_T5/NGC300... | [
"def",
"global_par",
"(",
")",
":",
"global",
"BASE_DIR",
",",
"NICER_DATADIR",
",",
"NICERSOFT_DATADIR",
",",
"NGC300",
",",
"NGC300_2020",
",",
"NGC300_XMM",
"BASE_DIR",
"=",
"'/Users/masonng/Documents/MIT/Research/'",
"NICER_DATADIR",
"=",
"'/Volumes/Samsung_T5/NICER-d... | Defining global variables for the directories | [
"Defining",
"global",
"variables",
"for",
"the",
"directories"
] | [
"\"\"\"\n Defining global variables for the directories\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a581513a3344238d60262c83729e3f11a31fba54 | masonng-astro/nicerpy_xrayanalysis | Lv2_mkdir.py | [
"MIT"
] | Python | makedir | <not_specific> | def makedir(dir):
"""
Creating a folder if it does not exist in the directory.
dir - desired directory (provide FULL path!)
"""
if os.path.exists(dir):
print('The path already exists!')
return
else:
print('This directory did not exist - creating ' + dir + ' now!')
... |
Creating a folder if it does not exist in the directory.
dir - desired directory (provide FULL path!)
| Creating a folder if it does not exist in the directory.
dir - desired directory (provide FULL path!) | [
"Creating",
"a",
"folder",
"if",
"it",
"does",
"not",
"exist",
"in",
"the",
"directory",
".",
"dir",
"-",
"desired",
"directory",
"(",
"provide",
"FULL",
"path!",
")"
] | def makedir(dir):
if os.path.exists(dir):
print('The path already exists!')
return
else:
print('This directory did not exist - creating ' + dir + ' now!')
os.makedirs(dir) | [
"def",
"makedir",
"(",
"dir",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"dir",
")",
":",
"print",
"(",
"'The path already exists!'",
")",
"return",
"else",
":",
"print",
"(",
"'This directory did not exist - creating '",
"+",
"dir",
"+",
"' now!... | Creating a folder if it does not exist in the directory. | [
"Creating",
"a",
"folder",
"if",
"it",
"does",
"not",
"exist",
"in",
"the",
"directory",
"."
] | [
"\"\"\"\n Creating a folder if it does not exist in the directory.\n\n dir - desired directory (provide FULL path!)\n \"\"\""
] | [
{
"param": "dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | do_demodulate | <not_specific> | def do_demodulate(eventfile,segment_length,mode,par_file):
"""
Do orbital demodulation on the original events.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
par_file - orbital parameter file for input into binary_psr
... |
Do orbital demodulation on the original events.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
par_file - orbital parameter file for input into binary_psr
mode - "all", "t" or "E" ; basically to tell the function where ... | Do orbital demodulation on the original events.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Do",
"orbital",
"demodulation",
"on",
"the",
"original",
"events",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def do_demodulate(eventfile,segment_length,mode,par_file):
TIMEZERO = -1
if mode == "all":
parent_folder = str(pathlib.Path(eventfile).parent) + '/'
elif mode == "t":
parent_folder = str(pathlib.Path(eventfile).parent) + '/accelsearch_' + str(segment_length) + 's/'
elif mode == "E":
... | [
"def",
"do_demodulate",
"(",
"eventfile",
",",
"segment_length",
",",
"mode",
",",
"par_file",
")",
":",
"TIMEZERO",
"=",
"-",
"1",
"if",
"mode",
"==",
"\"all\"",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
... | Do orbital demodulation on the original events. | [
"Do",
"orbital",
"demodulation",
"on",
"the",
"original",
"events",
"."
] | [
"\"\"\"\n Do orbital demodulation on the original events.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the segments\n par_file - orbital parameter file for input into binary_psr\n mode - \"all\", \"t\" or \"E\" ; basically to t... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "mode",
"type": null
},
{
"param": "par_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | do_nicerfits2presto | null | def do_nicerfits2presto(eventfile,tbin,segment_length):
"""
Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins in time
segment_length - length of the ind... |
Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins in time
segment_length - length of the individual segments for combining power spectra
| Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins in time
segment_length - length of the individual segments for combining power spectra | [
"Using",
"nicerfits2presto",
".",
"py",
"to",
"bin",
"the",
"data",
"and",
"to",
"convert",
"into",
"PRESTO",
"-",
"readable",
"format",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
... | def do_nicerfits2presto(eventfile,tbin,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
eventfiles = sorted(glob.glob(parent_folder + '/accelsearch_' + str(segment_lengt... | [
"def",
"do_nicerfits2presto",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
"eventfile",
"... | Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format. | [
"Using",
"nicerfits2presto",
".",
"py",
"to",
"bin",
"the",
"data",
"and",
"to",
"convert",
"into",
"PRESTO",
"-",
"readable",
"format",
"."
] | [
"\"\"\"\n Using nicerfits2presto.py to bin the data, and to convert into PRESTO-readable format.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n tbin - size of the bins in time\n segment_length - length of the individual segments for combining power spectra\n ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | edit_inf | <not_specific> | def edit_inf(eventfile,tbin,segment_length):
"""
Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though!
eventfile - path to the event file. Will... |
Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
tb... | Editing the .inf file, as it seems like accelsearch uses some information from the .inf file.
Mainly need to edit the "Number of bins in the time series".
This is only for when we make segments by time though!
path to the event file. Will extract ObsID from this for the NICER files.
tbin - size of the bins in time
seg... | [
"Editing",
"the",
".",
"inf",
"file",
"as",
"it",
"seems",
"like",
"accelsearch",
"uses",
"some",
"information",
"from",
"the",
".",
"inf",
"file",
".",
"Mainly",
"need",
"to",
"edit",
"the",
"\"",
"Number",
"of",
"bins",
"in",
"the",
"time",
"series",
... | def edit_inf(eventfile,tbin,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
inf_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(segment_length) + 's/*.in... | [
"def",
"edit_inf",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
... | Editing the .inf file, as it seems like accelsearch uses some information from the .inf file! | [
"Editing",
"the",
".",
"inf",
"file",
"as",
"it",
"seems",
"like",
"accelsearch",
"uses",
"some",
"information",
"from",
"the",
".",
"inf",
"file!"
] | [
"\"\"\"\n Editing the .inf file, as it seems like accelsearch uses some information from the .inf file!\n Mainly need to edit the \"Number of bins in the time series\".\n This is only for when we make segments by time though!\n\n eventfile - path to the event file. Will extract ObsID from this for the N... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | edit_binary | <not_specific> | def edit_binary(eventfile,tbin,segment_length):
"""
To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment!
Jul 10: Do zero-padding instead... so that number of counts is consistent!
Again, t... |
To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment!
Jul 10: Do zero-padding instead... so that number of counts is consistent!
Again, this is only for when we make segments by time!
eve... | To pad the binary file so that it will be as long as the desired segment length.
The value to pad with for each time bin, is the average count rate in THAT segment.
Jul 10: Do zero-padding instead... so that number of counts is consistent.
Again, this is only for when we make segments by time!
path to the event file. ... | [
"To",
"pad",
"the",
"binary",
"file",
"so",
"that",
"it",
"will",
"be",
"as",
"long",
"as",
"the",
"desired",
"segment",
"length",
".",
"The",
"value",
"to",
"pad",
"with",
"for",
"each",
"time",
"bin",
"is",
"the",
"average",
"count",
"rate",
"in",
... | def edit_binary(eventfile,tbin,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
event_header = fits.open(eventfile)[1].header
obj_name = event_header['OBJECT']
obsid = event_header['OBS_ID']
dat_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(segment_length) + 's/*... | [
"def",
"edit_binary",
"(",
"eventfile",
",",
"tbin",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"event_header",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[... | To pad the binary file so that it will be as long as the desired segment length. | [
"To",
"pad",
"the",
"binary",
"file",
"so",
"that",
"it",
"will",
"be",
"as",
"long",
"as",
"the",
"desired",
"segment",
"length",
"."
] | [
"\"\"\"\n To pad the binary file so that it will be as long as the desired segment length.\n The value to pad with for each time bin, is the average count rate in THAT segment!\n Jul 10: Do zero-padding instead... so that number of counts is consistent!\n Again, this is only for when we make segments by... | [
{
"param": "eventfile",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_token... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | realfft | <not_specific> | def realfft(eventfile,segment_length):
"""
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
"""
parent_folder = str(pathlib.Path(eventfile).parent)
d... |
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
| Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments | [
"Performing",
"PRESTO",
"'",
"s",
"realfft",
"on",
"the",
"binned",
"data",
"(",
".",
"dat",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
"segment_lengt... | def realfft(eventfile,segment_length):
parent_folder = str(pathlib.Path(eventfile).parent)
dat_files = sorted(glob.glob(parent_folder+'/accelsearch_' + str(segment_length) + 's/*.dat'))
logfile = parent_folder + '/accelsearch_' + str(segment_length) + 's/realfft.log'
print('Doing realfft now!')
wit... | [
"def",
"realfft",
"(",
"eventfile",
",",
"segment_length",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"parent",
")",
"dat_files",
"=",
"sorted",
"(",
"glob",
".",
"glob",
"(",
"parent_folder",
"+",
"'/... | Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. | [
"Performing",
"PRESTO",
"'",
"s",
"realfft",
"on",
"the",
"binned",
"data",
"(",
".",
"dat",
")",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Performing PRESTO's realfft on the binned data (.dat)\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the individual segments\n \"\"\"",
"#not that order matters here I think, but just in case",
"# recall that un-trunca... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | presto_dat | <not_specific> | def presto_dat(eventfile,segment_length,demod,PI1,PI2,t1,t2):
"""
Obtain the dat files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or... |
Obtain the dat files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not!
PI1 - lower bound of PI (not energy in keV!) desired for th... | Obtain the dat files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not.
PI1 - lower bound of PI (not energy in keV!) desired for the energy range
PI2 - u... | [
"Obtain",
"the",
"dat",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
"segment_length",
"-",
"length",
"... | def presto_dat(eventfile,segment_length,demod,PI1,PI2,t1,t2):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
parent_folder = str(pathlib.Path(eventfile).parent)
if PI1 != '':
dat_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(s... | [
"def",
"presto_dat",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
")",
":",
"if",
"demod",
"!=",
"True",
"and",
"demod",
"!=",
"False",
":",
"raise",
"ValueError",
"(",
"\"demod should either be True ... | Obtain the dat files that were generated from PRESTO
eventfile - path to the event file. | [
"Obtain",
"the",
"dat",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Obtain the dat files that were generated from PRESTO\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the segments\n demod - whether we're dealing with demodulated data or not!\n PI1 - lower bound of PI (not energy in keV... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param": "PI2",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | presto_fft | <not_specific> | def presto_fft(eventfile,segment_length,demod,PI1,PI2,t1,t2):
"""
Obtain the FFT files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or... |
Obtain the FFT files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not!
PI1 - lower bound of PI (not energy in keV!) desired for th... | Obtain the FFT files that were generated from PRESTO
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not.
PI1 - lower bound of PI (not energy in keV!) desired for the energy range
PI2 - u... | [
"Obtain",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
"segment_length",
"-",
"length",
"... | def presto_fft(eventfile,segment_length,demod,PI1,PI2,t1,t2):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
parent_folder = str(pathlib.Path(eventfile).parent)
if PI1 != '':
fft_files = sorted(glob.glob(parent_folder + '/accelsearch_' + str(s... | [
"def",
"presto_fft",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
")",
":",
"if",
"demod",
"!=",
"True",
"and",
"demod",
"!=",
"False",
":",
"raise",
"ValueError",
"(",
"\"demod should either be True ... | Obtain the FFT files that were generated from PRESTO
eventfile - path to the event file. | [
"Obtain",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Obtain the FFT files that were generated from PRESTO\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the segments\n demod - whether we're dealing with demodulated data or not!\n PI1 - lower bound of PI (not energy in keV... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param": "PI2",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | segment_threshold | <not_specific> | def segment_threshold(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2):
"""
Using the .dat files, rebin them into 1s bins, to weed out the segments below
some desired threshold. Will return a *list* of *indices*! This is so that I
can filter out the *sorted* array of .dat and .fft files... |
Using the .dat files, rebin them into 1s bins, to weed out the segments below
some desired threshold. Will return a *list* of *indices*! This is so that I
can filter out the *sorted* array of .dat and .fft files that are below threshold!
eventfile - path to the event file. Will extract ObsID from this... | Using the .dat files, rebin them into 1s bins, to weed out the segments below
some desired threshold. Will return a *list* of *indices*. This is so that I
can filter out the *sorted* array of .dat and .fft files that are below threshold!
path to the event file. Will extract ObsID from this for the NICER files.
segment... | [
"Using",
"the",
".",
"dat",
"files",
"rebin",
"them",
"into",
"1s",
"bins",
"to",
"weed",
"out",
"the",
"segments",
"below",
"some",
"desired",
"threshold",
".",
"Will",
"return",
"a",
"*",
"list",
"*",
"of",
"*",
"indices",
"*",
".",
"This",
"is",
"... | def segment_threshold(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
dat_files = presto_dat(eventfile,segment_length,demod,PI1,PI2,t1,t2)
rebin_t = np.arange(segment_length+1)*1
pa... | [
"def",
"segment_threshold",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"tbin_size",
",",
"threshold",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
")",
":",
"if",
"demod",
"!=",
"True",
"and",
"demod",
"!=",
"False",
":",
"raise",
"Va... | Using the .dat files, rebin them into 1s bins, to weed out the segments below
some desired threshold. | [
"Using",
"the",
".",
"dat",
"files",
"rebin",
"them",
"into",
"1s",
"bins",
"to",
"weed",
"out",
"the",
"segments",
"below",
"some",
"desired",
"threshold",
"."
] | [
"\"\"\"\n Using the .dat files, rebin them into 1s bins, to weed out the segments below\n some desired threshold. Will return a *list* of *indices*! This is so that I\n can filter out the *sorted* array of .dat and .fft files that are below threshold!\n\n eventfile - path to the event file. Will extract... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"pa... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | average_ps | <not_specific> | def average_ps(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2,starting_freq,W):
"""
Given the full list of .dat and .fft files, and the indices where the PRESTO-binned
data is beyond some threshold, return the averaged power spectrum!
eventfile - path to the event file. Will extract O... |
Given the full list of .dat and .fft files, and the indices where the PRESTO-binned
data is beyond some threshold, return the averaged power spectrum!
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're... | Given the full list of .dat and .fft files, and the indices where the PRESTO-binned
data is beyond some threshold, return the averaged power spectrum!
path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or... | [
"Given",
"the",
"full",
"list",
"of",
".",
"dat",
"and",
".",
"fft",
"files",
"and",
"the",
"indices",
"where",
"the",
"PRESTO",
"-",
"binned",
"data",
"is",
"beyond",
"some",
"threshold",
"return",
"the",
"averaged",
"power",
"spectrum!",
"path",
"to",
... | def average_ps(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2,starting_freq,W):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
dat_files = presto_dat(eventfile,segment_length,demod,PI1,PI2,t1,t2)
fft_files = presto_fft(eventfile,segm... | [
"def",
"average_ps",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"tbin_size",
",",
"threshold",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
",",
"starting_freq",
",",
"W",
")",
":",
"if",
"demod",
"!=",
"True",
"and",
"demod",
"!=",
... | Given the full list of .dat and .fft files, and the indices where the PRESTO-binned
data is beyond some threshold, return the averaged power spectrum! | [
"Given",
"the",
"full",
"list",
"of",
".",
"dat",
"and",
".",
"fft",
"files",
"and",
"the",
"indices",
"where",
"the",
"PRESTO",
"-",
"binned",
"data",
"is",
"beyond",
"some",
"threshold",
"return",
"the",
"averaged",
"power",
"spectrum!"
] | [
"\"\"\"\n Given the full list of .dat and .fft files, and the indices where the PRESTO-binned\n data is beyond some threshold, return the averaged power spectrum!\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the segments\n demo... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"pa... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | noise_hist | <not_specific> | def noise_hist(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2,starting_freq,W):
"""
Given the average spectrum for an ObsID, return the histogram of powers, such
that you have N(>P). This is for powers corresponding to frequencies larger
than some starting frequency (perhaps to avoid r... |
Given the average spectrum for an ObsID, return the histogram of powers, such
that you have N(>P). This is for powers corresponding to frequencies larger
than some starting frequency (perhaps to avoid red noise).
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
... | Given the average spectrum for an ObsID, return the histogram of powers, such
that you have N(>P). This is for powers corresponding to frequencies larger
than some starting frequency (perhaps to avoid red noise).
path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the s... | [
"Given",
"the",
"average",
"spectrum",
"for",
"an",
"ObsID",
"return",
"the",
"histogram",
"of",
"powers",
"such",
"that",
"you",
"have",
"N",
"(",
">",
"P",
")",
".",
"This",
"is",
"for",
"powers",
"corresponding",
"to",
"frequencies",
"larger",
"than",
... | def noise_hist(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2,starting_freq,W):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
f,ps = average_ps(eventfile,segment_length,demod,tbin_size,threshold,PI1,PI2,t1,t2,starting_freq,W)
ps_to_u... | [
"def",
"noise_hist",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"tbin_size",
",",
"threshold",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
",",
"starting_freq",
",",
"W",
")",
":",
"if",
"demod",
"!=",
"True",
"and",
"demod",
"!=",
... | Given the average spectrum for an ObsID, return the histogram of powers, such
that you have N(>P). | [
"Given",
"the",
"average",
"spectrum",
"for",
"an",
"ObsID",
"return",
"the",
"histogram",
"of",
"powers",
"such",
"that",
"you",
"have",
"N",
"(",
">",
"P",
")",
"."
] | [
"\"\"\"\n Given the average spectrum for an ObsID, return the histogram of powers, such\n that you have N(>P). This is for powers corresponding to frequencies larger\n than some starting frequency (perhaps to avoid red noise).\n\n eventfile - path to the event file. Will extract ObsID from this for the ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"pa... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
c05df1451b9bf37aac62ecd0cf6183148b1dfadf | masonng-astro/nicerpy_xrayanalysis | Lv2_average_ps_methods.py | [
"MIT"
] | Python | plotting | null | def plotting(eventfile,segment_length,demod,tbin,threshold,PI1,PI2,t1,t2,starting_freq,W,hist_min_sig,N,xlims,plot_mode):
"""
Plotting the averaged power spectrum and the noise histogram
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the... |
Plotting the averaged power spectrum and the noise histogram
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not!
tbin_size - size of the time bin
threshold - if... | Plotting the averaged power spectrum and the noise histogram
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the segments
demod - whether we're dealing with demodulated data or not.
tbin_size - size of the time bin
threshold - if data is under threshold (... | [
"Plotting",
"the",
"averaged",
"power",
"spectrum",
"and",
"the",
"noise",
"histogram",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
"segment_length",
"-",
"leng... | def plotting(eventfile,segment_length,demod,tbin,threshold,PI1,PI2,t1,t2,starting_freq,W,hist_min_sig,N,xlims,plot_mode):
if demod != True and demod != False:
raise ValueError("demod should either be True or False!")
if plot_mode != "show" and plot_mode != "save":
raise ValueError("plot_mode sho... | [
"def",
"plotting",
"(",
"eventfile",
",",
"segment_length",
",",
"demod",
",",
"tbin",
",",
"threshold",
",",
"PI1",
",",
"PI2",
",",
"t1",
",",
"t2",
",",
"starting_freq",
",",
"W",
",",
"hist_min_sig",
",",
"N",
",",
"xlims",
",",
"plot_mode",
")",
... | Plotting the averaged power spectrum and the noise histogram
eventfile - path to the event file. | [
"Plotting",
"the",
"averaged",
"power",
"spectrum",
"and",
"the",
"noise",
"histogram",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Plotting the averaged power spectrum and the noise histogram\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n segment_length - length of the segments\n demod - whether we're dealing with demodulated data or not!\n tbin_size - size of the time bin\n... | [
{
"param": "eventfile",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "demod",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "PI1",
"type": null
},
{
"param":... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docst... |
bb1417012247efa514f916c9d18f17b92958e7cb | masonng-astro/nicerpy_xrayanalysis | Lv2_ps.py | [
"MIT"
] | Python | partial_E | <not_specific> | def partial_E(eventfile,par_list,tbin_size,Ebin_size,E1,E2,mode,ps_type,oversampling,xlims,vlines):
"""
Plot the time series for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the fl... |
Plot the time series for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
eventfile - path to the... | Plot the time series for a desired energy range.
[Though I don't think this will be used much. Count/s vs energy is pointless,
since we're not folding in response matrix information here to get the flux.
So we're just doing a count/s vs time with an energy cut to the data.]
path to the event file. Will extract ObsID f... | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"energy",
"range",
".",
"[",
"Though",
"I",
"don",
"'",
"t",
"think",
"this",
"will",
"be",
"used",
"much",
".",
"Count",
"/",
"s",
"vs",
"energy",
"is",
"pointless",
"since",
"we",
"'",
"re",
... | def partial_E(eventfile,par_list,tbin_size,Ebin_size,E1,E2,mode,ps_type,oversampling,xlims,vlines):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if 'TIME' not in par_list:
raise ValueError("You should have 'TIME' in the parameter list!")
if type(par_list) != li... | [
"def",
"partial_E",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"Ebin_size",
",",
"E1",
",",
"E2",
",",
"mode",
",",
"ps_type",
",",
"oversampling",
",",
"xlims",
",",
"vlines",
")",
":",
"if",
"type",
"(",
"eventfile",
")",
"!=",
"str",
... | Plot the time series for a desired energy range. | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the time series for a desired energy range.\n [Though I don't think this will be used much. Count/s vs energy is pointless,\n since we're not folding in response matrix information here to get the flux.\n So we're just doing a count/s vs time with an energy cut to the data.]\n\n eventf... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "Ebin_size",
"type": null
},
{
"param": "E1",
"type": null
},
{
"param": "E2",
"type": null
},
{
"param": "mod... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
bb1417012247efa514f916c9d18f17b92958e7cb | masonng-astro/nicerpy_xrayanalysis | Lv2_ps.py | [
"MIT"
] | Python | partial_tE | <not_specific> | def partial_tE(eventfile,par_list,tbin_size,Ebin_size,t1,t2,E1,E2,mode,ps_type,oversampling,xlims,vlines):
"""
Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters... |
Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
tbin_size - the size of ... | Plot the time series for a desired time interval and desired energy range.
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
".",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
... | def partial_tE(eventfile,par_list,tbin_size,Ebin_size,t1,t2,E1,E2,mode,ps_type,oversampling,xlims,vlines):
if type(eventfile) != str:
raise TypeError("eventfile should be a string!")
if 'TIME' not in par_list:
raise ValueError("You should have 'TIME' in the parameter list!")
if type(par_list... | [
"def",
"partial_tE",
"(",
"eventfile",
",",
"par_list",
",",
"tbin_size",
",",
"Ebin_size",
",",
"t1",
",",
"t2",
",",
"E1",
",",
"E2",
",",
"mode",
",",
"ps_type",
",",
"oversampling",
",",
"xlims",
",",
"vlines",
")",
":",
"if",
"type",
"(",
"event... | Plot the time series for a desired time interval and desired energy range. | [
"Plot",
"the",
"time",
"series",
"for",
"a",
"desired",
"time",
"interval",
"and",
"desired",
"energy",
"range",
"."
] | [
"\"\"\"\n Plot the time series for a desired time interval and desired energy range.\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)\n tbin_si... | [
{
"param": "eventfile",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
},
{
"param": "Ebin_size",
"type": null
},
{
"param": "t1",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "E1"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_t... |
8c7bb43136016cd8346aae063668b649bf3b302e | masonng-astro/nicerpy_xrayanalysis | Lv3_quicklook.py | [
"MIT"
] | Python | filtering | null | def filtering(eventfile,outfile,maskdet,eventflags):
"""
Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time...
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - output file from t... |
Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time...
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - output file from the filtering
maskdet - list of DET_IDs to mask
event... | Function that will filter out bad detectors and impose eventflag restrictions.
Will expect to add to this function over time
path to the event file. Will extract ObsID from this for the NICER files.
outfile - output file from the filtering
maskdet - list of DET_IDs to mask
eventflags - NICER event flags to filter out ... | [
"Function",
"that",
"will",
"filter",
"out",
"bad",
"detectors",
"and",
"impose",
"eventflag",
"restrictions",
".",
"Will",
"expect",
"to",
"add",
"to",
"this",
"function",
"over",
"time",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID"... | def filtering(eventfile,outfile,maskdet,eventflags):
evfilt_expr = eventflags
for i in range(len(maskdet)):
evfilt_expr += '.and.(DET_ID!='+str(maskdet[i]) + ')'
subprocess.run(['ftcopy',eventfile+'['+evfilt_expr+']',outfile,'clobber=yes','history=yes']) | [
"def",
"filtering",
"(",
"eventfile",
",",
"outfile",
",",
"maskdet",
",",
"eventflags",
")",
":",
"evfilt_expr",
"=",
"eventflags",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"maskdet",
")",
")",
":",
"evfilt_expr",
"+=",
"'.and.(DET_ID!='",
"+",
"str",
... | Function that will filter out bad detectors and impose eventflag restrictions. | [
"Function",
"that",
"will",
"filter",
"out",
"bad",
"detectors",
"and",
"impose",
"eventflag",
"restrictions",
"."
] | [
"\"\"\"\n Function that will filter out bad detectors and impose eventflag restrictions.\n Will expect to add to this function over time...\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n outfile - output file from the filtering\n maskdet - list of DET_IDs ... | [
{
"param": "eventfile",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "maskdet",
"type": null
},
{
"param": "eventflags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_to... |
00704bfad0c97fdede06f61d73e5b1581c625110 | masonng-astro/nicerpy_xrayanalysis | Lv2_preprocess.py | [
"MIT"
] | Python | preprocess | <not_specific> | def preprocess(obsdir,nicerl2_flags,psrpipe_flags,refframe,orbitfile,parfile,nicer_datafile,nicer_output,nicersoft_datafile,nicersoft_output,nicersoft_folder,custom_coords):
"""
Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.
obsdir - NICER data directory containin... |
Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.
obsdir - NICER data directory containing all the data files (e.g., path_to_NICER_dir/1034070101)
nicerl2_flags - a LIST of input flags for nicerl2
psrpipe_flags - a LIST of input flags for psrpipe
refframe - ... | Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr. | [
"Preprocessing",
"the",
"NICER",
"data",
"for",
"use",
"in",
"PRESTO",
"so",
"running",
"gunzip",
"psrpipe",
"and",
"barycorr",
"."
] | def preprocess(obsdir,nicerl2_flags,psrpipe_flags,refframe,orbitfile,parfile,nicer_datafile,nicer_output,nicersoft_datafile,nicersoft_output,nicersoft_folder,custom_coords):
if type(psrpipe_flags) != list:
raise TypeError("flags should be a list! Not even an array.")
if type(nicerl2_flags) != list:
... | [
"def",
"preprocess",
"(",
"obsdir",
",",
"nicerl2_flags",
",",
"psrpipe_flags",
",",
"refframe",
",",
"orbitfile",
",",
"parfile",
",",
"nicer_datafile",
",",
"nicer_output",
",",
"nicersoft_datafile",
",",
"nicersoft_output",
",",
"nicersoft_folder",
",",
"custom_c... | Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr. | [
"Preprocessing",
"the",
"NICER",
"data",
"for",
"use",
"in",
"PRESTO",
"so",
"running",
"gunzip",
"psrpipe",
"and",
"barycorr",
"."
] | [
"\"\"\"\n Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.\n\n obsdir - NICER data directory containing all the data files (e.g., path_to_NICER_dir/1034070101)\n nicerl2_flags - a LIST of input flags for nicerl2\n psrpipe_flags - a LIST of input flags for psrpipe... | [
{
"param": "obsdir",
"type": null
},
{
"param": "nicerl2_flags",
"type": null
},
{
"param": "psrpipe_flags",
"type": null
},
{
"param": "refframe",
"type": null
},
{
"param": "orbitfile",
"type": null
},
{
"param": "parfile",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsdir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nicerl2_flags",
"type": null,
"docstring": null,
"docstring... |
7968df1392ea46dcc6ee2cf1855538800351e6c2 | masonng-astro/nicerpy_xrayanalysis | Lv3_Z2_stat.py | [
"MIT"
] | Python | niextract | <not_specific> | def niextract(eventfile,E1,E2):
"""
Doing energy cuts only for the rate cut event file!
eventfile - event file name
E1 - lower energy bound (should be in a 4-digit PI string)
E2 - upper energy bound (should be in a 4-digit PI string)
"""
new_event = eventfile[:-4] + '_' + E1 + '-' + E2 + '.... |
Doing energy cuts only for the rate cut event file!
eventfile - event file name
E1 - lower energy bound (should be in a 4-digit PI string)
E2 - upper energy bound (should be in a 4-digit PI string)
| Doing energy cuts only for the rate cut event file. | [
"Doing",
"energy",
"cuts",
"only",
"for",
"the",
"rate",
"cut",
"event",
"file",
"."
] | def niextract(eventfile,E1,E2):
new_event = eventfile[:-4] + '_' + E1 + '-' + E2 + '.evt'
subprocess.check_call(['niextract-events',eventfile+'[PI='+str(int(E1))+':'+str(int(E2))+']',new_event])
return | [
"def",
"niextract",
"(",
"eventfile",
",",
"E1",
",",
"E2",
")",
":",
"new_event",
"=",
"eventfile",
"[",
":",
"-",
"4",
"]",
"+",
"'_'",
"+",
"E1",
"+",
"'-'",
"+",
"E2",
"+",
"'.evt'",
"subprocess",
".",
"check_call",
"(",
"[",
"'niextract-events'"... | Doing energy cuts only for the rate cut event file! | [
"Doing",
"energy",
"cuts",
"only",
"for",
"the",
"rate",
"cut",
"event",
"file!"
] | [
"\"\"\"\n Doing energy cuts only for the rate cut event file!\n\n eventfile - event file name\n E1 - lower energy bound (should be in a 4-digit PI string)\n E2 - upper energy bound (should be in a 4-digit PI string)\n \"\"\""
] | [
{
"param": "eventfile",
"type": null
},
{
"param": "E1",
"type": null
},
{
"param": "E2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "E1",
"type": null,
"docstring": null,
"docstring_tokens"... |
7968df1392ea46dcc6ee2cf1855538800351e6c2 | masonng-astro/nicerpy_xrayanalysis | Lv3_Z2_stat.py | [
"MIT"
] | Python | edit_par | <not_specific> | def edit_par(par_file,var_dict):
"""
Editing the input par file with updated parameter values in the form of a
dictionary. Each key will have 1 value though.
par_file - orbital parameter file for input into PINT's photonphase
var_dict - dictionary, where each key corresponds to a variable to change... |
Editing the input par file with updated parameter values in the form of a
dictionary. Each key will have 1 value though.
par_file - orbital parameter file for input into PINT's photonphase
var_dict - dictionary, where each key corresponds to a variable to change in the par file, and has a 1-entry list... | Editing the input par file with updated parameter values in the form of a
dictionary. Each key will have 1 value though.
orbital parameter file for input into PINT's photonphase
var_dict - dictionary, where each key corresponds to a variable to change in the par file, and has a 1-entry list! | [
"Editing",
"the",
"input",
"par",
"file",
"with",
"updated",
"parameter",
"values",
"in",
"the",
"form",
"of",
"a",
"dictionary",
".",
"Each",
"key",
"will",
"have",
"1",
"value",
"though",
".",
"orbital",
"parameter",
"file",
"for",
"input",
"into",
"PINT... | def edit_par(par_file,var_dict):
dict_keys = var_dict.keys()
new_par = par_file[:-4] + '_iter.par'
line_no_dict = {}
contents = open(par_file,'r').read().split('\n')
for i in range(len(dict_keys)):
line_no = [j for j in range(len(contents)) if dict_keys[i] in contents[j]][0]
line_n... | [
"def",
"edit_par",
"(",
"par_file",
",",
"var_dict",
")",
":",
"dict_keys",
"=",
"var_dict",
".",
"keys",
"(",
")",
"new_par",
"=",
"par_file",
"[",
":",
"-",
"4",
"]",
"+",
"'_iter.par'",
"line_no_dict",
"=",
"{",
"}",
"contents",
"=",
"open",
"(",
... | Editing the input par file with updated parameter values in the form of a
dictionary. | [
"Editing",
"the",
"input",
"par",
"file",
"with",
"updated",
"parameter",
"values",
"in",
"the",
"form",
"of",
"a",
"dictionary",
"."
] | [
"\"\"\"\n Editing the input par file with updated parameter values in the form of a\n dictionary. Each key will have 1 value though.\n\n par_file - orbital parameter file for input into PINT's photonphase\n var_dict - dictionary, where each key corresponds to a variable to change in the par file, and ha... | [
{
"param": "par_file",
"type": null
},
{
"param": "var_dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "par_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "var_dict",
"type": null,
"docstring": null,
"docstring_to... |
7968df1392ea46dcc6ee2cf1855538800351e6c2 | masonng-astro/nicerpy_xrayanalysis | Lv3_Z2_stat.py | [
"MIT"
] | Python | call_photonphase | <not_specific> | def call_photonphase(obsid,model,par_file):
"""
Calls photonphase from PINT to calculate the phase value for each event.
obsid - Observation ID of the object of interest (10-digit str)
model - binary model being used (ELL1, BT, DD, or DDK for now)
par_file - orbital parameter file for input into PI... |
Calls photonphase from PINT to calculate the phase value for each event.
obsid - Observation ID of the object of interest (10-digit str)
model - binary model being used (ELL1, BT, DD, or DDK for now)
par_file - orbital parameter file for input into PINT's photonphase
| Calls photonphase from PINT to calculate the phase value for each event.
obsid - Observation ID of the object of interest (10-digit str)
model - binary model being used (ELL1, BT, DD, or DDK for now)
par_file - orbital parameter file for input into PINT's photonphase | [
"Calls",
"photonphase",
"from",
"PINT",
"to",
"calculate",
"the",
"phase",
"value",
"for",
"each",
"event",
".",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"model",
"-",
"binary",
"mod... | def call_photonphase(obsid,model,par_file):
filename = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/cleanfilt.evt'
orbfile = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/ni' + obsid + '.orb'
if model == '':
outfile_name = filename[:-4] + '_phase.evt'
if model != 'ELL1' and model != 'BT' and model ... | [
"def",
"call_photonphase",
"(",
"obsid",
",",
"model",
",",
"par_file",
")",
":",
"filename",
"=",
"Lv0_dirs",
".",
"NICERSOFT_DATADIR",
"+",
"obsid",
"+",
"'_pipe/cleanfilt.evt'",
"orbfile",
"=",
"Lv0_dirs",
".",
"NICERSOFT_DATADIR",
"+",
"obsid",
"+",
"'_pipe/... | Calls photonphase from PINT to calculate the phase value for each event. | [
"Calls",
"photonphase",
"from",
"PINT",
"to",
"calculate",
"the",
"phase",
"value",
"for",
"each",
"event",
"."
] | [
"\"\"\"\n Calls photonphase from PINT to calculate the phase value for each event.\n\n obsid - Observation ID of the object of interest (10-digit str)\n model - binary model being used (ELL1, BT, DD, or DDK for now)\n par_file - orbital parameter file for input into PINT's photonphase\n \"\"\""
] | [
{
"param": "obsid",
"type": null
},
{
"param": "model",
"type": null
},
{
"param": "par_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens":... |
dc6a5dc2b3bded7c644e95dde0b367c8ed5b7a9f | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_binning_DEPRECATED2.py | [
"MIT"
] | Python | binned_text | null | def binned_text():
"""
Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here
"""
E_bins_low = np.array([20-1,30-1,40-1,100-1,200-1,400-1,40-1,1300-1])
E_bins_high = np.array([30-1,40-1,100-1,200-1,400-1,1200-1,... |
Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here
| Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here | [
"Given",
"the",
"MJDs",
"binned",
"counts",
"and",
"associated",
"uncertainties",
"put",
"them",
"into",
"a",
"text",
"file",
"No",
"arguments",
"because",
"I",
"'",
"ll",
"put",
"all",
"the",
"bands",
"in",
"here"
] | def binned_text():
E_bins_low = np.array([20-1,30-1,40-1,100-1,200-1,400-1,40-1,1300-1])
E_bins_high = np.array([30-1,40-1,100-1,200-1,400-1,1200-1,1200-1,1501-1])
mjds_used = []
rates_text = []
errs_text = []
files_text = []
for i in tqdm(range(len(time_bins))):
files_in_interval ... | [
"def",
"binned_text",
"(",
")",
":",
"E_bins_low",
"=",
"np",
".",
"array",
"(",
"[",
"20",
"-",
"1",
",",
"30",
"-",
"1",
",",
"40",
"-",
"1",
",",
"100",
"-",
"1",
",",
"200",
"-",
"1",
",",
"400",
"-",
"1",
",",
"40",
"-",
"1",
",",
... | Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here | [
"Given",
"the",
"MJDs",
"binned",
"counts",
"and",
"associated",
"uncertainties",
"put",
"them",
"into",
"a",
"text",
"file",
"No",
"arguments",
"because",
"I",
"'",
"ll",
"put",
"all",
"the",
"bands",
"in",
"here"
] | [
"\"\"\"\n Given the MJDs, binned counts, and associated uncertainties, put them into a text file\n\n No arguments because I'll put all the bands in here\n \"\"\"",
"#row of rate values to put into the text file (each line = each time bin)",
"#row of error values to put into the text file (each line = e... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
32524d8ba6a6b5d11bd8e4b6b7b3fa475cf2eaf8 | masonng-astro/nicerpy_xrayanalysis | Lv2_dj_lsp.py | [
"MIT"
] | Python | rebin_lc | <not_specific> | def rebin_lc(corr_lc_files,corr_bg_files,bg_scale,tbin,cmpltness):
"""
Rebinning the original light curve that was corrected through xrtlccorr
lc_files - list of corrected light curve files
tbin - size of new time bins
cmpltness - level of completeness for the bins
"""
"""
#### time order the lc files!!!
sta... |
Rebinning the original light curve that was corrected through xrtlccorr
lc_files - list of corrected light curve files
tbin - size of new time bins
cmpltness - level of completeness for the bins
| Rebinning the original light curve that was corrected through xrtlccorr
lc_files - list of corrected light curve files
tbin - size of new time bins
cmpltness - level of completeness for the bins | [
"Rebinning",
"the",
"original",
"light",
"curve",
"that",
"was",
"corrected",
"through",
"xrtlccorr",
"lc_files",
"-",
"list",
"of",
"corrected",
"light",
"curve",
"files",
"tbin",
"-",
"size",
"of",
"new",
"time",
"bins",
"cmpltness",
"-",
"level",
"of",
"c... | def rebin_lc(corr_lc_files,corr_bg_files,bg_scale,tbin,cmpltness):
times,rates,errors,fracexp = Lv2_swift_lc.get_bgsub(corr_lc_files,corr_bg_files,bg_scale)
trunc_times = times-times[0]
rebinned_time = []
rebinned_rate = []
rebinned_errs = []
rebinned_fracexp = []
completeness = []
time_bins = np.arange(0,trunc... | [
"def",
"rebin_lc",
"(",
"corr_lc_files",
",",
"corr_bg_files",
",",
"bg_scale",
",",
"tbin",
",",
"cmpltness",
")",
":",
"\"\"\"\n\t#### time order the lc files!!!\n\tstart_times = [fits.open(lc_files[i])[1].header['TIMEZERO'] for i in range(len(lc_files))]\n\ttime_ordered = np.argsort(s... | Rebinning the original light curve that was corrected through xrtlccorr
lc_files - list of corrected light curve files
tbin - size of new time bins
cmpltness - level of completeness for the bins | [
"Rebinning",
"the",
"original",
"light",
"curve",
"that",
"was",
"corrected",
"through",
"xrtlccorr",
"lc_files",
"-",
"list",
"of",
"corrected",
"light",
"curve",
"files",
"tbin",
"-",
"size",
"of",
"new",
"time",
"bins",
"cmpltness",
"-",
"level",
"of",
"c... | [
"\"\"\"\n\tRebinning the original light curve that was corrected through xrtlccorr\n\n\tlc_files - list of corrected light curve files\n\ttbin - size of new time bins\n\tcmpltness - level of completeness for the bins\n\t\"\"\"",
"\"\"\"\n\t#### time order the lc files!!!\n\tstart_times = [fits.open(lc_files[i])[1... | [
{
"param": "corr_lc_files",
"type": null
},
{
"param": "corr_bg_files",
"type": null
},
{
"param": "bg_scale",
"type": null
},
{
"param": "tbin",
"type": null
},
{
"param": "cmpltness",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "corr_lc_files",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corr_bg_files",
"type": null,
"docstring": null,
"do... |
32524d8ba6a6b5d11bd8e4b6b7b3fa475cf2eaf8 | masonng-astro/nicerpy_xrayanalysis | Lv2_dj_lsp.py | [
"MIT"
] | Python | psd_error | <not_specific> | def psd_error(times,rates,errors):
"""
obtain errors for the best frequency estimate of the signal
"""
"""
print(len(times),len(rates),len(errors))
newdatachoice = np.random.choice(len(times),size=int(0.1*len(times)))
newtimes = list(np.array([times[0]])) + list(np.array([times[-1]])) + list(times[np.array(lis... |
obtain errors for the best frequency estimate of the signal
| obtain errors for the best frequency estimate of the signal | [
"obtain",
"errors",
"for",
"the",
"best",
"frequency",
"estimate",
"of",
"the",
"signal"
] | def psd_error(times,rates,errors):
freqs_list = []
psds_list = []
for j in tqdm(range(1000)):
new_rates = np.zeros(len(rates))
for i in range(len(rates)):
if rates[i] != 0:
new_rates[i] = np.random.normal(loc=rates[i],scale=errors[i])
trunc_times = times-times[0]
newchoice = np.random.choice(len(trunc... | [
"def",
"psd_error",
"(",
"times",
",",
"rates",
",",
"errors",
")",
":",
"\"\"\"\n\tprint(len(times),len(rates),len(errors))\n\tnewdatachoice = np.random.choice(len(times),size=int(0.1*len(times)))\n\n\tnewtimes = list(np.array([times[0]])) + list(np.array([times[-1]])) + list(times[np.array(lis... | obtain errors for the best frequency estimate of the signal | [
"obtain",
"errors",
"for",
"the",
"best",
"frequency",
"estimate",
"of",
"the",
"signal"
] | [
"\"\"\"\n\tobtain errors for the best frequency estimate of the signal\n\t\"\"\"",
"\"\"\"\n\tprint(len(times),len(rates),len(errors))\n\tnewdatachoice = np.random.choice(len(times),size=int(0.1*len(times)))\n\n\tnewtimes = list(np.array([times[0]])) + list(np.array([times[-1]])) + list(times[np.array(list(set(ne... | [
{
"param": "times",
"type": null
},
{
"param": "rates",
"type": null
},
{
"param": "errors",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "times",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rates",
"type": null,
"docstring": null,
"docstring_tokens":... |
32524d8ba6a6b5d11bd8e4b6b7b3fa475cf2eaf8 | masonng-astro/nicerpy_xrayanalysis | Lv2_dj_lsp.py | [
"MIT"
] | Python | lsp | <not_specific> | def lsp(times, rates):
"""
cast times and rates as numpy arrays
"""
times = np.array(times)
rates = np.array(rates)
"""
Set the initial time to 0
"""
tmin = min(times)
times = times - tmin
"""
calculate the number of independent frequencies
"""
n0 = len(times)
Ni = int(-6.362 + 1.193*n0 + 0.00098*n0**2)
... |
cast times and rates as numpy arrays
| cast times and rates as numpy arrays | [
"cast",
"times",
"and",
"rates",
"as",
"numpy",
"arrays"
] | def lsp(times, rates):
times = np.array(times)
rates = np.array(rates)
tmin = min(times)
times = times - tmin
n0 = len(times)
Ni = int(-6.362 + 1.193*n0 + 0.00098*n0**2)
fmin = 1/np.max(times)
fmax = n0/(2.0*np.max(times))
fmax = 1e-5
omega = 2*np.pi *(fmin+(fmax-fmin)*np.arange(Ni)/(Ni-1.))
cn = rates - np.... | [
"def",
"lsp",
"(",
"times",
",",
"rates",
")",
":",
"times",
"=",
"np",
".",
"array",
"(",
"times",
")",
"rates",
"=",
"np",
".",
"array",
"(",
"rates",
")",
"\"\"\"\n\tSet the initial time to 0\n\t\"\"\"",
"tmin",
"=",
"min",
"(",
"times",
")",
"times",... | cast times and rates as numpy arrays | [
"cast",
"times",
"and",
"rates",
"as",
"numpy",
"arrays"
] | [
"\"\"\"\n\tcast times and rates as numpy arrays\n\t\"\"\"",
"\"\"\"\n\tSet the initial time to 0\n\t\"\"\"",
"\"\"\"\n\tcalculate the number of independent frequencies\n\t\"\"\"",
"\"\"\"\n\testimate the minimum and maximum frequencies to be sampled\n\t\"\"\"",
"#print('Minimum frequency: ' + str(fmin))",
... | [
{
"param": "times",
"type": null
},
{
"param": "rates",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "times",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rates",
"type": null,
"docstring": null,
"docstring_tokens":... |
92a32d3e2373540bbff7f56f8f24f015243aa521 | masonng-astro/nicerpy_xrayanalysis | Lv1_ngc300_binning.py | [
"MIT"
] | Python | binned_text | null | def binned_text(bin_size):
"""
Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here
"""
E_bins_low = np.array([20-1,30-1,40-1,100-1,200-1,400-1,40-1,1300-1])
E_bins_high = np.array([30-1,40-1,100-1,200-1,400-1... |
Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here
| Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here | [
"Given",
"the",
"MJDs",
"binned",
"counts",
"and",
"associated",
"uncertainties",
"put",
"them",
"into",
"a",
"text",
"file",
"No",
"arguments",
"because",
"I",
"'",
"ll",
"put",
"all",
"the",
"bands",
"in",
"here"
] | def binned_text(bin_size):
E_bins_low = np.array([20-1,30-1,40-1,100-1,200-1,400-1,40-1,1300-1])
E_bins_high = np.array([30-1,40-1,100-1,200-1,400-1,1200-1,1200-1,1501-1])
bgsub_files = sorted(glob.glob(Lv0_dirs.NGC300_2020 + 'spectra_' + bin_size + '/58*_' + bgsub_type + '*_cl50.pha'))
output_text = op... | [
"def",
"binned_text",
"(",
"bin_size",
")",
":",
"E_bins_low",
"=",
"np",
".",
"array",
"(",
"[",
"20",
"-",
"1",
",",
"30",
"-",
"1",
",",
"40",
"-",
"1",
",",
"100",
"-",
"1",
",",
"200",
"-",
"1",
",",
"400",
"-",
"1",
",",
"40",
"-",
... | Given the MJDs, binned counts, and associated uncertainties, put them into a text file
No arguments because I'll put all the bands in here | [
"Given",
"the",
"MJDs",
"binned",
"counts",
"and",
"associated",
"uncertainties",
"put",
"them",
"into",
"a",
"text",
"file",
"No",
"arguments",
"because",
"I",
"'",
"ll",
"put",
"all",
"the",
"bands",
"in",
"here"
] | [
"\"\"\"\n Given the MJDs, binned counts, and associated uncertainties, put them into a text file\n\n No arguments because I'll put all the bands in here\n \"\"\"",
"#for each averaged spectrum",
"#for each energy band",
"#for the MJD",
"#for the count rates in each band",
"#for the list of files ... | [
{
"param": "bin_size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bin_size",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d005943b7ec40f0de56c255de97d5c20790c851b | masonng-astro/nicerpy_xrayanalysis | Lv3_detection_level.py | [
"MIT"
] | Python | max_acc | <not_specific> | def max_acc(zmax,T,f0):
"""
To obtain the maximum acceleration 'detectable' by PRESTO.
zmax - (expected) maximum number of Fourier bins that the pulsar frequency
f0 drifts
T - observation duration (s)
f0 - pulsar's frequency (Hz)
"""
c = 299792458 #speed of light in m/s
return zmax... |
To obtain the maximum acceleration 'detectable' by PRESTO.
zmax - (expected) maximum number of Fourier bins that the pulsar frequency
f0 drifts
T - observation duration (s)
f0 - pulsar's frequency (Hz)
| To obtain the maximum acceleration 'detectable' by PRESTO.
zmax - (expected) maximum number of Fourier bins that the pulsar frequency
f0 drifts
T - observation duration (s)
f0 - pulsar's frequency (Hz) | [
"To",
"obtain",
"the",
"maximum",
"acceleration",
"'",
"detectable",
"'",
"by",
"PRESTO",
".",
"zmax",
"-",
"(",
"expected",
")",
"maximum",
"number",
"of",
"Fourier",
"bins",
"that",
"the",
"pulsar",
"frequency",
"f0",
"drifts",
"T",
"-",
"observation",
"... | def max_acc(zmax,T,f0):
c = 299792458
return zmax*c/(T**2*f0) | [
"def",
"max_acc",
"(",
"zmax",
",",
"T",
",",
"f0",
")",
":",
"c",
"=",
"299792458",
"return",
"zmax",
"*",
"c",
"/",
"(",
"T",
"**",
"2",
"*",
"f0",
")"
] | To obtain the maximum acceleration 'detectable' by PRESTO. | [
"To",
"obtain",
"the",
"maximum",
"acceleration",
"'",
"detectable",
"'",
"by",
"PRESTO",
"."
] | [
"\"\"\"\n To obtain the maximum acceleration 'detectable' by PRESTO.\n\n zmax - (expected) maximum number of Fourier bins that the pulsar frequency\n f0 drifts\n T - observation duration (s)\n f0 - pulsar's frequency (Hz)\n \"\"\"",
"#speed of light in m/s"
] | [
{
"param": "zmax",
"type": null
},
{
"param": "T",
"type": null
},
{
"param": "f0",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "zmax",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "T",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d005943b7ec40f0de56c255de97d5c20790c851b | masonng-astro/nicerpy_xrayanalysis | Lv3_detection_level.py | [
"MIT"
] | Python | N_trials | <not_specific> | def N_trials(tbin,T):
"""
To obtain the number of trials used in the FFT. Divided by two to get number
of trials f >= 0!
tbin- size of the bins in time
T - observation duration (s) or segment length (s)
"""
return 1/2 * T/tbin |
To obtain the number of trials used in the FFT. Divided by two to get number
of trials f >= 0!
tbin- size of the bins in time
T - observation duration (s) or segment length (s)
| To obtain the number of trials used in the FFT. Divided by two to get number
of trials f >= 0!
tbin- size of the bins in time
T - observation duration (s) or segment length (s) | [
"To",
"obtain",
"the",
"number",
"of",
"trials",
"used",
"in",
"the",
"FFT",
".",
"Divided",
"by",
"two",
"to",
"get",
"number",
"of",
"trials",
"f",
">",
"=",
"0!",
"tbin",
"-",
"size",
"of",
"the",
"bins",
"in",
"time",
"T",
"-",
"observation",
"... | def N_trials(tbin,T):
return 1/2 * T/tbin | [
"def",
"N_trials",
"(",
"tbin",
",",
"T",
")",
":",
"return",
"1",
"/",
"2",
"*",
"T",
"/",
"tbin"
] | To obtain the number of trials used in the FFT. | [
"To",
"obtain",
"the",
"number",
"of",
"trials",
"used",
"in",
"the",
"FFT",
"."
] | [
"\"\"\"\n To obtain the number of trials used in the FFT. Divided by two to get number\n of trials f >= 0!\n\n tbin- size of the bins in time\n T - observation duration (s) or segment length (s)\n \"\"\""
] | [
{
"param": "tbin",
"type": null
},
{
"param": "T",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tbin",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "T",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d005943b7ec40f0de56c255de97d5c20790c851b | masonng-astro/nicerpy_xrayanalysis | Lv3_detection_level.py | [
"MIT"
] | Python | single_trial_prob | <not_specific> | def single_trial_prob(significance,N):
"""
To obtain the single trial probability required for a statistically significant
"significance" detection, with N trials.
significance - the number of 'sigmas' desired for detection
N - number of trials
"""
prob = 1-special.erf(significance/np.sqrt(... |
To obtain the single trial probability required for a statistically significant
"significance" detection, with N trials.
significance - the number of 'sigmas' desired for detection
N - number of trials
| To obtain the single trial probability required for a statistically significant
"significance" detection, with N trials.
the number of 'sigmas' desired for detection
N - number of trials | [
"To",
"obtain",
"the",
"single",
"trial",
"probability",
"required",
"for",
"a",
"statistically",
"significant",
"\"",
"significance",
"\"",
"detection",
"with",
"N",
"trials",
".",
"the",
"number",
"of",
"'",
"sigmas",
"'",
"desired",
"for",
"detection",
"N",... | def single_trial_prob(significance,N):
prob = 1-special.erf(significance/np.sqrt(2))
single_trial = 1 - (1 - prob)**(1/N)
single_trial_signif = special.erfinv(1-single_trial)*np.sqrt(2)
return single_trial, single_trial_signif | [
"def",
"single_trial_prob",
"(",
"significance",
",",
"N",
")",
":",
"prob",
"=",
"1",
"-",
"special",
".",
"erf",
"(",
"significance",
"/",
"np",
".",
"sqrt",
"(",
"2",
")",
")",
"single_trial",
"=",
"1",
"-",
"(",
"1",
"-",
"prob",
")",
"**",
"... | To obtain the single trial probability required for a statistically significant
"significance" detection, with N trials. | [
"To",
"obtain",
"the",
"single",
"trial",
"probability",
"required",
"for",
"a",
"statistically",
"significant",
"\"",
"significance",
"\"",
"detection",
"with",
"N",
"trials",
"."
] | [
"\"\"\"\n To obtain the single trial probability required for a statistically significant\n \"significance\" detection, with N trials.\n\n significance - the number of 'sigmas' desired for detection\n N - number of trials\n \"\"\"",
"#print('The single trial probability required for a ' + str(signi... | [
{
"param": "significance",
"type": null
},
{
"param": "N",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "significance",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "N",
"type": null,
"docstring": null,
"docstring_token... |
d005943b7ec40f0de56c255de97d5c20790c851b | masonng-astro/nicerpy_xrayanalysis | Lv3_detection_level.py | [
"MIT"
] | Python | signal_significance | <not_specific> | def signal_significance(N,M,W,Pthreshold):
"""
Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal).
M - number of segments
W - number of consec... |
Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal).
M - number of segments
W - number of consecutive bins summed
Pthreshold - the power of th... | Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal).
number of segments
W - number of consecutive bins summed
Pthreshold - the power of the signal (Leahy-normalized) | [
"Calculating",
"the",
"significance",
"of",
"a",
"particular",
"signal",
"in",
"the",
"power",
"spectrum",
"given",
"M",
"(",
"number",
"of",
"segments",
")",
"W",
"(",
"number",
"of",
"consecutive",
"bins",
"summed",
")",
"and",
"Pthreshold",
"(",
"the",
... | def signal_significance(N,M,W,Pthreshold):
chi2 = M*W*Pthreshold
dof = 2*M*W
Q_chi2_dof = 1-stats.chi2.cdf(chi2,dof)
significance = special.erfinv(1-Q_chi2_dof*N)*np.sqrt(2)
return significance | [
"def",
"signal_significance",
"(",
"N",
",",
"M",
",",
"W",
",",
"Pthreshold",
")",
":",
"chi2",
"=",
"M",
"*",
"W",
"*",
"Pthreshold",
"dof",
"=",
"2",
"*",
"M",
"*",
"W",
"Q_chi2_dof",
"=",
"1",
"-",
"stats",
".",
"chi2",
".",
"cdf",
"(",
"ch... | Calculating the significance of a particular signal in the power spectrum,
given M (number of segments), W (number of consecutive bins summed), and
Pthreshold (the power [Leahy-normalized] of the signal). | [
"Calculating",
"the",
"significance",
"of",
"a",
"particular",
"signal",
"in",
"the",
"power",
"spectrum",
"given",
"M",
"(",
"number",
"of",
"segments",
")",
"W",
"(",
"number",
"of",
"consecutive",
"bins",
"summed",
")",
"and",
"Pthreshold",
"(",
"the",
... | [
"\"\"\"\n Calculating the significance of a particular signal in the power spectrum,\n given M (number of segments), W (number of consecutive bins summed), and\n Pthreshold (the power [Leahy-normalized] of the signal).\n\n M - number of segments\n W - number of consecutive bins summed\n Pthreshold... | [
{
"param": "N",
"type": null
},
{
"param": "M",
"type": null
},
{
"param": "W",
"type": null
},
{
"param": "Pthreshold",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "N",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "M",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
d005943b7ec40f0de56c255de97d5c20790c851b | masonng-astro/nicerpy_xrayanalysis | Lv3_detection_level.py | [
"MIT"
] | Python | power_for_sigma | <not_specific> | def power_for_sigma(significance,N,M,W):
"""
Given some probability (that is, desired significance), what is the corresponding
power needed in the power spectrum to claim statistical significance? Use the
inverse survival function for this!
significance - the number of 'sigmas' desired for detectio... |
Given some probability (that is, desired significance), what is the corresponding
power needed in the power spectrum to claim statistical significance? Use the
inverse survival function for this!
significance - the number of 'sigmas' desired for detection
N - number of trials
M - number of seg... | Given some probability (that is, desired significance), what is the corresponding
power needed in the power spectrum to claim statistical significance. Use the
inverse survival function for this!
the number of 'sigmas' desired for detection
N - number of trials
M - number of segments
W - number of consecutive bins sum... | [
"Given",
"some",
"probability",
"(",
"that",
"is",
"desired",
"significance",
")",
"what",
"is",
"the",
"corresponding",
"power",
"needed",
"in",
"the",
"power",
"spectrum",
"to",
"claim",
"statistical",
"significance",
".",
"Use",
"the",
"inverse",
"survival",
... | def power_for_sigma(significance,N,M,W):
Q,sigfig = single_trial_prob(significance,N)
dof = 2*M*W
chi2 = stats.chi2.isf(Q,dof)
power_required = chi2/(M*W)
return power_required | [
"def",
"power_for_sigma",
"(",
"significance",
",",
"N",
",",
"M",
",",
"W",
")",
":",
"Q",
",",
"sigfig",
"=",
"single_trial_prob",
"(",
"significance",
",",
"N",
")",
"dof",
"=",
"2",
"*",
"M",
"*",
"W",
"chi2",
"=",
"stats",
".",
"chi2",
".",
... | Given some probability (that is, desired significance), what is the corresponding
power needed in the power spectrum to claim statistical significance? | [
"Given",
"some",
"probability",
"(",
"that",
"is",
"desired",
"significance",
")",
"what",
"is",
"the",
"corresponding",
"power",
"needed",
"in",
"the",
"power",
"spectrum",
"to",
"claim",
"statistical",
"significance?"
] | [
"\"\"\"\n Given some probability (that is, desired significance), what is the corresponding\n power needed in the power spectrum to claim statistical significance? Use the\n inverse survival function for this!\n\n significance - the number of 'sigmas' desired for detection\n N - number of trials\n ... | [
{
"param": "significance",
"type": null
},
{
"param": "N",
"type": null
},
{
"param": "M",
"type": null
},
{
"param": "W",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "significance",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "N",
"type": null,
"docstring": null,
"docstring_token... |
3b7b590011ed9c5b1b51e8c22025bcb5a68e9719 | masonng-astro/nicerpy_xrayanalysis | Lv1_barycorr.py | [
"MIT"
] | Python | read_par | <not_specific> | def read_par(parfile):
"""
Function that reads a par file. In particular, for the purposes of barycorr,
it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.
Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDE... |
Function that reads a par file. In particular, for the purposes of barycorr,
it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.
Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
... | Function that reads a par file.
Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
Step 2b: The corresponding strings are split up without whitespace
Step 3: Extract the values accordingly
path of ... | [
"Function",
"that",
"reads",
"a",
"par",
"file",
".",
"Step",
"1",
":",
"Read",
"par",
"file",
"line",
"by",
"line",
"where",
"each",
"line",
"is",
"stored",
"as",
"a",
"string",
"in",
"the",
"'",
"contents",
"'",
"array",
"Step",
"2a",
":",
"For",
... | def read_par(parfile):
if parfile[-4:] != '.par':
raise ValueError("parfile is neither an empty string nor a .par file. Is this right?")
contents = open(parfile,'r').read().split('\n')
posepoch = [contents[i] for i in range(len(contents)) if 'POSEPOCH' in contents[i]][0].split()
raj = [contents[... | [
"def",
"read_par",
"(",
"parfile",
")",
":",
"if",
"parfile",
"[",
"-",
"4",
":",
"]",
"!=",
"'.par'",
":",
"raise",
"ValueError",
"(",
"\"parfile is neither an empty string nor a .par file. Is this right?\"",
")",
"contents",
"=",
"open",
"(",
"parfile",
",",
"... | Function that reads a par file. | [
"Function",
"that",
"reads",
"a",
"par",
"file",
"."
] | [
"\"\"\"\n Function that reads a par file. In particular, for the purposes of barycorr,\n it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.\n\n Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array\n Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines... | [
{
"param": "parfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b7b590011ed9c5b1b51e8c22025bcb5a68e9719 | masonng-astro/nicerpy_xrayanalysis | Lv1_barycorr.py | [
"MIT"
] | Python | barycorr | null | def barycorr(eventfile,outfile,refframe,orbit_file,parfile,output_folder,custom_coords):
"""
General function to perform the barycenter corrections for an event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - path to the output event file with baryce... |
General function to perform the barycenter corrections for an event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - path to the output event file with barycenter corrections applied
refframe - reference frame for barycenter corrections (usually ICRS... | General function to perform the barycenter corrections for an event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files. | [
"General",
"function",
"to",
"perform",
"the",
"barycenter",
"corrections",
"for",
"an",
"event",
"file",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
"."
] | def barycorr(eventfile,outfile,refframe,orbit_file,parfile,output_folder,custom_coords):
if refframe != 'ICRS' and refframe != 'FK5':
raise ValueError("refframe should either be ICRS or FK5! Otherwise, update Lv1_barycorr.py if there are options I was unaware of.")
TIMEZERO = fits.open(eventfile)[1].hea... | [
"def",
"barycorr",
"(",
"eventfile",
",",
"outfile",
",",
"refframe",
",",
"orbit_file",
",",
"parfile",
",",
"output_folder",
",",
"custom_coords",
")",
":",
"if",
"refframe",
"!=",
"'ICRS'",
"and",
"refframe",
"!=",
"'FK5'",
":",
"raise",
"ValueError",
"("... | General function to perform the barycenter corrections for an event file
eventfile - path to the event file. | [
"General",
"function",
"to",
"perform",
"the",
"barycenter",
"corrections",
"for",
"an",
"event",
"file",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n General function to perform the barycenter corrections for an event file\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n outfile - path to the output event file with barycenter corrections applied\n refframe - reference frame for barycenter correctio... | [
{
"param": "eventfile",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "refframe",
"type": null
},
{
"param": "orbit_file",
"type": null
},
{
"param": "parfile",
"type": null
},
{
"param": "output_folder",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_to... |
6465fec334885f492ddc9fd0cc269f12732ad7e2 | masonng-astro/nicerpy_xrayanalysis | Lv2_swift_lc.py | [
"MIT"
] | Python | time_order | <not_specific> | def time_order(eventlist,mjd1,mjd2):
"""
Takes as input, a list of event files, and outputs a subset of event files,
which are ordered in time, and are contained within mjd1 and mj2
eventlist - list of event files
mjd1 - lower bound on MJD (i.e., earliest)
mjd2 - upper bound on MJD (i.e., lates... |
Takes as input, a list of event files, and outputs a subset of event files,
which are ordered in time, and are contained within mjd1 and mj2
eventlist - list of event files
mjd1 - lower bound on MJD (i.e., earliest)
mjd2 - upper bound on MJD (i.e., latest)
| Takes as input, a list of event files, and outputs a subset of event files,
which are ordered in time, and are contained within mjd1 and mj2
list of event files
mjd1 - lower bound on MJD
mjd2 - upper bound on MJD | [
"Takes",
"as",
"input",
"a",
"list",
"of",
"event",
"files",
"and",
"outputs",
"a",
"subset",
"of",
"event",
"files",
"which",
"are",
"ordered",
"in",
"time",
"and",
"are",
"contained",
"within",
"mjd1",
"and",
"mj2",
"list",
"of",
"event",
"files",
"mjd... | def time_order(eventlist,mjd1,mjd2):
if type(eventlist) != np.ndarray and type(eventlist) != list:
raise TypeError('eventfile should be an array or a list!')
start_times = [fits.open(eventlist[i])[1].header['TSTART'] for i in range(len(eventlist))]
time_ordered = np.argsort(start_times)
ordered_... | [
"def",
"time_order",
"(",
"eventlist",
",",
"mjd1",
",",
"mjd2",
")",
":",
"if",
"type",
"(",
"eventlist",
")",
"!=",
"np",
".",
"ndarray",
"and",
"type",
"(",
"eventlist",
")",
"!=",
"list",
":",
"raise",
"TypeError",
"(",
"'eventfile should be an array o... | Takes as input, a list of event files, and outputs a subset of event files,
which are ordered in time, and are contained within mjd1 and mj2 | [
"Takes",
"as",
"input",
"a",
"list",
"of",
"event",
"files",
"and",
"outputs",
"a",
"subset",
"of",
"event",
"files",
"which",
"are",
"ordered",
"in",
"time",
"and",
"are",
"contained",
"within",
"mjd1",
"and",
"mj2"
] | [
"\"\"\"\n Takes as input, a list of event files, and outputs a subset of event files,\n which are ordered in time, and are contained within mjd1 and mj2\n\n eventlist - list of event files\n mjd1 - lower bound on MJD (i.e., earliest)\n mjd2 - upper bound on MJD (i.e., latest)\n \"\"\""
] | [
{
"param": "eventlist",
"type": null
},
{
"param": "mjd1",
"type": null
},
{
"param": "mjd2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventlist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mjd1",
"type": null,
"docstring": null,
"docstring_token... |
6465fec334885f492ddc9fd0cc269f12732ad7e2 | masonng-astro/nicerpy_xrayanalysis | Lv2_swift_lc.py | [
"MIT"
] | Python | att_file_use | <not_specific> | def att_file_use(eventfile):
"""
For a given event file, determines what attitude file to use
eventfile - path to the event file
"""
obsid = str(pathlib.Path(eventfile).name)[:13]
attflag = fits.open(eventfile)[1].header['ATTFLAG']
if attflag == '110':
return '/Volumes/Samsung_T5/N... |
For a given event file, determines what attitude file to use
eventfile - path to the event file
| For a given event file, determines what attitude file to use
eventfile - path to the event file | [
"For",
"a",
"given",
"event",
"file",
"determines",
"what",
"attitude",
"file",
"to",
"use",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file"
] | def att_file_use(eventfile):
obsid = str(pathlib.Path(eventfile).name)[:13]
attflag = fits.open(eventfile)[1].header['ATTFLAG']
if attflag == '110':
return '/Volumes/Samsung_T5/NGC300_ULX_Swift/auxil/' + obsid + 'pat.fits.gz'
elif attflag == '100':
return '/Volumes/Samsung_T5/NGC300_ULX_... | [
"def",
"att_file_use",
"(",
"eventfile",
")",
":",
"obsid",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventfile",
")",
".",
"name",
")",
"[",
":",
"13",
"]",
"attflag",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
"1",
"]",
".",
"he... | For a given event file, determines what attitude file to use
eventfile - path to the event file | [
"For",
"a",
"given",
"event",
"file",
"determines",
"what",
"attitude",
"file",
"to",
"use",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file"
] | [
"\"\"\"\n For a given event file, determines what attitude file to use\n\n eventfile - path to the event file\n \"\"\""
] | [
{
"param": "eventfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6465fec334885f492ddc9fd0cc269f12732ad7e2 | masonng-astro/nicerpy_xrayanalysis | Lv2_swift_lc.py | [
"MIT"
] | Python | barycorr | <not_specific> | def barycorr(eventfile,outfile,refframe,orbit_file,output_folder):
"""
General function to perform the barycenter corrections for a Swift event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - path to the output event file with barycenter corrections ... |
General function to perform the barycenter corrections for a Swift event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - path to the output event file with barycenter corrections applied
refframe - reference frame for barycenter corrections (usually... | General function to perform the barycenter corrections for a Swift event file
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
outfile - path to the output event file with barycenter corrections applied
refframe - reference frame for barycenter corrections (usually ICRS)
orbit_file ... | [
"General",
"function",
"to",
"perform",
"the",
"barycenter",
"corrections",
"for",
"a",
"Swift",
"event",
"file",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"Will",
"extract",
"ObsID",
"from",
"this",
"for",
"the",
"NICER",
"files",
".",
... | def barycorr(eventfile,outfile,refframe,orbit_file,output_folder):
obsid = eventfile[2:13]
logfile = output_folder + 'barycorr_notes.txt'
ra,dec = get_ra_dec(eventfile)
with open(logfile,'w') as logtextfile:
output = subprocess.run(['barycorr',eventfile,'outfile='+outfile,'orbitfiles='+orbit_fil... | [
"def",
"barycorr",
"(",
"eventfile",
",",
"outfile",
",",
"refframe",
",",
"orbit_file",
",",
"output_folder",
")",
":",
"obsid",
"=",
"eventfile",
"[",
"2",
":",
"13",
"]",
"logfile",
"=",
"output_folder",
"+",
"'barycorr_notes.txt'",
"ra",
",",
"dec",
"=... | General function to perform the barycenter corrections for a Swift event file
eventfile - path to the event file. | [
"General",
"function",
"to",
"perform",
"the",
"barycenter",
"corrections",
"for",
"a",
"Swift",
"event",
"file",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n General function to perform the barycenter corrections for a Swift event file\n\n eventfile - path to the event file. Will extract ObsID from this for the NICER files.\n outfile - path to the output event file with barycenter corrections applied\n refframe - reference frame for barycenter corr... | [
{
"param": "eventfile",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "refframe",
"type": null
},
{
"param": "orbit_file",
"type": null
},
{
"param": "output_folder",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_to... |
6465fec334885f492ddc9fd0cc269f12732ad7e2 | masonng-astro/nicerpy_xrayanalysis | Lv2_swift_lc.py | [
"MIT"
] | Python | xselect_script | null | def xselect_script(eventlist,regfile,binsize,mjd1,mjd2):
"""
Writes a script so that XSELECT can take in the events, bins them, and
outputs them into a light curve (.lc) form
eventlist - a list of event files
binsize - desired bin size for the light curve
"""
parent_folder = str(pathlib.Pat... |
Writes a script so that XSELECT can take in the events, bins them, and
outputs them into a light curve (.lc) form
eventlist - a list of event files
binsize - desired bin size for the light curve
| Writes a script so that XSELECT can take in the events, bins them, and
outputs them into a light curve (.lc) form
a list of event files
binsize - desired bin size for the light curve | [
"Writes",
"a",
"script",
"so",
"that",
"XSELECT",
"can",
"take",
"in",
"the",
"events",
"bins",
"them",
"and",
"outputs",
"them",
"into",
"a",
"light",
"curve",
"(",
".",
"lc",
")",
"form",
"a",
"list",
"of",
"event",
"files",
"binsize",
"-",
"desired"... | def xselect_script(eventlist,regfile,binsize,mjd1,mjd2):
parent_folder = str(pathlib.Path(eventlist[0]).parent)
script_name = parent_folder + '/xselect_earlier_ulx1_instructions.txt'
writing = open(script_name,'w')
writing.write('set mission swift' + '\n')
writing.write('set inst xrt' + '\n')
fo... | [
"def",
"xselect_script",
"(",
"eventlist",
",",
"regfile",
",",
"binsize",
",",
"mjd1",
",",
"mjd2",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"eventlist",
"[",
"0",
"]",
")",
".",
"parent",
")",
"script_name",
"=",
"pare... | Writes a script so that XSELECT can take in the events, bins them, and
outputs them into a light curve (.lc) form | [
"Writes",
"a",
"script",
"so",
"that",
"XSELECT",
"can",
"take",
"in",
"the",
"events",
"bins",
"them",
"and",
"outputs",
"them",
"into",
"a",
"light",
"curve",
"(",
".",
"lc",
")",
"form"
] | [
"\"\"\"\n Writes a script so that XSELECT can take in the events, bins them, and\n outputs them into a light curve (.lc) form\n\n eventlist - a list of event files\n binsize - desired bin size for the light curve\n \"\"\""
] | [
{
"param": "eventlist",
"type": null
},
{
"param": "regfile",
"type": null
},
{
"param": "binsize",
"type": null
},
{
"param": "mjd1",
"type": null
},
{
"param": "mjd2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventlist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regfile",
"type": null,
"docstring": null,
"docstring_to... |
6465fec334885f492ddc9fd0cc269f12732ad7e2 | masonng-astro/nicerpy_xrayanalysis | Lv2_swift_lc.py | [
"MIT"
] | Python | lcmath | null | def lcmath(corr_lc_files,corr_bg_files,bg_scale):
"""
Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background
"""
p... |
Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background
| Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background | [
"Running",
"lcmath",
"to",
"do",
"background",
"subtraction",
"on",
"the",
"xrtlccorr",
"-",
"corrected",
"light",
"curves",
"corr_lc_files",
"-",
"list",
"of",
"corrected",
"sw",
"*",
"_corr",
".",
"lc",
"files",
"corr_bg_files",
"-",
"list",
"of",
"corrected... | def lcmath(corr_lc_files,corr_bg_files,bg_scale):
parent_folder = str(pathlib.Path(corr_lc_files[0]).parent)
lcmath = open(parent_folder + '/lcmath_instruct.txt','w')
for i in range(len(corr_lc_files)):
inputfile = corr_lc_files[i]
bgfile = corr_bg_files[i]
outputfile = corr_lc_files... | [
"def",
"lcmath",
"(",
"corr_lc_files",
",",
"corr_bg_files",
",",
"bg_scale",
")",
":",
"parent_folder",
"=",
"str",
"(",
"pathlib",
".",
"Path",
"(",
"corr_lc_files",
"[",
"0",
"]",
")",
".",
"parent",
")",
"lcmath",
"=",
"open",
"(",
"parent_folder",
"... | Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background | [
"Running",
"lcmath",
"to",
"do",
"background",
"subtraction",
"on",
"the",
"xrtlccorr",
"-",
"corrected",
"light",
"curves",
"corr_lc_files",
"-",
"list",
"of",
"corrected",
"sw",
"*",
"_corr",
".",
"lc",
"files",
"corr_bg_files",
"-",
"list",
"of",
"corrected... | [
"\"\"\"\n Running lcmath to do background subtraction on the xrtlccorr-corrected light curves\n\n corr_lc_files - list of corrected sw*_corr.lc files\n corr_bg_files - list of corrected sw*_bg_corr.lc files\n bg_scale - scaling factor for background\n \"\"\""
] | [
{
"param": "corr_lc_files",
"type": null
},
{
"param": "corr_bg_files",
"type": null
},
{
"param": "bg_scale",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "corr_lc_files",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "corr_bg_files",
"type": null,
"docstring": null,
"do... |
d4565632bdc488e8ee858f86982bdc9f7a4445a3 | masonng-astro/nicerpy_xrayanalysis | DEPRECATED_Lv3_average_ps_segments.py | [
"MIT"
] | Python | binned_data | <not_specific> | def binned_data(obsid,par_list,tbin_size):
"""
Get binned (by tbin_size in s) data for a given ObsID - data was pre-processed
by NICERsoft!
obsid - Observation ID of the object of interest (10-digit str)
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl... |
Get binned (by tbin_size in s) data for a given ObsID - data was pre-processed
by NICERsoft!
obsid - Observation ID of the object of interest (10-digit str)
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
tbin_size - size of the ... | Get binned (by tbin_size in s) data for a given ObsID - data was pre-processed
by NICERsoft!
Observation ID of the object of interest (10-digit str)
par_list - A list of parameters we'd like to extract from the FITS file
tbin_size - size of the time bin | [
"Get",
"binned",
"(",
"by",
"tbin_size",
"in",
"s",
")",
"data",
"for",
"a",
"given",
"ObsID",
"-",
"data",
"was",
"pre",
"-",
"processed",
"by",
"NICERsoft!",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str"... | def binned_data(obsid,par_list,tbin_size):
if type(obsid) != str:
raise TypeError("ObsID should be a string!")
if type(par_list) != list and type(par_list) != np.ndarray:
raise TypeError("par_list should either be a list or an array!")
data_dict = Lv0_call_nicersoft_eventcl.get_eventcl(obsid... | [
"def",
"binned_data",
"(",
"obsid",
",",
"par_list",
",",
"tbin_size",
")",
":",
"if",
"type",
"(",
"obsid",
")",
"!=",
"str",
":",
"raise",
"TypeError",
"(",
"\"ObsID should be a string!\"",
")",
"if",
"type",
"(",
"par_list",
")",
"!=",
"list",
"and",
... | Get binned (by tbin_size in s) data for a given ObsID - data was pre-processed
by NICERsoft! | [
"Get",
"binned",
"(",
"by",
"tbin_size",
"in",
"s",
")",
"data",
"for",
"a",
"given",
"ObsID",
"-",
"data",
"was",
"pre",
"-",
"processed",
"by",
"NICERsoft!"
] | [
"\"\"\"\n Get binned (by tbin_size in s) data for a given ObsID - data was pre-processed\n by NICERsoft!\n\n obsid - Observation ID of the object of interest (10-digit str)\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)\n tbin_s... | [
{
"param": "obsid",
"type": null
},
{
"param": "par_list",
"type": null
},
{
"param": "tbin_size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "par_list",
"type": null,
"docstring": null,
"docstring_token... |
d4565632bdc488e8ee858f86982bdc9f7a4445a3 | masonng-astro/nicerpy_xrayanalysis | DEPRECATED_Lv3_average_ps_segments.py | [
"MIT"
] | Python | presto_dat | <not_specific> | def presto_dat(obsid,segment_length):
"""
Obtain the dat files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
"""
segment_dir = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/accelsearch_' + str(segment_length... |
Obtain the dat files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
| Obtain the dat files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments | [
"Obtain",
"the",
"dat",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"segment_length",
"-",
"length",
"of",
"the",
"segments"
] | def presto_dat(obsid,segment_length):
segment_dir = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/accelsearch_' + str(segment_length) + 's/'
dat_files = sorted(glob.glob(segment_dir + '*.dat'))
return dat_files | [
"def",
"presto_dat",
"(",
"obsid",
",",
"segment_length",
")",
":",
"segment_dir",
"=",
"Lv0_dirs",
".",
"NICERSOFT_DATADIR",
"+",
"obsid",
"+",
"'_pipe/accelsearch_'",
"+",
"str",
"(",
"segment_length",
")",
"+",
"'s/'",
"dat_files",
"=",
"sorted",
"(",
"glob... | Obtain the dat files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments | [
"Obtain",
"the",
"dat",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"segment_length",
"-",
"length",
"of",
"the",
"segments"
] | [
"\"\"\"\n Obtain the dat files that were generated from PRESTO\n\n obsid - Observation ID of the object of interest (10-digit str)\n segment_length - length of the segments\n \"\"\""
] | [
{
"param": "obsid",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docstring... |
d4565632bdc488e8ee858f86982bdc9f7a4445a3 | masonng-astro/nicerpy_xrayanalysis | DEPRECATED_Lv3_average_ps_segments.py | [
"MIT"
] | Python | presto_FFT | <not_specific> | def presto_FFT(obsid,segment_length):
"""
Obtain the FFT files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
"""
segment_dir = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/accelsearch_' + str(segment_length... |
Obtain the FFT files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
| Obtain the FFT files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments | [
"Obtain",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"segment_length",
"-",
"length",
"of",
"the",
"segments"
] | def presto_FFT(obsid,segment_length):
segment_dir = Lv0_dirs.NICERSOFT_DATADIR + obsid + '_pipe/accelsearch_' + str(segment_length) + 's/'
fft_files = sorted(glob.glob(segment_dir + '*.fft'))
return fft_files | [
"def",
"presto_FFT",
"(",
"obsid",
",",
"segment_length",
")",
":",
"segment_dir",
"=",
"Lv0_dirs",
".",
"NICERSOFT_DATADIR",
"+",
"obsid",
"+",
"'_pipe/accelsearch_'",
"+",
"str",
"(",
"segment_length",
")",
"+",
"'s/'",
"fft_files",
"=",
"sorted",
"(",
"glob... | Obtain the FFT files that were generated from PRESTO
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments | [
"Obtain",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"segment_length",
"-",
"length",
"of",
"the",
"segments"
] | [
"\"\"\"\n Obtain the FFT files that were generated from PRESTO\n\n obsid - Observation ID of the object of interest (10-digit str)\n segment_length - length of the segments\n \"\"\""
] | [
{
"param": "obsid",
"type": null
},
{
"param": "segment_length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docstring... |
d4565632bdc488e8ee858f86982bdc9f7a4445a3 | masonng-astro/nicerpy_xrayanalysis | DEPRECATED_Lv3_average_ps_segments.py | [
"MIT"
] | Python | average_ps_presto_segments | <not_specific> | def average_ps_presto_segments(obsid,segment_length,threshold):
"""
Do averaged power spectra from the FFT files that were generated from PRESTO!
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
threshold - if data is under threshold (in percen... |
Do averaged power spectra from the FFT files that were generated from PRESTO!
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
threshold - if data is under threshold (in percentage), then throw OUT the segment!
| Do averaged power spectra from the FFT files that were generated from PRESTO.
obsid - Observation ID of the object of interest (10-digit str)
segment_length - length of the segments
threshold - if data is under threshold (in percentage), then throw OUT the segment! | [
"Do",
"averaged",
"power",
"spectra",
"from",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO",
".",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"segment_length",
"-",... | def average_ps_presto_segments(obsid,segment_length,threshold):
fft_files = presto_FFT(obsid,segment_length)
dat_files = presto_dat(obsid,segment_length)
counts_test = np.fromfile(dat_files[0],dtype='<f',count=-1)
t_test = np.linspace(0,segment_length,len(counts_test))
t_bins_threshold = np.arange... | [
"def",
"average_ps_presto_segments",
"(",
"obsid",
",",
"segment_length",
",",
"threshold",
")",
":",
"fft_files",
"=",
"presto_FFT",
"(",
"obsid",
",",
"segment_length",
")",
"dat_files",
"=",
"presto_dat",
"(",
"obsid",
",",
"segment_length",
")",
"counts_test",... | Do averaged power spectra from the FFT files that were generated from PRESTO! | [
"Do",
"averaged",
"power",
"spectra",
"from",
"the",
"FFT",
"files",
"that",
"were",
"generated",
"from",
"PRESTO!"
] | [
"\"\"\"\n Do averaged power spectra from the FFT files that were generated from PRESTO!\n\n obsid - Observation ID of the object of interest (10-digit str)\n segment_length - length of the segments\n threshold - if data is under threshold (in percentage), then throw OUT the segment!\n \"\"\"",
"#ge... | [
{
"param": "obsid",
"type": null
},
{
"param": "segment_length",
"type": null
},
{
"param": "threshold",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "segment_length",
"type": null,
"docstring": null,
"docstring... |
a5c52e5d2b1275b0b19e03bd8a491efea4c2230d | masonng-astro/nicerpy_xrayanalysis | Lv3_calc_deadtime.py | [
"MIT"
] | Python | deadtime | <not_specific> | def deadtime(obsid,mpu_no,par_list):
"""
Calculate the accumulated deadtime for a given observation ID
obsid - Observation ID of the object of interest (10-digit str)
mpu_no - Will be '7' for the combined file
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from e... |
Calculate the accumulated deadtime for a given observation ID
obsid - Observation ID of the object of interest (10-digit str)
mpu_no - Will be '7' for the combined file
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
| Calculate the accumulated deadtime for a given observation ID
obsid - Observation ID of the object of interest (10-digit str)
mpu_no - Will be '7' for the combined file
par_list - A list of parameters we'd like to extract from the FITS file | [
"Calculate",
"the",
"accumulated",
"deadtime",
"for",
"a",
"given",
"observation",
"ID",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"mpu_no",
"-",
"Will",
"be",
"'",
"7",
"'",
"for",
... | def deadtime(obsid,mpu_no,par_list):
datadict = Lv0_call_ufa.get_ufa(obsid,mpu_no,par_list)
times = datadict['TIME']
deadtimes = datadict['DEADTIME']
gtis = Lv1_data_gtis.raw_ufa_gtis(obsid,mpu_no)
obs_deadtime = 0
gti_exposure = 0
count = 0
for i in range(len(gtis)):
gti_lower... | [
"def",
"deadtime",
"(",
"obsid",
",",
"mpu_no",
",",
"par_list",
")",
":",
"datadict",
"=",
"Lv0_call_ufa",
".",
"get_ufa",
"(",
"obsid",
",",
"mpu_no",
",",
"par_list",
")",
"times",
"=",
"datadict",
"[",
"'TIME'",
"]",
"deadtimes",
"=",
"datadict",
"["... | Calculate the accumulated deadtime for a given observation ID
obsid - Observation ID of the object of interest (10-digit str)
mpu_no - Will be '7' for the combined file
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,) | [
"Calculate",
"the",
"accumulated",
"deadtime",
"for",
"a",
"given",
"observation",
"ID",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"mpu_no",
"-",
"Will",
"be",
"'",
"7",
"'",
"for",
... | [
"\"\"\"\n Calculate the accumulated deadtime for a given observation ID\n\n obsid - Observation ID of the object of interest (10-digit str)\n mpu_no - Will be '7' for the combined file\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)... | [
{
"param": "obsid",
"type": null
},
{
"param": "mpu_no",
"type": null
},
{
"param": "par_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mpu_no",
"type": null,
"docstring": null,
"docstring_tokens"... |
a5c52e5d2b1275b0b19e03bd8a491efea4c2230d | masonng-astro/nicerpy_xrayanalysis | Lv3_calc_deadtime.py | [
"MIT"
] | Python | exposure | <not_specific> | def exposure(obsid,bary,par_list):
"""
Get the on-source, exposure time
obsid - Observation ID of the object of interest (10-digit str)
bary - Whether the data is barycentered. True/False
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME,... |
Get the on-source, exposure time
obsid - Observation ID of the object of interest (10-digit str)
bary - Whether the data is barycentered. True/False
par_list - A list of parameters we'd like to extract from the FITS file
(e.g., from eventcl, PI_FAST, TIME, PI,)
| Get the on-source, exposure time
obsid - Observation ID of the object of interest (10-digit str)
bary - Whether the data is barycentered. True/False
par_list - A list of parameters we'd like to extract from the FITS file | [
"Get",
"the",
"on",
"-",
"source",
"exposure",
"time",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"bary",
"-",
"Whether",
"the",
"data",
"is",
"barycentered",
".",
"True",
"/",
"Fals... | def exposure(obsid,bary,par_list):
datadict = Lv0_call_eventcl.get_eventcl(obsid,bary,par_list)
times = datadict['TIME']
gtis = Lv1_data_gtis.raw_gtis(obsid,bary)
gti_exposure = 0
count = 0
for i in range(len(gtis)):
gti_lowerbound = gtis[i][0]
gti_upperbound = gtis[i][1]
... | [
"def",
"exposure",
"(",
"obsid",
",",
"bary",
",",
"par_list",
")",
":",
"datadict",
"=",
"Lv0_call_eventcl",
".",
"get_eventcl",
"(",
"obsid",
",",
"bary",
",",
"par_list",
")",
"times",
"=",
"datadict",
"[",
"'TIME'",
"]",
"gtis",
"=",
"Lv1_data_gtis",
... | Get the on-source, exposure time
obsid - Observation ID of the object of interest (10-digit str)
bary - Whether the data is barycentered. | [
"Get",
"the",
"on",
"-",
"source",
"exposure",
"time",
"obsid",
"-",
"Observation",
"ID",
"of",
"the",
"object",
"of",
"interest",
"(",
"10",
"-",
"digit",
"str",
")",
"bary",
"-",
"Whether",
"the",
"data",
"is",
"barycentered",
"."
] | [
"\"\"\"\n Get the on-source, exposure time\n\n obsid - Observation ID of the object of interest (10-digit str)\n bary - Whether the data is barycentered. True/False\n par_list - A list of parameters we'd like to extract from the FITS file\n (e.g., from eventcl, PI_FAST, TIME, PI,)\n \"\"\"",
"#f... | [
{
"param": "obsid",
"type": null
},
{
"param": "bary",
"type": null
},
{
"param": "par_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obsid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bary",
"type": null,
"docstring": null,
"docstring_tokens": ... |
6601e054fb9423eea44666954a47d1fba4ec8647 | masonng-astro/nicerpy_xrayanalysis | test_timing.py | [
"MIT"
] | Python | fit_to_linear | <not_specific> | def fit_to_linear(eventfile,f_pulse,shift,T0):
"""
Fitting the phases to a linear phase model
eventfile - path to the event file.
f_pulse - the frequency of the pulse
shift - how much to shift the pulse by in the phase axis.
T0 - some reference T0 time
"""
raw_times = fits.open(eventfil... |
Fitting the phases to a linear phase model
eventfile - path to the event file.
f_pulse - the frequency of the pulse
shift - how much to shift the pulse by in the phase axis.
T0 - some reference T0 time
| Fitting the phases to a linear phase model
eventfile - path to the event file.
f_pulse - the frequency of the pulse
shift - how much to shift the pulse by in the phase axis.
T0 - some reference T0 time | [
"Fitting",
"the",
"phases",
"to",
"a",
"linear",
"phase",
"model",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
".",
"f_pulse",
"-",
"the",
"frequency",
"of",
"the",
"pulse",
"shift",
"-",
"how",
"much",
"to",
"shift",
"the",
"pulse",
"by",
... | def fit_to_linear(eventfile,f_pulse,shift,T0):
raw_times = fits.open(eventfile)[1].data['TIME']
times = raw_times - raw_times[0]
phases = get_phases(eventfile,f_pulse,shift)
popt,pcov = curve_fit(linear_f,times,phases,p0=[shift,f_pulse,T0],bounds=([0.3,0.2085,40],[0.5,0.2095,60]))
return popt,np.sqr... | [
"def",
"fit_to_linear",
"(",
"eventfile",
",",
"f_pulse",
",",
"shift",
",",
"T0",
")",
":",
"raw_times",
"=",
"fits",
".",
"open",
"(",
"eventfile",
")",
"[",
"1",
"]",
".",
"data",
"[",
"'TIME'",
"]",
"times",
"=",
"raw_times",
"-",
"raw_times",
"[... | Fitting the phases to a linear phase model
eventfile - path to the event file. | [
"Fitting",
"the",
"phases",
"to",
"a",
"linear",
"phase",
"model",
"eventfile",
"-",
"path",
"to",
"the",
"event",
"file",
"."
] | [
"\"\"\"\n Fitting the phases to a linear phase model\n\n eventfile - path to the event file.\n f_pulse - the frequency of the pulse\n shift - how much to shift the pulse by in the phase axis.\n T0 - some reference T0 time\n \"\"\""
] | [
{
"param": "eventfile",
"type": null
},
{
"param": "f_pulse",
"type": null
},
{
"param": "shift",
"type": null
},
{
"param": "T0",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eventfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f_pulse",
"type": null,
"docstring": null,
"docstring_to... |
4c87f7326dbb99f03fd5057fab93d017e824ed43 | ATNIO/dbot-server | dbot-server/microraiden/client/atn.py | [
"MIT"
] | Python | _request_resource | Tuple[Union[None, Response], bool] | def _request_resource(
self,
method: str,
url: str,
**kwargs
) -> Tuple[Union[None, Response], bool]:
"""
Performs a simple GET request to the HTTP server with headers representing the given
channel state.
"""
headers = Munch()
... |
Performs a simple GET request to the HTTP server with headers representing the given
channel state.
| Performs a simple GET request to the HTTP server with headers representing the given
channel state. | [
"Performs",
"a",
"simple",
"GET",
"request",
"to",
"the",
"HTTP",
"server",
"with",
"headers",
"representing",
"the",
"given",
"channel",
"state",
"."
] | def _request_resource(
self,
method: str,
url: str,
**kwargs
) -> Tuple[Union[None, Response], bool]:
headers = Munch()
headers.contract_address = self.client.context.channel_manager.address
if self.channel is not None:
headers.bala... | [
"def",
"_request_resource",
"(",
"self",
",",
"method",
":",
"str",
",",
"url",
":",
"str",
",",
"**",
"kwargs",
")",
"->",
"Tuple",
"[",
"Union",
"[",
"None",
",",
"Response",
"]",
",",
"bool",
"]",
":",
"headers",
"=",
"Munch",
"(",
")",
"headers... | Performs a simple GET request to the HTTP server with headers representing the given
channel state. | [
"Performs",
"a",
"simple",
"GET",
"request",
"to",
"the",
"HTTP",
"server",
"with",
"headers",
"representing",
"the",
"given",
"channel",
"state",
"."
] | [
"\"\"\"\n Performs a simple GET request to the HTTP server with headers representing the given\n channel state.\n \"\"\"",
"# user requested abort"
] | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": "str"
},
{
"param": "url",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": "str",
"docstring": null,
"docstring_tokens"... |
4c87f7326dbb99f03fd5057fab93d017e824ed43 | ATNIO/dbot-server | dbot-server/microraiden/client/atn.py | [
"MIT"
] | Python | on_http_response | bool | def on_http_response(self, method: str, url: str, response: Response, **kwargs) -> bool:
"""Called whenever server returns a reply.
Return False to abort current request."""
log.debug('Response received: {}'.format(response.headers))
return True | Called whenever server returns a reply.
Return False to abort current request. | Called whenever server returns a reply.
Return False to abort current request. | [
"Called",
"whenever",
"server",
"returns",
"a",
"reply",
".",
"Return",
"False",
"to",
"abort",
"current",
"request",
"."
] | def on_http_response(self, method: str, url: str, response: Response, **kwargs) -> bool:
log.debug('Response received: {}'.format(response.headers))
return True | [
"def",
"on_http_response",
"(",
"self",
",",
"method",
":",
"str",
",",
"url",
":",
"str",
",",
"response",
":",
"Response",
",",
"**",
"kwargs",
")",
"->",
"bool",
":",
"log",
".",
"debug",
"(",
"'Response received: {}'",
".",
"format",
"(",
"response",... | Called whenever server returns a reply. | [
"Called",
"whenever",
"server",
"returns",
"a",
"reply",
"."
] | [
"\"\"\"Called whenever server returns a reply.\n Return False to abort current request.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": "str"
},
{
"param": "url",
"type": "str"
},
{
"param": "response",
"type": "Response"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": "str",
"docstring": null,
"docstring_tokens"... |
a0730eaf63be42e21d7accf698ca75bd8c84813c | ATNIO/dbot-server | dbot-server/app/api/dbots/v1.py | [
"MIT"
] | Python | post | <not_specific> | def post(self):
"""
New a Dbot
This API need authorization with signature in headers
"""
# TODO request data valid check
profile = request.files['profile']
specification = request.files['specification']
form = request.form
dbot_data = json.load(pro... |
New a Dbot
This API need authorization with signature in headers
| New a Dbot
This API need authorization with signature in headers | [
"New",
"a",
"Dbot",
"This",
"API",
"need",
"authorization",
"with",
"signature",
"in",
"headers"
] | def post(self):
profile = request.files['profile']
specification = request.files['specification']
form = request.form
dbot_data = json.load(profile)
domain = form.get('domain', dbot_data['info'].get('domain'))
if domain is None:
abort(400, message="DBot domain... | [
"def",
"post",
"(",
"self",
")",
":",
"profile",
"=",
"request",
".",
"files",
"[",
"'profile'",
"]",
"specification",
"=",
"request",
".",
"files",
"[",
"'specification'",
"]",
"form",
"=",
"request",
".",
"form",
"dbot_data",
"=",
"json",
".",
"load",
... | New a Dbot
This API need authorization with signature in headers | [
"New",
"a",
"Dbot",
"This",
"API",
"need",
"authorization",
"with",
"signature",
"in",
"headers"
] | [
"\"\"\"\n New a Dbot\n This API need authorization with signature in headers\n \"\"\"",
"# TODO request data valid check"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33a7fdb883ab969e935c8d2dc11d9edda9a5922f | ATNIO/dbot-server | dbot-server/dbot/service.py | [
"MIT"
] | Python | generate_headers | <not_specific> | def generate_headers(self, price: int):
assert price > 0
"""Generate basic headers that are sent back for every request"""
headers = {
HTTPHeaders.GATEWAY_PATH: constants.API_PATH,
HTTPHeaders.RECEIVER_ADDRESS: self.receiver_address,
HTTPHeaders.CONTRACT_ADDRE... | Generate basic headers that are sent back for every request | Generate basic headers that are sent back for every request | [
"Generate",
"basic",
"headers",
"that",
"are",
"sent",
"back",
"for",
"every",
"request"
] | def generate_headers(self, price: int):
assert price > 0
headers = {
HTTPHeaders.GATEWAY_PATH: constants.API_PATH,
HTTPHeaders.RECEIVER_ADDRESS: self.receiver_address,
HTTPHeaders.CONTRACT_ADDRESS: self.contract_address,
HTTPHeaders.PRICE: price,
... | [
"def",
"generate_headers",
"(",
"self",
",",
"price",
":",
"int",
")",
":",
"assert",
"price",
">",
"0",
"headers",
"=",
"{",
"HTTPHeaders",
".",
"GATEWAY_PATH",
":",
"constants",
".",
"API_PATH",
",",
"HTTPHeaders",
".",
"RECEIVER_ADDRESS",
":",
"self",
"... | Generate basic headers that are sent back for every request | [
"Generate",
"basic",
"headers",
"that",
"are",
"sent",
"back",
"for",
"every",
"request"
] | [
"\"\"\"Generate basic headers that are sent back for every request\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "price",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "price",
"type": "int",
"docstring": null,
"docstring_tokens":... |
cdc2cd1c5a9ec392f7eeb0f65392840a8a105401 | qize/ionic_liquids | ionic_liquids/utils.py | [
"MIT"
] | Python | train_model | <not_specific> | def train_model(model, data_file, test_percent, save=True):
"""
Choose the regression model
Input
------
model: string, the model to use
data_file: dataframe, cleaned csv data
test_percent: float, the percentage of data held for testing
Returns
------
obj: objective, the regres... |
Choose the regression model
Input
------
model: string, the model to use
data_file: dataframe, cleaned csv data
test_percent: float, the percentage of data held for testing
Returns
------
obj: objective, the regressor
X: dataframe, normlized input feature
y: targeted elect... | Choose the regression model
Input
string, the model to use
data_file: dataframe, cleaned csv data
test_percent: float, the percentage of data held for testing
Returns
objective, the regressor
X: dataframe, normlized input feature
y: targeted electrical conductivity | [
"Choose",
"the",
"regression",
"model",
"Input",
"string",
"the",
"model",
"to",
"use",
"data_file",
":",
"dataframe",
"cleaned",
"csv",
"data",
"test_percent",
":",
"float",
"the",
"percentage",
"of",
"data",
"held",
"for",
"testing",
"Returns",
"objective",
... | def train_model(model, data_file, test_percent, save=True):
df, y_error = read_data(data_file)
X, y = molecular_descriptors(df)
X_train, X_test, y_train, y_test = \
train_test_split(X, y, test_size=(test_percent/100))
X_train, X_mean, X_std = normalization(X_train)
model = model.replace(' ',... | [
"def",
"train_model",
"(",
"model",
",",
"data_file",
",",
"test_percent",
",",
"save",
"=",
"True",
")",
":",
"df",
",",
"y_error",
"=",
"read_data",
"(",
"data_file",
")",
"X",
",",
"y",
"=",
"molecular_descriptors",
"(",
"df",
")",
"X_train",
",",
"... | Choose the regression model
Input | [
"Choose",
"the",
"regression",
"model",
"Input"
] | [
"\"\"\"\n Choose the regression model\n\n Input\n ------\n model: string, the model to use\n data_file: dataframe, cleaned csv data\n test_percent: float, the percentage of data held for testing\n\n Returns\n ------\n obj: objective, the regressor\n X: dataframe, normlized input featur... | [
{
"param": "model",
"type": null
},
{
"param": "data_file",
"type": null
},
{
"param": "test_percent",
"type": null
},
{
"param": "save",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_file",
"type": null,
"docstring": null,
"docstring_toke... |
cdc2cd1c5a9ec392f7eeb0f65392840a8a105401 | qize/ionic_liquids | ionic_liquids/utils.py | [
"MIT"
] | Python | normalization | <not_specific> | def normalization(data, means=None, stdevs=None):
"""
Normalizes the data using the means and standard
deviations given, calculating them otherwise.
Returns the means and standard deviations of columns.
Inputs
------
data : Pandas DataFrame
means : optional numpy argument of column mean... |
Normalizes the data using the means and standard
deviations given, calculating them otherwise.
Returns the means and standard deviations of columns.
Inputs
------
data : Pandas DataFrame
means : optional numpy argument of column means
stdevs : optional numpy argument of column st. devs... | Normalizes the data using the means and standard
deviations given, calculating them otherwise.
Returns the means and standard deviations of columns.
Inputs
data : Pandas DataFrame
means : optional numpy argument of column means
stdevs : optional numpy argument of column st. devs
Returns
normed : the normalized Data... | [
"Normalizes",
"the",
"data",
"using",
"the",
"means",
"and",
"standard",
"deviations",
"given",
"calculating",
"them",
"otherwise",
".",
"Returns",
"the",
"means",
"and",
"standard",
"deviations",
"of",
"columns",
".",
"Inputs",
"data",
":",
"Pandas",
"DataFrame... | def normalization(data, means=None, stdevs=None):
cols = data.columns
data = data.values
if (means is None) or (stdevs is None):
means = np.mean(data, axis=0)
stdevs = np.std(data, axis=0, ddof=1)
else:
means = np.array(means)
stdevs = np.array(stdevs)
if (len(data.sh... | [
"def",
"normalization",
"(",
"data",
",",
"means",
"=",
"None",
",",
"stdevs",
"=",
"None",
")",
":",
"cols",
"=",
"data",
".",
"columns",
"data",
"=",
"data",
".",
"values",
"if",
"(",
"means",
"is",
"None",
")",
"or",
"(",
"stdevs",
"is",
"None",... | Normalizes the data using the means and standard
deviations given, calculating them otherwise. | [
"Normalizes",
"the",
"data",
"using",
"the",
"means",
"and",
"standard",
"deviations",
"given",
"calculating",
"them",
"otherwise",
"."
] | [
"\"\"\"\n Normalizes the data using the means and standard\n deviations given, calculating them otherwise.\n Returns the means and standard deviations of columns.\n\n Inputs\n ------\n data : Pandas DataFrame\n means : optional numpy argument of column means\n stdevs : optional numpy argumen... | [
{
"param": "data",
"type": null
},
{
"param": "means",
"type": null
},
{
"param": "stdevs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "means",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cdc2cd1c5a9ec392f7eeb0f65392840a8a105401 | qize/ionic_liquids | ionic_liquids/utils.py | [
"MIT"
] | Python | molecular_descriptors | <not_specific> | def molecular_descriptors(data,descs):
"""
Use RDKit to prepare the molecular descriptor
Inputs
------
data: dataframe, cleaned csv data
Returns
------
prenorm_X: normalized input features
Y: experimental electrical conductivity
"""
Y = data['Tm']
mols = list(map(Chem... |
Use RDKit to prepare the molecular descriptor
Inputs
------
data: dataframe, cleaned csv data
Returns
------
prenorm_X: normalized input features
Y: experimental electrical conductivity
| Use RDKit to prepare the molecular descriptor
Inputs
dataframe, cleaned csv data
Returns
normalized input features
Y: experimental electrical conductivity | [
"Use",
"RDKit",
"to",
"prepare",
"the",
"molecular",
"descriptor",
"Inputs",
"dataframe",
"cleaned",
"csv",
"data",
"Returns",
"normalized",
"input",
"features",
"Y",
":",
"experimental",
"electrical",
"conductivity"
] | def molecular_descriptors(data,descs):
Y = data['Tm']
mols = list(map(Chem.MolFromSmiles,data['SMILES'].values))
X = use_mordred(mols,descs)
return X, Y | [
"def",
"molecular_descriptors",
"(",
"data",
",",
"descs",
")",
":",
"Y",
"=",
"data",
"[",
"'Tm'",
"]",
"mols",
"=",
"list",
"(",
"map",
"(",
"Chem",
".",
"MolFromSmiles",
",",
"data",
"[",
"'SMILES'",
"]",
".",
"values",
")",
")",
"X",
"=",
"use_... | Use RDKit to prepare the molecular descriptor
Inputs | [
"Use",
"RDKit",
"to",
"prepare",
"the",
"molecular",
"descriptor",
"Inputs"
] | [
"\"\"\"\n Use RDKit to prepare the molecular descriptor\n\n Inputs\n ------\n data: dataframe, cleaned csv data\n\n Returns\n ------\n prenorm_X: normalized input features\n Y: experimental electrical conductivity\n\n \"\"\""
] | [
{
"param": "data",
"type": null
},
{
"param": "descs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "descs",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cdc2cd1c5a9ec392f7eeb0f65392840a8a105401 | qize/ionic_liquids | ionic_liquids/utils.py | [
"MIT"
] | Python | read_data | <not_specific> | def read_data(filename):
"""
Reads data in from given file to Pandas DataFrame
Inputs
-------
filename : string of path to file
Returns
------
df : Pandas DataFrame
y_error : vector containing experimental errors
"""
cols = filename.split('.')
name = cols[0]
filety... |
Reads data in from given file to Pandas DataFrame
Inputs
-------
filename : string of path to file
Returns
------
df : Pandas DataFrame
y_error : vector containing experimental errors
| Reads data in from given file to Pandas DataFrame
Inputs
filename : string of path to file
Returns
df : Pandas DataFrame
y_error : vector containing experimental errors | [
"Reads",
"data",
"in",
"from",
"given",
"file",
"to",
"Pandas",
"DataFrame",
"Inputs",
"filename",
":",
"string",
"of",
"path",
"to",
"file",
"Returns",
"df",
":",
"Pandas",
"DataFrame",
"y_error",
":",
"vector",
"containing",
"experimental",
"errors"
] | def read_data(filename):
cols = filename.split('.')
name = cols[0]
filetype = cols[1]
if (filetype == 'csv'):
df = pd.read_csv(filename)
elif (filetype in ['xls', 'xlsx']):
df = pd.read_excel(filename)
else:
raise ValueError('Filetype not supported')
df = df.drop(df[d... | [
"def",
"read_data",
"(",
"filename",
")",
":",
"cols",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"name",
"=",
"cols",
"[",
"0",
"]",
"filetype",
"=",
"cols",
"[",
"1",
"]",
"if",
"(",
"filetype",
"==",
"'csv'",
")",
":",
"df",
"=",
"pd",
... | Reads data in from given file to Pandas DataFrame
Inputs | [
"Reads",
"data",
"in",
"from",
"given",
"file",
"to",
"Pandas",
"DataFrame",
"Inputs"
] | [
"\"\"\"\n Reads data in from given file to Pandas DataFrame\n\n Inputs\n -------\n filename : string of path to file\n\n Returns\n ------\n df : Pandas DataFrame\n y_error : vector containing experimental errors\n\n \"\"\"",
"# clean the data if necessary"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cdc2cd1c5a9ec392f7eeb0f65392840a8a105401 | qize/ionic_liquids | ionic_liquids/utils.py | [
"MIT"
] | Python | read_model | <not_specific> | def read_model(file_dir):
"""
Read the trained regressor to
avoid repeating training.
Input
------
file_dir : the directory containing all model info
Returns
------
obj: model object
X_mean : mean of columns in training X
X_stdev : stdev of columns in training X
X : pre... |
Read the trained regressor to
avoid repeating training.
Input
------
file_dir : the directory containing all model info
Returns
------
obj: model object
X_mean : mean of columns in training X
X_stdev : stdev of columns in training X
X : predictor matrix (if it exists) othe... | Read the trained regressor to
avoid repeating training.
Input
file_dir : the directory containing all model info
Returns
model object
X_mean : mean of columns in training X
X_stdev : stdev of columns in training X
X : predictor matrix (if it exists) otherwise None
y : response vector (if it exists) otherwise None | [
"Read",
"the",
"trained",
"regressor",
"to",
"avoid",
"repeating",
"training",
".",
"Input",
"file_dir",
":",
"the",
"directory",
"containing",
"all",
"model",
"info",
"Returns",
"model",
"object",
"X_mean",
":",
"mean",
"of",
"columns",
"in",
"training",
"X",... | def read_model(file_dir):
filename = file_dir + '/model.pkl'
obj = joblib.load(filename)
X_mean = joblib.load(file_dir+'/X_mean.pkl')
X_stdev = joblib.load(file_dir+'/X_stdev.pkl')
try:
X = joblib.load(file_dir + '/X_data.pkl')
except:
X = None
try:
y = joblib.load(fi... | [
"def",
"read_model",
"(",
"file_dir",
")",
":",
"filename",
"=",
"file_dir",
"+",
"'/model.pkl'",
"obj",
"=",
"joblib",
".",
"load",
"(",
"filename",
")",
"X_mean",
"=",
"joblib",
".",
"load",
"(",
"file_dir",
"+",
"'/X_mean.pkl'",
")",
"X_stdev",
"=",
"... | Read the trained regressor to
avoid repeating training. | [
"Read",
"the",
"trained",
"regressor",
"to",
"avoid",
"repeating",
"training",
"."
] | [
"\"\"\"\n Read the trained regressor to\n avoid repeating training.\n\n Input\n ------\n file_dir : the directory containing all model info\n\n Returns\n ------\n obj: model object\n X_mean : mean of columns in training X\n X_stdev : stdev of columns in training X\n X : predictor ma... | [
{
"param": "file_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.