text:
AliPhysics  95775ff (95775ff)
Using the TrainSetup facility

# Overview

The TrainSetup framework allows users to easily set up an analysis train which can be executed in all environments supported by ALICE.

The train definition takes the form of a class deriving from the base class TrainSetup.

Specific hooks in the base class allows users to customize the various aspects of a train. The base class also facilities to easily define parameters of the train which can be set by parsing simple command line options or strings. Furthermore, the basic setup ensures that the analysis becomes a self-contained, self-documenting unit by storing all relevant files together with the various kinds of output generated during the analysis job.

The execution environment (local, Proof, Grid) is specified as a simple URL like string, with room for environment specific options. This scheme allows a user to run the same analysis in various environments by simply changing the execution environment URL with another URL. Various helpers for each type of environment ensures that all needed steps are taken to help ensure successful execution of the analysis regardless of the underlying execution environment.

Trains defined using this framework can either be executed in an interactive AliROOT session or using a stand-alone program.

# Usage

Users should define a class that derives from TrainSetup. The class should implement the member function TrainSetup::CreateTasks to add needed tasks to the train. The derived class must also override the member function TrainSetup::ClassName to return the name of the derived class as a C-string.

// MyTrain.C
class MyTrain : public TrainSetup
{
public:
MyTrain(const char name="MyTrain")
: TrainSetup(name),
{
// fOptions.Set("type", "AOD"); // AOD input
// fOptions.Set("type", "ESD"); // ESD input
fOptions.Add("parameter", "VALUE", "Help on parameter", "value");
}
protected:
{
AliAnalysisManager::SetCommonFileName("my_analysis.root");
Bool_t mc = mgr->GetMCtruthEventHandler() != 0;
Double_t param = fOptions.AsDouble("parameter");
}
const char* ClassName() const { return "MyTrain"; }
};

(Please note, that TrainSetup does not inherit from TObject so one should not put in a call to the ClassDef macro)

# Parameters of the setup

Parameters of the user defined class deriving from TrainSetup is best handled by adding options to the internal member fOptions in the constructor e.g.,

The first 4 forms defined a parameter that has a value, while the last 2 forms defines a flag (or toggle). The values or flags can be retrieved later by doing

Double_t value = fOptions.AsDouble("<name>",<value if not set>);
Int_t value = fOptions.AsInt("<name>",<value if not set>);
Long64_t value = fOptions.AsLong("<name>",<value if not set>);
Bool_t value = fOptions.AsBool("<name>",<value if not set>)
TString value = fOptions.Get("<name>");
Bool_t value = fOptions.Has("<name>");

Parameters defined this way are directly accessible as options to pass to either runTrain or RunTrain.C

# Execution of the train

A user defined TrainSetup class can then be run like

Root> .x RunTrain.C("<class>", "<name>", "<uri>", "<options>")

or using the program runTrain

  > runTrain --class=<class> --name=<name> --url=<uri> [<options>]

Here,

<class>
is the name of the user defined class deriving from TrainSetup.
<name>
is an arbitary name to give to the train. Note, an escaped name will be generated from this, which replaces all spaces and the like with '_' and (optionally) with the date and time appended.
<uri>
is the job execution URI which specified both the execution environment and the input data, as well as some options. See more below.
<options>
is a list of options. For RunTrain this is a comma separated list of options in the form <option>=<value> for value options and <option> for flags (booleans). For runTrain, the options are of the traditional Unix long type: --<option>=<value> and --<option>. The exact list of options for a given train can be listed by passing the option help.

In both cases, a new sub-directory called escaped name of the train is created, and various files are copied there - depending on the mode of execution.

For local analysis, no aditional files are copied there, but the output will be put there.

For PROOF analysis, the needed PAR files are copied there and expanded. The output of the job may end up in this directory if so instructed.

For Grid analysis, various JDL and steering scripts are copied to this directory. Scripts to run merge/terminate stages and to download the results are also generated for the users convinence. The special generated script Watch.C will monitor the progess of the jobs and automatically execute the needed merging and terminate stages. Various files needed by the train are copied to the Grid working directory as a form of documentation.

In all cases, a file named ReRun.C (and for runTrain: rerun.sh) is generated in this sub-directory. It contains the setting used for the train and can easily be used to run jobs again as well as serve as a form of documentation.

# Execution URI

This URI has the form

  <protocol>://[[<user>@]<host>]/<input>[?<options>][#<treename>]

and specifies several things.

<protocol>
One of
local
Local analysis on local data executed sequentially on the local machine
lite
Proof-Lite analysis on local data executed in parallel on the local machine
proof
Proof analysis on cluster data executed in parallel on a PROOF cluster
alien
Grid analysis on grid data executed on the Grid
[[<user>@]<host>]
Sets the master host for Proof analysis
<input>
Input data specification. The exact form depends on the protocol used e.g., for local analysis it can be a single, while for other environments it could be a data set name, and so on.
<options>
Protocol specific options
<treename>
If specified, gives what data to analyse

# PROOF specifics

Local and Grid jobs are in a sense very similar. That is, the individual Grid jobs are very much like Local jobs, in that they always produce output files (albiet not after Terminate, though parameter container files are (re)made).

PROOF jobs are very different. In a PROOF analysis, each slave only produces in memory output which is then sent via net connections (sockets) to the master. One therefore needs to be very of output object ownership and the like.

Another major difference is that output files are generated within the PROOF cluster, and are generally not accessible from the outside. For plain PROOF clusters in a local area network or so-called Lite session, it is generally not a problem since the files are accessible on the LAN or local machine for Lite sessions. However, for large scale analysis farms (AAFs), the workers and masters are generally on a in-accessible sub-net, and there's no direct access to the produced files. Now, for normal output files, like histogram files, etc. there are provisions for this, which means the final merged output is sent back to the client. Special output, such as AODs, are however not merged nor sent back to the user by default. There are two ways to deal with this:

1. Register the output tree as a data set on the cluster. This is useful if you need to process the results again on the cluster.
2. Send the output to a (possibly custom) XRootd server. This is useful if you need to process the output outside of the cluster

The first mode is specified by passing the option dsname=<name> in the cluster URI. The created dataset will normally be made in /default/<user>/<name>. If the =<name> part is left out, the escaped name of the job will be used.

The second mode is triggered by passing the option storage=URI to the train setup. The URI should be of the form

  rootd://<host>[:<port>]/<path>

where <host> is the name of a machine accessible by the cluster, <port> is an optional port number (e.g., if different from 1093), and <path> is an absolute path on <host>.

The XRootd process should be started (optionally by the user) on <host> as

  xrootd -p <port> <path>

When running jobs on AAFs, one can use the Grid handler to set-up aspects of the job. To enable the Grid handler, pass the option plugin in the execution URI

# Specifying the input

## Local and Lite data input

For both ESD and AOD input for local jobs, one must specify the root of the sub-tree that holds the data. That is, if - for example - the data resides in a directory structure like

  /some/directory/<run>/<seq>/AliESDs.root

then one should specify the input location like

  local:///some/directory[?pattern=AliESDs.root][#esdTree]
lite:///some/directory[?pattern=AliESDs.root][#esdTree]

/some/directory is then search recursively for input files that match the pattern given by the analysis type (ESD: AliESDs.root, AOD: AliAOD.root). The found files are then chained together. If MC input is specified, then the companion files galice.root, Kinematics.root, and TrackRefs.root must be found in the same directories as the AliESDs.root files

## PROOF input.

The input data for a PROOF based analysis is specified as data set names,

  proof://[<user>@]<host>/<data-set-name>[?options][#<treename>]

## Grid ESD input.

