Skip to content

Instantly share code, notes, and snippets.

View DougBurke's full-sized avatar

Doug Burke DougBurke

View GitHub Profile
@DougBurke
DougBurke / README.md
Last active September 4, 2022 19:06
shader problem starting Distant Worlds 2 on Linux

The error message seen from running steam from the command line on a Ubuntu 22.04 machine is:

Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
GameAction [AppID 1531540, ActionID 1] : LaunchApp changed task to ShowLaunchOption with ""
GameAction [AppID 1531540, ActionID 1] : LaunchApp waiting for user response to ShowLaunchOption ""
@DougBurke
DougBurke / README.md
Last active April 6, 2022 17:43
A CSC-2 like model fitting script

Fit CSC data

Approximate the fit method used by CSC 2.

Data

The data is filtered to the 0.5 to 7 keV range and then grouped to num counts (this defaults to 15 but can be changed with the --num flag). The energy range could be made adjustable but currently it is

@DougBurke
DougBurke / bg.reg
Last active September 10, 2021 13:45
notebooks for sherpa/sherpa#1246
annulus(3147.6844,4519.83,73.123398,146.2468)
-circle(3036.4982,4611.592,18.016347)
-circle(3199.2587,4600.8753,11.875275)
-box(3148.8565,4415.5092,228.06552,49.230003,0)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DougBurke
DougBurke / .gitignore
Last active October 14, 2020 19:09
Calculating fluxes in Sherpa CIAO (for X-ray spectra)
.ipynb_checkpoints
Flux calculations for X-ray astronomy in Sherpa.html
@DougBurke
DougBurke / gist:d0ee4e37291c3066d709b57818b330c5
Created February 1, 2020 14:39
Suggested changes to eventlog2html for proposed hvega 0.5 changes
```
diff --git a/src/Eventlog/VegaTemplate.hs b/src/Eventlog/VegaTemplate.hs
index 773c916..eafafa6 100644
--- a/src/Eventlog/VegaTemplate.hs
+++ b/src/Eventlog/VegaTemplate.hs
@@ -18,8 +18,9 @@ import Data.Text.Lazy (toStrict)
-- | Workaround for some limitations in the HVega library.
-- This function should be removed once the features are merged into HVega.
-injectJSON :: Text -> Value -> BuildLabelledSpecs
@DougBurke
DougBurke / README.md
Last active January 3, 2020 20:01
Sherpa: regrid method and evaluation space mis-match

There are problems when the regrid method is called with a grid which is "too small". Consider

dataspace1d(2, 8, 0.01, dstype=Data1DInt)
rgrid1 = np.arange(2.5, 7.5, 0.005)
rgrid2 = np.arange(2.1, 9, 0.005)
rgrid3 = np.arange(1.5, 7.5, 0.005)

then using rgrid1 or rgrid2 (after turning into lo/hi bins) causes a run-time error (a mis-matchin the number of bins) as the code tries to handle the partial grid.

@DougBurke
DougBurke / README.md
Last active December 9, 2019 13:26
An attempt to document my problems (well, one of my problems) described at https://twitter.com/doug_burke/status/1203678875466784768

I would like to create a Python module which provides an interface to C++ code (in my actual use case the C++ function I want to access follows an API, and I use routines/include files provided with another Python module to create the C++-to-Python API (so the code in wrapit.cxx in this example).

The fun comes because the C++ code - here modelled so effortlessly by foo.cxx - relies on some FORTRAN code (bar.f in our little recreation play).

So, I want the FORTRAN code to be compiled and linked into the final library, but I do NOT want a Python interface to the FORTRAN code. I only want to call routines defined in the C++ code.

@DougBurke
DougBurke / SherpaQuickStart.html
Last active October 2, 2019 12:55
Sherpa "basic" notebook with notebook-output section
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>SherpaQuickStart</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
import numpy as np
from sherpa.astro import ui
# fake up a PHA data set
chans = np.arange(1, 11, dtype=np.int8)
counts = np.ones(chans.size)
# bin width is not 0.1 but something slightly different
ebins = np.linspace(0.1, 1.2, num=chans.size + 1)
elo = ebins[:-1]