@algunion @kellertuer Good night ![]()
see changes.I will respond tomorrow .
Summary
using HTTP, CSV, DataFrames
function doanalysis()
dfg=nothing
function change(df)
name=names(df)
list = ["time", "Tmid", "T0", "t-T0", "t-to"] # rename to "Time"
listb = ["mag", "Limit", "Magnitude", "OT", "magn"]
for i in 1:length(name)
if name[i] in list ; rename!(df,Dict("name[i]"=>"Time")); end
if name[i] in listb ; rename!(df,Dict("name[i]"=>"Mag")); end
i=+1
end
end
for x in 31520
print("\r peeking at GCN $x ")
try
url = "https://gcn.nasa.gov/circulars/$x.txt"
resp = HTTP.get(url)
status=resp.status
print(" ",status," ");
if status == 404 ; println("status=",status); continue; end
txt = String(resp.body)
grb_rexp=r"GRB ?\d{6}([A-G]|(\.\d{2}))?"
m=match(grb_rexp,txt)
grb="nogrb"
if occursin(grb_rexp,txt)
print(m.match)
grb=m.match
end
if occursin("IKI", txt)
println(" IKI report")
he=first(findfirst(r"^(Date)|(UT start)|(T0+)"m,txt))
lr=first(findnext(r"^\nThe |(Photometry)"m,txt,he))-1
cltxt=replace(txt[he:lr], ","=>" ",r"(�+)"=>" " , "+/-"=>" ",">"=>" ","(mid)"=>" ",r"UT ?start"i=>"UT_start")
df=CSV.read(IOBuffer(cltxt), DataFrame, skipto=3, delim=" ", ignorerepeated=true)
df.GCN=[x for i in 1:nrow(df)]
df.GRB=[m.match for i in 1:nrow(df)]
change(df)
if isnothing(dfg)
dfg=df
else
@show dfg=vcat(dfg,df,cols=:union)
end # if x is first
end # if occursin
catch e
rethrow(e)
end # trycatch
end # for loop
end
doanalysis()