Suppose the ESD files are stored on the Grid as

  /alice/data/<year>/<period>/<run>/ESDs/pass<no>/<year><run><chunk>.<part>/AliESDs.root

where <run> is zero-padded by typically 3 '0's. One should specify the input location like

  alien:///alice/data/<year>/<period>?pattern=ESDs/pass<no>/*&run=<run>[#<treename>]

If a particular kind of pass is needed, say pass<no>_MUON, one should do modify the pattern option accordingly

  /alice/data/<year>/<period>/<run>/ESDs/pass<no>_MUON/* /AliESDs.root

For simulation output, the files are generally stored like

  /alice/sim/<year>/<prod>/<run>/<seq>/AliESDs.root

where <run> is generally not zero-padded. One should specify the input location like

  alien:///alice/data/<year>/<period>?pattern=*&mc&run=<run>[#<treename>]

## Grid AOD input

Suppose your AOD files are placed in directories like

  /some/directory/<run>/<seq>/AliAOD.root

where <run> is zero-padded by typically 3 '0's. One should then specify the input as

  alien:///some/directory?pattern=*&run=<run>[#<treename>

The AliEn analysis plug-in is then instructed to look for data files under

  /some/directory/<run>/* /AliAOD.root

Suppose the AODs are in

  /alice/data/<year>/<period>/<run>/ESDs/pass<no>/AOD<vers>/<seq>/AliAOD.root

Then the url should be

  alien:///alice/data/<year>/<period>?pattern=ESDs/pass<no>/AOD<vers>/*&run=<run>[#<treename>]

# Other features

## Auxillary libraries, sources, and files

Auxillary libraries should be loaded using

where the argument is the name of the library

If the train needs additional files, say a script for setting up the tasks, or some data file, it can be passed on the the PROOF/Grid workers using the member functions

The base class TrainSetup tries to implement a sensible setup for a given type of analysis, but some times a particular train needs a bit of tweaking. One can therefore overload the following functions

A task can even be defined in a script, like for example a task like

// MyAnalysis.C
#ifndef __CINT__
# include <AliAnalysisManager.h>
# include <AliESDEvent.h>
# include <AliMultiplicity.h>
# include <AliVEventHandler.h>
# include <AliESDVertex.h>
# include <AliProdInfo.h>
# include <TH1D.h>
# include <TH2D.h>
#else
class TH1D;
class TH2D;
class AliProdInfo;
#endif
{
public:
: AliAnalysisTaskSE(), fList(0), fMult(0), fVz(0), fProd(0)
{}
MyAnalysis(const char* name)
: AliAnalysisTaskSE(name), fList(0), fMult(0), fVz(0), fProd(0)
{
DefineOutput(1, TList::Class());
DefineOutput(2, TList::Class()); // For output from Terminate
fBranchNames = "AliMultiplicity.,SPDVertex.,PrimaryVertex.";
}
{}
virtual ~MyAnalysis() {}
MyAnalysis& operator=(const MyAnalysis&) { return *this; }
virtual void UserCreateOutputObjects()
{
fList = new TList();
fList->SetName("Sums");
fList->SetOwner();
fMult = new TH2D("mult", "SPD tracklets", 80, -2, 2, 10, -10, 10);
fMult->SetXTitle("#eta");
fMult->SetYTitle("v_{z} [cm]");
fMult->Sumw2();
fMult->SetDirectory(0); // Disassociate from file
fVz = new TH1D("vz", "Interaction point", 10, -10, 10);
fVz->SetXTitle("v_{z} [cm]");
fVz->Sumw2();
fVz->SetDirectory(0); // Disassociate from file
PostData(1, fList);
}
virtual void UserExec(Option_t* )
{
if (!fProd) {
AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
if (inputHandler) {
Info("", "Got input handler");
TList *uiList = inputHandler->GetUserInfo();
if (uiList) {
Info("", "Got user list:");
uiList->ls();
fProd = new AliProdInfo(uiList);
Info("", "Lising production information");
fProd->List();
}
}
}
AliESDEvent* event = dynamic_cast<AliESDEvent*>(InputEvent());
if (!event) return;
if (event->IsPileupFromSPD(3,0.8)) return;
const AliESDVertex* vtx = event->GetPrimaryVertexSPD();
if (!vtx || !vtx->GetStatus()) return;
if (vtx->IsFromVertexerZ() &&
(vtx->GetDispersion() > 0.2 || vtx->GetZRes() > 1.25 * 0.2))
return;
const AliMultiplicity* mult = event->GetMultiplicity();
if (!mult) return;
Double_t vz = vtx->GetZ();
fVz->Fill(vz);
Int_t nTracklets = mult->GetNumberOfTracklets();
for (Int_t i = 0; i < nTracklets; i++)
fMult->Fill(mult->GetEta(i), vz);
PostData(1, fList);
}
{
TList* l = dynamic_cast<TList*>(GetOutputData(1));
if (!l) {
Warning("Terminate", "No out data # 1 found");
return;
}
TH2D* mult = static_cast<TH2D*>(l->FindObject("mult"));
TH1D* vz = static_cast<TH1D*>(l->FindObject("vz"));
if (!mult || !vz) {
mult, vz);
return;
}
TList* output = new TList; // Needed for new output from Terminate
output->SetName("Results"); // 1st output re-opened read-only
output->SetOwner();
TH2D* out = static_cast<TH2D*>(mult->Clone("dndeta"));
out->SetTitle("dN_{ch}/d#eta from SPD tracklets per vertex bin");
out->SetZTitle("#frac{1}{N}#frac{dN_{ch}}{d#eta}");
out->SetDirectory(0); // Disassociate from file
Int_t nVz = mult->GetNbinsY();
Int_t nEta = mult->GetNbinsX();
for (Int_t iVz = 1; iVz <= nVz; iVz++) {
Double_t nEv = vz->GetBinContent(iVz);
Double_t e1 = vz->GetBinError(iVz);
Double_t sca = (nEv == 0 ? 0 : 1. / nEv);
for (Int_t iEta = 1; iEta <= nEta; iEta++) {
Double_t c = mult->GetBinContent(iEta,iVz);
Double_t e = mult->GetBinError(iEta,iVz);
Double_t ee = TMath::Sqrt(c*c * e1*e1 + nEv*nEv * e*e) * sca*sca;
out->SetBinContent(iEta, iVz, sca * c);
out->SetBinError(iEta, iVz, ee);
}
}
Double_t etaMin = mult->GetXaxis()->GetXmin();
Double_t etaMax = mult->GetXaxis()->GetXmax();
out->Scale(Double_t(nEta) / (etaMax-etaMin));
PostData(2, output);
}
protected:
AliProdInfo* fProd;
};
//
// EOF
//

Our train set-up can then use the member function ParUtilities::MakeScriptPAR to make a PAR file of the script and use that to make a library loaded on the workers and then generate an object of our task defined in the script.

#ifndef __CINT__
# include <AliAnalysisManager.h>
#else
#endif
#include "TrainSetup.C"
#include "ParUtilities.C"
class MyTrain : public TrainSetup
{
public:
MyTrain(const char* name="myTest") : TrainSetup(name)
{
fOptions.Set("type", "ESD");
}
{
"MyAnalysis.C",
"STEERBase,ESD,AOD,ANALYSIS,"
Fatal("CreateTasks", "Failed to create PAR file");
Long_t r = gROOT->ProcessLine("new MyAnalysis(\"test\")");
AliAnalysisDataContainer* sums =
mgr->CreateContainer("Sums", TList::Class(),
AliAnalysisManager::kOutputContainer,
AliAnalysisManager::GetCommonFileName());
AliAnalysisDataContainer* results = // Needed for output from Terminate
mgr->CreateContainer("Results", TList::Class(),
AliAnalysisManager::kParamContainer, // Important!
AliAnalysisManager::GetCommonFileName());
mgr->ConnectOutput(t, 1, sums);
mgr->ConnectOutput(t, 2, results);
mgr->ConnectInput(t, 0, mgr->GetCommonInputContainer());
}
AliVEventHandler* CreateOutputHandler(UShort_t) { return 0; }
const char* ClassName() const { return "MyTrain"; }
};
//
// EOF
//

This can allow for fast development and testing of analysis tasks without having to wait for official tasks and builds of all of AliROOT

## Enabling Tender Supplies

If you want to run an ESD analysis with a set of tender supplies, all you have to do is to pass the option - -tender=list to runTrain. Here, list is a list of tender supply names:

• VZERO
• TPC
• PTFix
• T0
• TOF
• TRD
• VTX
• EMCAL
• PID

If you need to specify a non-standard OCDB location, you can do so using the option –ocdb=location where location can be an OCDB snapshot or a valid OCDB url.

## Enable OCDB access

If you pass the option - -ocdb possibly with an argument, then an instance of the class AliTaskConnectCDB will be added to the train. This task automatically connects to OCDB for the run being analysed.

## Specifying the kind of Physics Selection

The option - -ps=option defines how to set-up the physics selection. Here option can be

• none In this case the physics selection is completely disabled.
• custom[=Script] A custom physics selection is read from the script Script. If no Script is specified, then Script=CustomPS.C is assumed. The script must define a function with the same name and that function must accept a single pointer to an AliPhysicsSelection object.
• bare In this case a physics selection is installed on the input handler. but there's no accompanying task.
• all Disable filtering on background triggers

To enable friends in the analysis, pass the option - -friends

# Implementation details

## Helpers

The specifics of the each possible execution environment and input is handled by sub-classes of the base class Helper. Each of these helpers define

• URI options.
• Steps to be done before the tasks are added to the train


text:
# Tools Guide¶

Wiis are getting to that age where parts are starting to fail. Some of these are crucial components like the Bluetooth and WiFi modules, so you’d either have to get a new Wii, or you can repair it. Let’s go over some good tools to have for repairing Wiis.

## Background - Why This Is Even A Big Deal¶

Normally you’d think that all you’d need is your average Phillips screwdriver to open something. Unfortunately, the Wii and most other Nintendo products use a special screw called a triwing or tripoint screw. It’s virtually identical to Phillips but with one key difference: instead of having 4 “wings” on the screw head, it has 3 (hence the name). This means that a standard Phillips screwdriver won’t work. The good news though is that once you get the Wii’s case open, there are no more triwing screws inside. So you really only need the triwing screwdriver to get the case open.

## Triwing Screwdrivers¶

The elephant in the room. The triwing screwdriver. You have to be careful when getting these for Wii repair. You may see kits that come with one driver with multiple different bits that can be swapped into it. While these kits may include triwing bits, and they will work for most of the screws, there are 2 screws on the case that are key for getting the case open that are buried somewhat deep. These screwdrivers won’t be able to reach them. You need a triwing screwdriver that can reach about 2 inches deep.

Personally, I got this set from Amazon, but really any triwing screwdriver that is advertised as “For Wii” or “For Nintendo” should meet the 2 inch requirement.

## Toolkit¶

Now, once you have your triwing screwdrivers, you’ll need Phillips screwdrivers too. Personally, I recommend the iFixit Pro Tech Toolkit. It’s not cheap, coming in at $70, but let me explain why it’s worth every one of those dollars. This toolkit is completely made by iFixit. They are a quality company that makes quality tools. It also comes with a lot of these quality tools. A full screwdriver set (the swappable bit kind that I mentioned in the last section) with bit types you’ve probably never even heard of, various pry tools, opening picks, tweezers, spudgers, you name it. These tools aren’t just something for when you want to repair your Wii. They can aid you in repairing pretty much anything. Over time, repairing your stuff, you’ll get those$70 back and then some.

I can confirm that this kit works great for removing all the screws inside the Wii and outside (besides those two screws I mentioned previously). It also has a nice sorting tray for keeping your screws organized, which is very important for the Wii.

## Replacement Parts¶

This isn’t really a tool, but it is somewhat relevant, so I figured I’d include it. Now that you have the means to open your Wii, you need the new part to replace whatever it is that’s broken. Meaning you have to get it from somewhere.

There are a few good ways to get parts for your Wii:

• Have a parts Wii around that you can grab parts from
• Look online. Places like Amazon and iFixit usually have the common stuff, and they’re usually high quality. For other stuff, look on eBay
• Some parts are pretty general and can be fabricated or found at a hardware store or something

## Outro¶

Now, if you’re looking for some guidance when actually opening your Wii, I’ve got you covered there too: https://www.reddit.com/r/WiiHacks/comments/hhaojq/tips_for_disassembling_the_wii/

format: plain


text:
1

### NEET 2013

Which of the following is paramagnetic?
A
CN$-$
B
NO+
C
CO
D
O2$-$

## Explanation

$O_2^-$ superoxide has one unpaired electron.
2

### NEET 2013

Which of the following is a polar molecule?
A
SiF4
B
XeF4
C
BF3
D
SF4

## Explanation

The given molecules SiF4, XeF4, and BF3 are symmetric molecules that is why due to cancellation of bond dipoles they are non-polar even though they contain polar bonds.

But in SiF4 there are four Si—F bonds and one lone pair due to which its structure is unsymmetrical. Hence, it is a polar molecule.
3

### NEET 2013 (Karnataka)

The pair of species that has the same bond order in the following is
A
CO, NO+
B
NO$-$, CN$-$
C
O2, N2
D
O2, B2

## Explanation

CO = + 8 = 14 electrons
NO+ = 7 + 8 - 1 = 14 electrons
Both have electronic configuration:
$\sigma 1s^2$ $\sigma^* 1s^2$ $\sigma 2s^2$ $\sigma^* 2s^2$ $\sigma 2p_z^2$ $\sigma 2p_x^2$ $\sigma 2p_y^2$
Bond order = $10 - 4 \over 2$ = 3
4

### NEET 2013

Dipole-induced dipole interactions are present in which of the following pairs
A
HCl and He atoms
B
SiF4 and He atoms
C
H2O and alcohol
D
Cl2 and CCl4

## Explanation

HCl is polar ($\mu$ $\ne$ 0) and He is non-polar ($\mu$ = 0) gives dipole-induced dipole interaction.


text:
# Any recommendations for a good cheap USB oscilloscope?

Gold Member
2020 Award
There has been some discussion on another thread about possible problems with mains spikes and lighting LEDs. I have decided that I could use an entry level scope to capture and measure any that are around on my supply. My regular analogue scope is hopeless for this purpose.
I am sure that there will be some home experimenters on this forum. Is there a particular make that I should love / avoid? The Hantek range is high profile. Are they OK or is it just 'marketing'?

krater

Hi Sophicentaur,
I was considering purchasing the Hantek HT6022BC20MHZ usb scope, however, I read some reviews on Amazon and 25% of reviewers gave it one star. Evidently the software is atrocious. One of many problems is the trigger is off to the left of the screen. Inexpensive but probably unfit for your purpose. Be careful unless you like collecting useless junk.

Peace,
Fred

I have been looking at the Analog Discovery module for a while - promised to to my self a year ago, but still no.

JRMichler
Here's a possibility: https://www.omega.com/pptst/OM-USB-1208HS_SERIES.html. I have used Omega data acquisition products several times over the years with excellent results. I have no experience with the oscilloscope software that is packaged with the data acquisition boards.

Omega is a reseller. Their pricing seems to be the same as you would pay elsewhere, and they normally have everything in stock. I believe that their USB DAQ products are from Measurement Computing, with Omega labels: https://www.mccdaq.com/data-acquisition/low-cost-daq.

Gold Member
2020 Award
Hi Sophicentaur,
I was considering purchasing the Hantek HT6022BC20MHZ usb scope, however, I read some reviews on Amazon and 25% of reviewers gave it one star. Evidently the software is atrocious. One of many problems is the trigger is off to the left of the screen. Inexpensive but probably unfit for your purpose. Be careful unless you like collecting useless junk.

Peace,
Fred
Thanks Fred, I will bear that in mind. Unfortunately, the problem with Amazon reviews is that you need to know a bit about the reviewers themselves in order to get real use out of them. I have read 'bad' reviews of purchases which just reflect how inept some people can be. Personally, I have had many products which have worked find - when I have learned how to use them (RTFM etc.). I looked at all the Amazon Hantek reviews and found that over 50% were 4 or 5 stars. It we were discussing a washing machine or vacuum cleaner, I would probably take more notice of the bad comments. This is one reason why I was after personal assessment of the devices by PF members - who tend to know more about how many beans make five. Pity you haven't actually bought one and learned to tame it.
When you think how much you have to pay for an Arduino processor plus peripherals, the £50 for a working system is very cheap and it's not surprising you don't get £1k's worth of product.
@JRMichler: Also, thanks for that. The omega page shows mostly "big boys' " equipment that would require a fair bit of development work to make it work.
I have been looking at the Analog Discovery module for a while - promised to to my self a year ago, but still no.
That unit looks very useful and not a ridiculous price but it is more than I want to pay - I want to monitor mains spikes in a hunt for a way to protect my LEDs against whatever it is that's giving the such short lives. I could buy a lot of replacements for £200.
I may need to rethink what to do about this. eBay doesn't have much in the way of used PC scopes. It makes me wonder why dissatisfied users have not flooded eBay with them.

anorlunda
Staff Emeritus
There has been some discussion on another thread about possible problems with mains spikes and lighting LEDs. I have decided that I could use an entry level scope to capture and measure any that are around on my supply.

Whoa. Slow down. The kinds of spikes that might fry a LED do not occur every cycle. They might occur 3 or 4 times per year when one of your neighbors switches a big load, or when the line crews are doing maintenance and repair, or when lightning hits a power line miles away from your home.

When I was a fire fighter, I recall incidents where the wind knocked down a high voltage line. As the wire was falling, it momentarily touched a lower voltage line below. Those incidents fried TVs and other electronics in houses for miles around. Most people could not imagine what caused it.

There are nearly 2 billion cycles in a year. You can't watch all of them on your oscilloscope. So I think an oscilloscope is not the right tool for the job.

To capture those infrequent spike events, you need something that measures the highest instantaneous voltage, then retains that measurement until it is copied somewhere, or until you manually reset it.

An Arduino or a Raspberry Pi might make an excellent data logger, but even then you can't just measure voltage on an analog input in a software loop. The spike might last only a microsecond and your software may not be able to loop a million times per second. Some kind of analog latching circuit needs to be part of your solution.

Check the Arduino or Rasberry Pi, forums for "power quality monitoring" projects.

dlgoff, NTL2009 and donpacino
Borek
Mentor
If you want it cheap there is always DSO138 DIY. With all its limitations it already proved itself useful to me on several occasions.

What about a data logging multimeter with peak detect?

donpacino
Gold Member
2020 Award
Whoa. Slow down. The kinds of spikes that might fry a LED do not occur every cycle.
I thought I could put the scope on single shot (perhaps 50ms sweep) with a pre trigger of a few ms. Wouldn't that pick up a spike? I was thinking that a 20MHz-ish bandwidth scope (what you get for that sort of money) would show a blip. Looking at the display every few hours / days would show what happened at that one instant. You could do it with an old analogue storage scope as long as you could come back before the screen had bloomed into nothingness.
Do you really think my idea is a non starter? Best to strangle it at birth than find it's a non-runner.
Hantek scares me so I decided to buy Xprotolab Plain http://www.gabotronics.com/oscilloscopes/xprotolab-plain.htm. Cost: $20 . I plan on setting it up next week. Insha Allah I'll let you know how it goes. Fred I am in no rush so I can wait to see how well you get on with it. What about a data logging multimeter with peak detect? I haven't used one of those. Would a peak reading re-set after a while? To allow recording more than one peak. If you want it cheap there is always DSO138 DIY. With all its limitations it already proved itself useful to me on several occasions. That looks pretty 'entry level' and it's in kit form (isn't it?). Also cheaper than I was think of paying. Opinions on the Picoscope?? anorlunda Staff Emeritus I thought I could put the scope on single shot (perhaps 50ms sweep) with a pre trigger of a few ms. Wouldn't that pick up a spike? I was thinking that a 20MHz-ish bandwidth scope (what you get for that sort of money) would show a blip. Looking at the display every few hours / days would show what happened at that one instant. You could do it with an old analogue storage scope as long as you could come back before the screen had bloomed into nothingness. Do you really think my idea is a non starter? Best to strangle it at birth than find it's a non-runner. That depends. What are you triggering on? Is it practical to leave it set up for 3 months waiting for a trigger? Is it really the waveform you want to see, or just the value of the peak voltage? Borek Mentor That looks pretty 'entry level' and it's in kit form (isn't it?). Also cheaper than I was think of paying. Yes and yes, requires an evening with a soldering iron, but in general it is quite simple (if I made it, everyone can ). Science Advisor Gold Member 2020 Award That depends. What are you triggering on? Is it practical to leave it set up for 3 months waiting for a trigger? Is it really the waveform you want to see, or just the value of the peak voltage? I could leave it waiting for it to trigger on a significant spike whenever I wasn't using the PC. I could test all my electrical appliances without needing to be right by the logger. A trace of an actual spike could be informative. I could also log the voltage variations, which would be useful in itself. I remember, years ago, I was losing filament bulbs after only a very short time. The mains volts were peaking well over 250V and it was only when the company installed a logger (pen and paper roll) that they actually believed me. Of course, the LIARS told me there was nothing wrong with my supply but I had read the trace and told them so. Within a day or two, the volts were something much more reasonable. The house was right next to a substation which fed a couple of hundred houses, downstream. They had jacked up the transformer volts so that people at the far end of a resistive cable were getting a reasonable voltage. I never went to those houses to ask if their lights were only red hot after the reduction! Science Advisor Gold Member 2020 Award The picoscope looks a far superior unit (the cheapest is about £70) and the opinion is that the software is pretty good too. I think I will need to find another excuse for buying one before I actually part with the old mazuma, though. It will have to go somewhere on the list of priorities but not at the top. I haven't used one of those. Would a peak reading re-set after a while? To allow recording more than one peak. https://www.amazon.com/dp/B010Y71G1K/?tag=pfamazon01-20 Something like this cheap and cheerful object. It sends data to an app on your phone - the idea being, you check it every day or so for the max reading. I haven’t used one of these, but my Fluke 87 has a 250 us peak reading with max/min recording. I cancel the auto power off, and power it from a wall adapter. That way, it will pick up the max peak voltage, but won’t record how many peaks per session. I think the Owon would. Common surge protection clips any voltage over 400V - is this what you would consider a damaging level for your lights, or perhaps 10% above the usual peak of 330V, say 363V? I’d be very interested to see what you find, but I suspect it may be a while before you catch some juicy transients. How would you solve this - can you get global surge protection for whole lighting circuits? You’d need it to be connected all the time. What about modifying an LED light, that is used most of the time, with a suitable MOV? This should clip transients for the whole circuit. Better still, an earthed light fitting with three MOVs between L, N and E. Science Advisor Gold Member 2020 Award https://www.amazon.com/dp/B010Y71G1K/?tag=pfamazon01-20 Something like this cheap and cheerful object. It sends data to an app on your phone - the idea being, you check it every day or so for the max reading. I haven’t used one of these, but my Fluke 87 has a 250 us peak reading with max/min recording. I cancel the auto power off, and power it from a wall adapter. That way, it will pick up the max peak voltage, but won’t record how many peaks per session. I think the Owon would. Common surge protection clips any voltage over 400V - is this what you would consider a damaging level for your lights, or perhaps 10% above the usual peak of 330V, say 363V? I’d be very interested to see what you find, but I suspect it may be a while before you catch some juicy transients. How would you solve this - can you get global surge protection for whole lighting circuits? You’d need it to be connected all the time. What about modifying an LED light, that is used most of the time, with a suitable MOV? This should clip transients for the whole circuit. Better still, an earthed light fitting with three MOVs between L, N and E. This is the trouble with PF. People are so sensible and well informed. (Moi aussi) Yes, that solution would probably give me an answer and I would have a real problem arguing against it. However, I would really fancy a better scope than the (second hand analogue) one I have already. There's no excuse for this because I do very little construction or fault finding these days. What I want is for some equally irresponsible person to tell me that the, for example Picoscope is excellent value and works very well. Then I could go out an buy one - and regret it when I find that it doesn't solve my problem. I know that a good digital scope will cost a lot. I could spend my money on improved Astro equipment and get more use from it. But thanks for the advice in all these posts. Mainly, you have saved me from the potential Hantek Black Hole. Meanwhile, I think I will provide my cheaper DMM with a mains adaptor and just keep my eye on the running peak value it measures. That could be sufficient evidence for me. anorlunda Staff Emeritus atyy tech99 Gold Member THANK YOU @tech99 . It is not every day that I get to add an electrical word to my vocabulary. I never heard the word coherer before. That also sounds like a fun project. I bet you could adjust the gap to trigger at different voltages. The threshold voltage seems to depend on the materials and is just a few volts. There is also a "linear" mode of operation allowing detection of signals of around 50mV without amplification. The following notes might be of interest:- The device was used as an early detector of radio waves. It is usually described as a glass tube in which two metal electrodes are placed, the gap between them containing some loose metal powder or sometimes a drop of mercury. There are other types known, some of which resemble semiconductor diodes, but which might or might not employ semiconductor action, and others which are just light contacts. A bias battery of typically 1 volt is connected, no current flowing under rest conditions, but when the voltage is increased by the addition of RF voltage to the battery potential, a direct current starts to flow. This can create a click in a pair of earphones, and if the signal is amplitude modulated, the modulation can be heard. If the RF voltage is fairly large, say 1 volt or more, and the resistance in the circuit is small, the contact can micro-weld itself closed, so that a large current can flow from the battery. This produces a latching action, able to operate a relay, and a mechanical reset was often used in the form of an electromagnet to shake the coherer and break the contact. The operation of the coherer is seen to have two modes: a “linear” detection mode and a latching mode. It does not appear to involve the cohering of the metal particles together, and such a mechanical action seems unlikely in view of the use of the device at 60 GHz by J C Bose in 1895. The linear mode seems to occur due to an oxide film on a contact surface, and the response seems to be an S-shaped curve which is symmetrical with respect to battery polarity. By biasing the device a little way up the curve, an asymmetrical action occurs, and when AC is added to the bias potential, rectification occurs. However, this does not appear to be semiconductor rectifying action, as it occurs with either battery polarity, even though the materials used might resemble those of a semiconductor diode or crystal detector. The action has been said to resemble that of a Metal-Insulator-Metal (MIM) diode, where tunnelling occurs through an insulating oxide layer. My own observations support this, as I found the action to be nearly always symmetrical, and it did not occur with carbon, which does not form an oxide film. A particularly sensitive design uses copper electrodes with a drop of mercury between them, and it seems likely that the oxide barrier consists of copper oxide. It also works with iron, zinc brass etc but not carbon. There is no need for the signal to be AC; the coherer is just responding to an increase in voltage, either as a non linear conductor or a threshold device, and frequency has no relevance. Maybe the first demonstration of radio communication took place in London in February 1880, when Professor Hughes obtained a range of 500m using a mobile receiver having a steel/carbon contact. The mercury coherer was used by Marconi in 1901 for the transatlantic test, in conjunction with a very sensitive earpiece. In my own tests I was able to hear HF broadcasting with a coherer and obtained sensitivity approximately 10 dB inferior to that of a Germanium diode. sophiecentaur and anorlunda The picoscope looks a far superior unit (the cheapest is about £70) and the opinion is that the software is pretty good too. I think I will need to find another excuse for buying one before I actually part with the old mazuma, though. It will have to go somewhere on the list of priorities but not at the top. I purchased this picoscope a few months ago. Loaded the software on my linux system, and played with it a bit, and it seemed to work quite well. I haven't had any specific use for it since then, so can't comment much beyond that, but for the price it seemed good to have available in case the need came up. I gave away my dead, bulky tube Tektronix a few decades ago. I paid ~$140 US for the picoscope. It also has a built in function generator, so that's a nice plus.

https://www.amazon.com/gp/product/B00GZMRZ3M/?tag=pfamazon01-20

While they say 10MHz BW, remember you will want several samples to really see a wave shape. So a 1MHz square wave would only show the 3x 5x 7x 9x harmonics. But that's good enough for many things, just don't expect much more than go-no-go signals at much above 1 Mhz.

sophiecentaur
Gold Member
2020 Award
While they say 10MHz BW, remember you will want several samples to really see a wave shape.
I was thinking that mains circuits would probably limit spike bandwidth to not many MHz - or at least contain significant energy within that limit. This link talks in terms of several μs for transient period.
I know we would all want 100MHz scopes but, at the price. . . .

I purchased this picoscope a few months ago.
--- Can you set it up to monitor your mains, and report how it works? -- Need isolation (which becomes a filter), and set the trigger outside of the regular waveform, turning off a large appliance may be a good enough event to force a trigger..


text:
Question
What is the average flow rate in $\textrm{cm}^3\textrm{/s}$ of gasoline to the engine of a car traveling at 100 km/h if it averages 10.0 km/L?
Question by OpenStax is licensed under CC BY 4.0.
Final Answer

$2.78 \textrm{ cm}^3\textrm{/s}$

Solution Video


text:
# os x

## Video killed the radio star

Soon after the was born, a little over three years ago, sent me out with a shopping list, as follows: Lansinoh Cotton wool I decided to get these from the big John Lewis in town, on the ostensible grounds that it was marginally closer to the car park than Boots. This also meant that I could browse the AV department. One thing lead to another, and I ended up leaving with the following items: Lansinoh Cotton wool A Humax 9200-T PVR Apart from making a shopping basket that clearly shouts “new dad” (nipple cream + superfluous technology), the PVR has… Read More »Video killed the radio star

## A maze of twisty PIM formats, all alike

These days, I use a Mac for all of my day-to-day computing, but I’ve never really got to grips with Mail.app, preferring to use Thunderbird instead. I also use GMail in a limited capacity for non-work mail, and I’ve been starting to look at the OS X Address Book (which ties in nicely with a whole bunch of things). Unfortunately, Thunderbird, Address Book and GMail all use different standards for importing and exporting contact information: Address Book Exports: vCard, Address Book Archive (package containing an sqlite database) Imports: vCard, LDIF, Address Book Archive Thunderbird Exports: LDIF, TSV (of some kind),… Read More »A maze of twisty PIM formats, all alike

## OS X 10.5 font woes

Since moving to a Mac a bit over a year ago, I’ve had only a few reasons to look back (the business with the HP LJ1022 printer being one of them). I’m now rather close to the end of my tether, and the reason is fonts. As an academic and a computer scientist, I end up writing quite a lot of papers and presentations with maths in them. Like any sensible person, I use LaTeX for typesetting the maths; it’s a lot easier to type $\sum_{i=0}^{i=n-1} i^2$ than to wrestle with the equation editor in Word. I’ve also been using… Read More »OS X 10.5 font woes

## The love affair is over

Let me get this straight. I can’t print from MacOS 10.4 to a commonplace HP non-postscript printer (in this case a LaserJet 1022) that’s connected to and shared from a Windows XP box without downloading, compiling and installing a bunch of open source software from a third party. I was under the impression that Apple computers were renowned for their ease of use.

## Cataloguing the Library of Babel

So I exaggerate – we’re not quite at the level of certain other bibliophiles, but we do have upwards of 3-4000 books in Gark Villa. Unfortunately, I also have a poor memory so I’m forever buying duplicate copies of books that I already own, or lending out books and forgetting who to. One of my projects for paternity leave and Christmas was to investigate software for cataloguing our collection, and perhaps make a start on the task. However, the took up more of my time than I’d envisaged (that is, all of it) and I didn’t get very far. mentioned… Read More »Cataloguing the Library of Babel


text:
# How do I get list of all network drives mapped to my system?

I mapped a network drive under local system account, I mean I login to my machine using local sytem account. Now I logged off and logged into the machine again using some other valid user account, but I couldn't find that mapped drive in my computer explorer, though am able to use that mapped drive in my application. Is this normal?

Is there any way to see all mapped network drives on my system?

I am on a Windows XP machine.

• How – and more importantly, why – did you log in as Local System? – grawity Feb 22 '11 at 14:05

Yes, it's normal. Network connections and drive letters assigned to them are session-local. Normally they disappear upon logout (when the session itself is destroyed) and are re-created by Winlogon when you log in again.

With Local System it gets confusing, though.

Log in as Local System again (psexec -desi cmd may be useful), then run net use to list all connections or net use * /delete to disconnect them.

> net use

is what you need. See this for more info.

• yaa i already done that but could n't find mapped drive that i able to use... – AMIT Feb 22 '11 at 8:31
• net view lists available shares on a server, not active connections. – grawity Feb 22 '11 at 14:09
• @grawity: Of course, you're right... I meant the net use command (I updated my answer) – fretje Feb 22 '11 at 15:52

I grab mapped drives from a remote machine using powershell as part of a script to move their settings to a persons' new machine: (set $OldComputer to the name or IP of the old computer) It goes through the list of all drives on the remote system, and if they are not local drives, it will attempt to remove that drive mapping on the current computer (in case its used by something else) then remap it. Comment out the second to last line (the one above foreach, and add your own line to log or msgbox if you want.) $netObj = New-Object -com wscript.Network
$WMI1 = [WMISearcher] "Select Name, Providername from win32_mappedLogicalDisk"$WMI1.Scope.path="\\" + $oldComputer + "\root\cimv2"$WMI1.Options.ReturnImmediately
$ColDrives =$WMI1.Get()

foreach ($objDrive in$colDrives) {
$TestLocal = get-wmiObject Win32_LogicalDisk | ? {$_.DeviceID -eq $objDrive.Name} | % {$_.Providername}
If ($TestLocal) { Net Use /Delete$objDrive.Name >> $LogFile }#If #Map the drive Net use$objDrive.Name $objDrive.ProviderName >>$LogFile
}#foreach


text:
### Near-Collisions of SHA-0

Eli Biham and Rafi Chen

##### Abstract

In this paper we find two near-collisions of the full compression function of SHA-0, in which up to 142 of the 160 bits of the output are equal. We also find many full collisions of 65-round reduced SHA-0, which is a large improvement to the best previous result of 35 rounds. We use the very surprising fact that the messages have many neutral bits, some of which do not affect the differences for about 15--20 rounds. We also show that 82-round SHA-0 is much weaker than the (80-round) SHA-0, although it has more rounds. This fact demonstrates that the strength of SHA-0 is not monotonous in the number of rounds.

##### Metadata
Available format(s)
Category
Secret-key cryptography
Publication info
Published elsewhere. Breaking News'' information on SHA-0 and SHA-1 was added to our CRYPTO 2004 paper
Keywords
SHA-0SHA-1
Contact author(s)
biham @ cs technion ac il
History
2004-06-23: received
Short URL
https://ia.cr/2004/146
License

CC BY

BibTeX

@misc{cryptoeprint:2004/146,
author = {Eli Biham and Rafi Chen},
title = {Near-Collisions of SHA-0},
howpublished = {Cryptology ePrint Archive, Paper 2004/146},
year = {2004},
note = {\url{https://eprint.iacr.org/2004/146}},
url = {https://eprint.iacr.org/2004/146}
}

Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.


text:
• 13
• 27
• 9
• 9
• 20

# Converting Axis Angles (forward, right, up) to Euler.

This topic is 1112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to convert 3 direction vectors (forward, right, up vectors) to 3 Euler angles (X, Y, and Z).

I figured I could do this by projecting each axis against the unit axis, then use arctan2 to extract the angle.

Visualization:

I project the input right vector against the unit right (red) and unit up (green), then take the arctan2 of the resulting X,Y to get an angle.  I do this for each axis respectively (see code snippet).

This generates the correct Euler rotation for an axis when the input axis vector is parallel to the "plane" its projected against.  Once it starts deviating, the result becomes incorrect.  Often times its close, but still not correct,

glm::vec3 rotation;

rotation.x = glm::degrees(atan2f(glm::dot(glm::vec3(0, 0, 1), up),
glm::dot(glm::vec3(0, 1, 0), up)));

rotation.y = glm::degrees(atan2f(glm::dot(glm::vec3(1, 0, 0), forward),
glm::dot(glm::vec3(0, 0, 1), forward)));

rotation.z = glm::degrees(atan2f(glm::dot(glm::vec3(0, 1, 0), right),
glm::dot(glm::vec3(1, 0, 0), right)));

I know there exists formula for converting angles to axis.  I can't seem to find much info on Google for the reverse of this.

I'm using the glm math library if that makes a difference.

Edited by scarypajamas

##### Share on other sites
I don't know what "normalized axis angles" means. The usual representations are axis-angle, quaternion, rotation matrix and Euler angles. You can easily search the web for conversions between them.

##### Share on other sites

I don't know what "normalized axis angles" means. The usual representations are axis-angle, quaternion, rotation matrix and Euler angles. You can easily search the web for conversions between them.

Thanks for the reply.  This link has a function (at the very bottom) for converting from Euler angles to a forward, right, and up vector.  I'm trying to do the reverse.  I've found lots of information on the web for quaternions and rotation matrices, but nothing related to the conversion I'd like to do.

As an aside, what are the forward, right, and up vectors usually refereed to as?  Simply "direction vectors"?

Edited by scarypajamas

##### Share on other sites

I've found lots of information on the web for quaternions and rotation matrices, but nothing related to the conversion I'd like to do.

Using Bing, searching for "euler angles to quaternions" yields ~90,000 hits. Several of the first hits seem to be discussing what you describe.

I suspect that Alvaro's comment about your vectors results from your assumption that everyone will know what you mean, though you don't provide a context for the problem.

##### Share on other sites

Using Bing, searching for "euler angles to quaternions" yields ~90,000 hits. Several of the first hits seem to be discussing what you describe.

Thanks for the reply, I get lots of hits for this too, but I'm not trying to convert to or from a quaternion.  I'm trying to do the reverse of the anglesToAxes function as described here.  e.g. 3 Vectors as input (a forward, right, and up vector) and 1 Vector output (the equivalent Euler angles).  There are no quaternions at play here.

I did extract the vectors from a matrix like shown below:

Maybe I have some fundamental misunderstanding.  The left, up, and forward vectors are not quaternions correct?  They are just direction vectors (there is no W component).

I tried lots of things to get this to work, but everything has fallen short.  For example, a suggestion I found (see 2nd post) described a technique using arccos, but arccos only returns angles for [0, pi].  I tried GLM's eulerAngles, but it doesn't always give correct results - sometimes the angle is wrong by as much as +/-10 degrees.

I'll gladly take any mockery for poor search skills so long as I can at least get a helpful link that actually provides a formula + explanation.  When I do find something, all I seem to get are code dumps or half-baked explanations.  I can't seem to find anything in-depth.


text:
A sequence $\{x_n\}$ in a metric space $(X, \rho)$ is called Cauchy if $\rho(x_n, x_m)\to 0$ as $n, m\to\infty$. A subset $E$ of $X$ is called complete if every Cauchy sequence in $E$ converges and its limit is in $E$. For example, $\mathbb R^n$ is complete, while $\mathbb Q^n$ is not.

Proposition. A closed subset of a complete metric space is complete, and a complete subset of an arbitrary metric space is closed.

Proof. If $X$ is complete, $E\subset X$ is closed, and $\{x_n\}$ is a Cauchy sequence in $E$, $\{x_n\}$ has a limit in $X$. So $x\in\bar{E}=E$. If $E\subset X$ is complete and $x\in\bar{E}$, then there is a sequence $\{x_n\}$ in $E$ converging to $x$. $\{x_n\}$ is Cauchy, so its limit lies in $E$; thus $E=\bar E$. $\Box$

In a metric space $(X, \rho)$ we can define the distance from a point to a set and the distance between two sets. Namely, if $x\in X$ and $E, F\subset X$,

$\rho(x, E)=\inf\{\rho(x, y): y\in E\}$,

$\rho(E, F)=\inf\{\rho(x, y): x\in E, y\in F\}=\inf\{\rho(x, F): x\in E\}$.

Note that $\rho(x, E)=0$ iff $x\in\bar E$. We also define the diameter of $E\subset X$ to be

$diam E=\sup\{\rho(x, y): x, y\in E\}$.

$E$ is called bounded if $diam E<\infty$.

If $E\subset X$ and $\{V_\alpha\}_{\alpha\in A}$ is a family of sets such that $E \subset \cup_{\alpha\in A}V_\alpha$, $\{V_\alpha\}_\alpha\in A$ is called a cover of $E$, and $E$ is said to be covered by the $V_\alpha$‘s. $E$ is called totally bounded if for every $\epsilon>0$, $E$ can be covered by finitely many balls of radius $\epsilon$. Every totally bounded set is bounded, for if $x, y\in\cup_1^n B(\epsilon, z_j)$, say $x\in B(\epsilon, z_1)$ and $y\in B(\epsilon, z_2)$, then

$\rho(x, y)\le\rho(x, z_1)+\rho(z_1, z_2)+\rho(z_2, y)\le 2\epsilon+\max\{\rho(z_j, z_k): 1\le j, k\le n \}$.

If $E$ is totally bounded, so is $\bar E$, for it is easily seen that if $E\subset \cup_1^n B(\epsilon, z_j)$, then $\bar E\subset \cup_1^n B(2\epsilon, z_j)$.

Theorem. If $E$ is a subset of the metric space $(X, \rho)$, the following are equivalent:

1) $E$ is complete and totally bounded.

2) (The Bolzano-Weierstrass Property) Every sequence in $E$ has a subsequence that converges to a point in $E$.

3) (The Heine-Borel Property) If $\{V_\alpha\}_{\alpha\in A}$ is a cover of $E$ by open sets, there is a finite set $F\subset A$ such that $\{V_\alpha\}_{\alpha\in A}$ covers $E$.

Proof. 1) $\Rightarrow$ 2): Suppose that 1) holds and $\{x_n\}$ is a sequence in $E$. $E$ can be covered by finitely many balls of radius $2^{-1}$, and at least one of them must contain $x_n$ for finitely many many $n$: say, $x_n\in B_1$ for $n\in N_1$. $E\cap B_1$ can be covered by finitely many balls of radius $2^{-2}$, and at least one of them must contain $x_n$ for infinitely many $n\in N_1$: say $x_n\in B_2$ for $n\in N_2$. Continuing inductively, we obtain a sequence $x_n\in B_j$ for $n\in N_j$. Pick $n_1\in N_1$, $n_2\in N_2$, … such that $n_1. Then $\{x_{n_j}\}$ is a Cauchy sequence, for $\rho(x_{n_j}, x_{n_k})<2^{1-j}$ if $k>j$, and since $E$ is complete, it has a limit in $E$.

2) $\Rightarrow$ 1): If $E$ is not complete, there is a Cauchy sequence $\{x_n\}$ in $E$ with no limit in $E$. No subsequence of $\{x_n\}$ can converge in $E$, for otherwise the whole sequence would converge to the same limit. On the other hand, if $E$ is not totally bounded, let $\epsilon>0$ be such that $E$ cannot be covered by finitely many balls of radius $\epsilon$. Choose $x_n\in E$ inductively as follows. Begin with any $x_1\in E$ and having chosen $x_1, ..., x_n$, pick $x_{n+1}\in E\setminus \cup_1^n B(\epsilon, x_j)$. Then $\rho(x_n, x_m)>\epsilon$ for all $n, m$, so $\{x_n\}$ has no convergent subsequence.

1) + 2) $\Rightarrow$ 3): If suffices to show that if 2) holds and $\{V_\alpha\}_{\alpha\in A}$ is a cover of $E$ by open sets, $\exists\epsilon>0$ such that every ball of radius $\epsilon$ that intersects $E$ is contained in some $V_\alpha$, for $E$ can be covered by finitely many such balls by 1). Suppose to the contrary that for each $n\in\mathbb N$, $\exists$ a ball $B_n$ of radius $2^{-n}$ such that $B_n\cap E\not=\emptyset$ and $B_n$ is contained in no $V_\alpha$. Pick $x_n\in B_n\cap E$; by passing to a subsequence we may assume that $\{x_n\}$ converges to some $x\in E$. We have $x\in V_\alpha$ for some $\alpha$, and since $V_\alpha$ is open, $\exists\epsilon>0$ such that $B(\epsilon, x)\subset V_\alpha$. But if $n$ is large enough so that $\rho(x_n, x)<\epsilon/3$ and $2^{-n}<\epsilon/3$, then $B_n\subset B(\epsilon, x)\subset V_\alpha$, contradicting the assumption on $B_n$.

3) $\Rightarrow$ 2): If $\{x_n\}$ is a sequence in $E$ with no convergent subsequence, for each $x\in E$ there is a ball $B_x$ centered at $x$ that contains $x_n$ for only finitely many $n$. Then $\{B_x\}_{x\in E}$ is a cover of $E$ by open sets with no finite sub-cover. $\Box$

A set $E$ can possesses the properties 1)-3) is called compact. Every compact set is closed and bounded, and the converse is false.

Proposition. Every closed and bounded subset of $\mathbb R^n$ is compact.

Proof. Since closed subsets of $\mathbb R^n$ are complete, it suffices to show that bounded subsets of $\mathbb R^n$ are totally bounded. Since every bounded set is contained in some cube

$Q=[-R, R]^n=\{x\in\mathbb R^n: \max(|x_1|,..., |x_n|),

it is enough to show that $Q$ is totally bounded. Given $\epsilon>0$, pick an integer $k>R\sqrt{n}/\epsilon$, and express $Q$ as the union of $k^n$ congruent subcubes by dividing the interval $[-R, R]$ into $k$ equal pieces. The side length of these subcubes is $2R/k$ and hence their diameter is $\sqrt{n}(2R/k)<2\epsilon$, so they are contained in the balls of radius $\epsilon$ about their centers. $\Box$

Two metrics $\rho_1$ and $\rho_2$ on a set $X$ are called equivalent if

$C\rho_1\le\rho_2\le C'\rho_1$ for some $C, C'>0$.

Equivalent metrics define the same open, closed and compact sets, the same convergent and Cauchy sequence, and the same continuous and uniformly continuous mappings. Consequently, most results concerning metric spaces depend not on the particular metric chosen but only on its equivalent class.

“As you simplify your life, the laws of the universe will be simpler; solitude will not be solitude, poverty will not be poverty, nor weakness, weakness.” ~ Henry David Thoreau

References:

[1] Gerald B. Folland, Real Analysis: Modern Techniques and Their Applications, 2ed, page 15-16.

[2] Purpose Fairy’s 21-Day Happiness Challenge, http://www.jrmstart.com/wordpress/wp-content/uploads/2014/10/Free+eBook+-+PurposeFairys+21-Day+Happiness+Challenge.pdf.


text:
### A Case Study in Vanishing Viscosity

Stefano Bianchini and Alberto Bressan

Abstract: We consider a special $2\times 2$ viscous hyperbolic system of conservation laws of the form $u_t+A(u)u_x=\ve u_{xx}$, where $A(u)=Df(u)$ is the Jacobian of some flux function $f$. For initial data with small total variation, we prove that the corresponding solutions satisfy a uniform BV bound, independent of $\ve$. Letting $\ve\to 0$, we show that solutions of the viscous system converge to the unique entropy weak solutions of the hyperbolic system $u_t+f(u)_x=0$. Within the proof, we introduce two new Lyapunov functional which control the interaction of viscous waves of the same family. This provides an example where uniform BV bounds and convergence of vanishing viscosity solutions are obtained, for a system with a genuinely nonlinear field where shock and rarefaction curves do not coincide.

Paper:
Available as PostScript (439 Kbytes) or gzipped PostScript (154 Kbytes; uncompress using gunzip).
Author(s):
Stefano Bianchini, <bianchin@sissa.it>
Alberto Bressan, <bressan@sissa.it>
Publishing information:
to appear in 'Discrete and Continuous Dynamical Systems'


text:
# Asynchronous execution

I needed several classes with methods performing network requests which should be executed asynchronously (with callbacks). To get rid of repetition, I added a mixin and a helper class:

module Asyncable
def async(&callback)
AsyncHelper.new(self, &callback)
end
end

class AsyncHelper

def initialize(base, &callback)
@base = base
@callback = callback
@errback = nil
end

def onerror!(&errback)
@errback = errback
self
end

def method_missing(sym, *args)
method = @base.method(sym)
begin
res = method.call(*args)
rescue => e
if @errback.nil?
raise
else
@errback.call(e)
end
else
unless @callback.nil?
@callback.call(res)
end
res
end
end
end
end

Now all methods in classes can be implemented as synchronous, and then used in these ways:

# assuming base is an instance of a class including Asyncable
# sequential execution of a method:
value = base.method(params)
f(value) # process the value

# same method executed asynchronously, without callback:
# ... other operations while the method is executed in the background ...
value = thread.value # blocks until completed and raises errors, if any
f(value)

# same method executed asynchronously, with callback:
thread = base.async { |value| f(value) }.method(params)
# ... other operations while the method is executed in the background ...
thread.join # blocks until completed and raises errors, if any

# using errback to handle errors:
thread = base.async { |value| f(value) }.onerror! { |e| puts e }.method(params)
# ... other operations while the method is executed in the background ...
thread.join # only blocks, no errors raised here

This works perfectly for me, but I am a bit concerned by the fact that such an approach isn't widely used (I haven't seen it anywhere), while the use-case for it may be common enough. Is it a good way to approach the task, and how can be improved?

• Are you aware of EventMachine? github.com/igrigorik/em-http-request/wiki/Issuing-Requests – tokland Mar 23 '15 at 17:30
• @tokland: I heard about it, but I had a requirement that calling with a callback specified should be supported. And my solution gives plain sequential execution 'for free', as well as async execution style similar to futures or promises. – aplavin Mar 23 '15 at 17:37
• Have a look at Celluloid. – britishtea Mar 23 '15 at 19:31


text:
show · ag.base_change all knowls · up · search:

Let $V$ be an algebraic variety defined over a field $K$. If $L$ is a field extension of $K$, then the same polynomials defining $V$ over $K$ also define a variety over $L$ called the base change of $V$ from $K$ to $L$.

Authors:
Knowl status:
• Review status: reviewed
• Last edited by Christelle Vincent on 2017-05-24 05:30:10
Referred to by:
History:


text:
# Local compactness in an open subset

Let $X$ be a Hausdorff space and let $U$ be a non-empty open locally compact subset of $X$. Since $U$ is non-empty, there exists an $x\in U$. Then there exists an open neighbourhood of $x$, let's call it $F$, such that $F$ is compact in $U$. Can we say that $F$ is compact in $X$?

-
Compactness is intrinsic to a topological space and does not depend on the embedding. In other words, $F$ is compact in $U$ if and only if it is compact in $X$. –  Zhen Lin Dec 31 '12 at 8:37
You seem confused about the definition of local compactness: there is an open neighbourhood $F$ of $x$ such that $\overline F$ is compact, not $F$. Of course, they're the same if $F$ is closed as well as open, but most of the time that isn't the case. –  tomasz Dec 31 '12 at 12:57
@tomasz, No, I did not confuse about the definition. look at $X$ is Hausdorff. By definition cl F compact but, in Hausdorff space every compact space is closed. –  ege Dec 31 '12 at 16:56
@ege: cl $F$ is compact, but $F$ isn't, usually.. –  tomasz Dec 31 '12 at 16:58
@ege: Is $(0,1)$ locally compact? Does any point have a compact open neighbourhood? –  tomasz Jan 1 '13 at 11:07

Let $(X,\mathcal{T})$ a Hausdorff space. A set $F \subseteq X$ is called compact $\Leftrightarrow (F,\mathcal{T}_F)$ is compact where $\mathcal{T}_F := \{O \cap F; O \in \mathcal{T}\}$ denotes the subspace topology on $F$.
In your case: The topology on $U$ is given by $\mathcal{S} := \mathcal{T}_U$. By assumption $F$ is compact in $U$, i.e. $(F,\mathcal{S}_F)$ is compact. Since
$$\mathcal{S}_F = \{O' \cap F; O' \in \mathcal{S}=\mathcal{T}_U\} = \{\underbrace{O \cap F \cap U}_{O \cap F}; O \in \mathcal{T}\} = \mathcal{T}_F$$
we conclude that $(F,\mathcal{T}_F)$ is compact which means that $F$ is compact in $X$.