custom_dmc #37

Merged
deepak merged 2 commits from custom_dmc into master 2024-03-20 16:27:22 +00:00
5 changed files with 789 additions and 239 deletions
Showing only changes of commit 383b51c35d - Show all commits

View File

@@ -125,7 +125,7 @@ def get_a_result_fast_filter_tarucha_spin_qubit_pair_phase_only(input) -> int:
r1s = dot_pair_inputs[:, 0, 0:3] r1s = dot_pair_inputs[:, 0, 0:3]
r2s = dot_pair_inputs[:, 1, 0:3] r2s = dot_pair_inputs[:, 1, 0:3]
f1s = dot_pair_inputs[:, 0, 3] f1s = dot_pair_inputs[:, 0, 3]
# Don't actually need this # don't actually need, because we're assuming they're the same frequencies across the pair
# f2s = dot_pair_inputs[:, 1, 3] # f2s = dot_pair_inputs[:, 1, 3]
diffses1 = r1s[:, None] - ss[:, None, :] diffses1 = r1s[:, None] - ss[:, None, :]

145
flake.lock generated
View File

@@ -1,28 +1,33 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1648297722, "lastModified": 1710146030,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": { "locked": {
"lastModified": 1653893745, "lastModified": 1705309234,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -31,29 +36,34 @@
"type": "github" "type": "github"
} }
}, },
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"poetry2nixSrc",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703863825,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1655087213, "lastModified": 1710703777,
"narHash": "sha256-4R5oQ+OwGAAcXWYrxC4gFMTUSstGxaN8kN7e8hkum/8=", "narHash": "sha256-M4CNAgjrtvrxIWIAc98RTYcVFoAgwUhrYekeiMScj18=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "37b6b161e536fddca54424cf80662bce735bdd1e", "rev": "fc7885fbcea4b782142e06ce2d4d08cf92862004",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "37b6b161e536fddca54424cf80662bce735bdd1e",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1655046959,
"narHash": "sha256-gxqHZKq1ReLDe6ZMJSbmSZlLY95DsVq5o6jQihhzvmw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "07bf3d25ce1da3bee6703657e6a787a4c6cdcea9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -62,23 +72,27 @@
"type": "github" "type": "github"
} }
}, },
"poetry2nix": { "poetry2nixSrc": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2" "nix-github-actions": "nix-github-actions",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_3",
"treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1654921554, "lastModified": 1708589824,
"narHash": "sha256-hkfMdQAHSwLWlg0sBVvgrQdIiBP45U1/ktmFpY4g2Mo=", "narHash": "sha256-2GOiFTkvs5MtVF65sC78KNVxQSmsxtk0WmV1wJ9V2ck=",
"owner": "nix-community", "owner": "nix-community",
"repo": "poetry2nix", "repo": "poetry2nix",
"rev": "7b71679fa7df00e1678fc3f1d1d4f5f372341b63", "rev": "3c92540611f42d3fb2d0d084a6c694cd6544b609",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"repo": "poetry2nix", "repo": "poetry2nix",
"rev": "7b71679fa7df00e1678fc3f1d1d4f5f372341b63",
"type": "github" "type": "github"
} }
}, },
@@ -86,7 +100,72 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix" "poetry2nixSrc": "poetry2nixSrc"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"id": "systems",
"type": "indirect"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"poetry2nixSrc",
"nixpkgs"
]
},
"locked": {
"lastModified": 1708335038,
"narHash": "sha256-ETLZNFBVCabo7lJrpjD6cAbnE11eDOjaQnznmg/6hAE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "e504621290a1fd896631ddbc5e9c16f4366c9f65",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
} }
} }
}, },

View File

@@ -1,63 +1,46 @@
{ {
description = "Application packaged using poetry2nix"; description = "Application packaged using poetry2nix";
inputs.flake-utils.url = "github:numtide/flake-utils?rev=0f8662f1319ad6abf89b3380dd2722369fc51ade"; inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=37b6b161e536fddca54424cf80662bce735bdd1e"; inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.poetry2nix.url = "github:nix-community/poetry2nix?rev=7b71679fa7df00e1678fc3f1d1d4f5f372341b63"; inputs.poetry2nixSrc = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }: outputs = { self, nixpkgs, flake-utils, poetry2nixSrc }:
{ flake-utils.lib.eachDefaultSystem (system:
# Nixpkgs overlay providing the application
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(final: prev: {
# The application
deepdog = prev.poetry2nix.mkPoetryApplication {
overrides = final.poetry2nix.overrides.withDefaults (self: super: {
# …
# workaround https://github.com/nix-community/poetry2nix/issues/568
pdme = super.pdme.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ final.python39.pkgs.poetry-core ];
});
});
projectDir = ./.;
};
deepdogEnv = prev.poetry2nix.mkPoetryEnv {
overrides = final.poetry2nix.overrides.withDefaults (self: super: {
# …
# workaround https://github.com/nix-community/poetry2nix/issues/568
pdme = super.pdme.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ final.python39.pkgs.poetry-core ];
});
});
projectDir = ./.;
};
})
];
} // (flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { pkgs = nixpkgs.legacyPackages.${system};
inherit system; poetry2nix = poetry2nixSrc.lib.mkPoetry2Nix { inherit pkgs; };
overlays = [ self.overlay ]; in {
}; packages = {
in deepdogApp = poetry2nix.mkPoetryApplication {
{ projectDir = self;
apps = { python = pkgs.python39;
deepdog = pkgs.deepdog; preferWheels = true;
}; };
deepdogEnv = poetry2nix.mkPoetryEnv {
defaultApp = pkgs.deepdog; projectDir = self;
devShell = pkgs.mkShell { python = pkgs.python39;
buildInputs = [ preferWheels = true;
pkgs.poetry overrides = poetry2nix.overrides.withDefaults (self: super: {
pkgs.deepdogEnv });
pkgs.deepdog };
]; default = self.packages.${system}.deepdogEnv;
shellHook = '' };
export DO_NIX_CUSTOM=1 devShells.default = pkgs.mkShell {
''; inputsFrom = [ self.packages.${system}.deepdogEnv ];
packages = [ pkgs.nodejs-16_x ]; buildInputs = [
}; pkgs.poetry
self.packages.${system}.deepdogEnv
})); self.packages.${system}.deepdogApp
pkgs.just
];
shellHook = ''
export DO_NIX_CUSTOM=1
'';
};
}
);
} }

53
justfile Normal file
View File

@@ -0,0 +1,53 @@
# execute default build
default: build
# builds the python module using poetry
build:
echo "building..."
poetry build
# print a message displaying whether nix is being used
checknix:
#!/usr/bin/env bash
set -euxo pipefail
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
echo "In an interactive nix env."
else
echo "Using poetry as runner, no nix detected."
fi
# run all tests
test: fmt
#!/usr/bin/env bash
set -euxo pipefail
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
echo "testing, using nix..."
flake8 deepdog tests
mypy deepdog
pytest
else
echo "testing..."
poetry run flake8 deepdog tests
poetry run mypy deepdog
poetry run pytest
fi
# format code
fmt:
#!/usr/bin/env bash
set -euxo pipefail
if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then
black .
else
poetry run black .
fi
find . -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \;
# release the app, checking that our working tree is clean and ready for release
release:
./scripts/release.sh
htmlcov:
poetry run pytest --cov-report=html

731
poetry.lock generated

File diff suppressed because it is too large Load Diff